summaryrefslogtreecommitdiff
path: root/spec/support/matchers/user_status_matcher.rb
blob: 3cf240d874a9ce0a0624ac06d2e01dc45cebe9cc (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
# frozen_string_literal: true

RSpec::Matchers.define :show_user_status do |status|
  match do |page|
    expect(page).to have_selector(".user-status-emoji[title='#{status.message}']")

    # The same user status might be displayed multiple times on the page
    emoji_span = page.first(".user-status-emoji[title='#{status.message}']")
    page.within(emoji_span) do
      expect(page).to have_emoji(status.emoji)
    end
  end
end