diff options
author | Bob Van Landuyt <bob@vanlanduyt.co> | 2018-07-16 18:18:52 +0200 |
---|---|---|
committer | Bob Van Landuyt <bob@vanlanduyt.co> | 2018-07-30 15:01:26 +0200 |
commit | f1d3ea63cf74d2791a9a863b29ab2d919ea61bd0 (patch) | |
tree | c36c2b272fba917af321a4f16c34a5047407f3b2 /spec/support | |
parent | b4c4b48a8c0258ff266c523488aa169a1b5ea0f3 (diff) | |
download | gitlab-ce-f1d3ea63cf74d2791a9a863b29ab2d919ea61bd0.tar.gz |
Show the status of a user in interactions
The status is shown for
- The author of a commit when viewing a commit
- Notes on a commit (regular/diff)
- The user that triggered a pipeline when viewing a pipeline
- The author of a merge request when viewing a merge request
- The author of notes on a merge request (regular/diff)
- The author of an issue when viewing an issue
- The author of notes on an issue
- The author of a snippet when viewing a snippet
- The author of notes on a snippet
- A user's profile page
- The list of members of a group/user
Diffstat (limited to 'spec/support')
-rw-r--r-- | spec/support/matchers/user_status_matcher.rb | 13 | ||||
-rw-r--r-- | spec/support/shared_examples/showing_user_status_shared_examples.rb | 11 |
2 files changed, 24 insertions, 0 deletions
diff --git a/spec/support/matchers/user_status_matcher.rb b/spec/support/matchers/user_status_matcher.rb new file mode 100644 index 00000000000..3cf240d874a --- /dev/null +++ b/spec/support/matchers/user_status_matcher.rb @@ -0,0 +1,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 diff --git a/spec/support/shared_examples/showing_user_status_shared_examples.rb b/spec/support/shared_examples/showing_user_status_shared_examples.rb new file mode 100644 index 00000000000..eef769de2fc --- /dev/null +++ b/spec/support/shared_examples/showing_user_status_shared_examples.rb @@ -0,0 +1,11 @@ +# frozen_string_literal: true + +shared_examples 'showing user status' do + let!(:status) { create(:user_status, user: user_with_status, emoji: 'smirk', message: 'Authoring this object') } + + it 'shows the status' do + subject + + expect(page).to show_user_status(status) + end +end |