diff options
author | Bob Van Landuyt <bob@vanlanduyt.co> | 2018-04-11 10:34:42 +0200 |
---|---|---|
committer | Bob Van Landuyt <bob@vanlanduyt.co> | 2018-04-11 10:51:44 +0200 |
commit | 2bf3846adcac843958837a32fafdeb63d067a532 (patch) | |
tree | ba1317eea7ac5bb9c7a2f4264e1394bf926c980b /spec | |
parent | c39e3f22ce12a302e294deb3523414e4a684b6fb (diff) | |
download | gitlab-ce-2bf3846adcac843958837a32fafdeb63d067a532.tar.gz |
Add matcher for emoji
Diffstat (limited to 'spec')
4 files changed, 10 insertions, 5 deletions
diff --git a/spec/features/admin/admin_broadcast_messages_spec.rb b/spec/features/admin/admin_broadcast_messages_spec.rb index 9cb351282a0..430a8d22b0f 100644 --- a/spec/features/admin/admin_broadcast_messages_spec.rb +++ b/spec/features/admin/admin_broadcast_messages_spec.rb @@ -45,7 +45,7 @@ feature 'Admin Broadcast Messages' do page.within('.broadcast-message-preview') do expect(page).to have_selector('strong', text: 'Markdown') - expect(page).to have_selector('gl-emoji[data-name="tada"]') + expect(page).to have_emoji('tada') end end end diff --git a/spec/features/groups/show_spec.rb b/spec/features/groups/show_spec.rb index 4ffadbbcd35..3a0424d60f8 100644 --- a/spec/features/groups/show_spec.rb +++ b/spec/features/groups/show_spec.rb @@ -98,7 +98,7 @@ feature 'Group show page' do it 'shows the project info' do expect(page).to have_content(project.title) - expect(page).to have_selector('gl-emoji[data-name="smile"]') + expect(page).to have_emoji('smile') end end end diff --git a/spec/features/projects/awards/user_interacts_with_awards_in_issue_spec.rb b/spec/features/projects/awards/user_interacts_with_awards_in_issue_spec.rb index 8a3d83da93f..a4890b34208 100644 --- a/spec/features/projects/awards/user_interacts_with_awards_in_issue_spec.rb +++ b/spec/features/projects/awards/user_interacts_with_awards_in_issue_spec.rb @@ -99,7 +99,7 @@ describe 'User interacts with awards in an issue', :js do click_button('Comment') end - expect(page).to have_selector('gl-emoji[data-name="smile"]') + expect(page).to have_emoji('smile') end context 'when a project is archived' do @@ -118,7 +118,7 @@ describe 'User interacts with awards in an issue', :js do it 'shows the award on the note' do page.within('.note-awards') do - expect(page).to have_selector('gl-emoji[data-name="100"]') + expect(page).to have_emoji('100') end end @@ -141,7 +141,7 @@ describe 'User interacts with awards in an issue', :js do wait_for_requests page.within('.note-awards') do - expect(page).to have_selector('gl-emoji[data-name="8ball"]') + expect(page).to have_emoji('8ball') end expect(note.reload.award_emoji.size).to eq(2) end diff --git a/spec/support/matchers/have_emoji.rb b/spec/support/matchers/have_emoji.rb new file mode 100644 index 00000000000..23fb8e9c1c4 --- /dev/null +++ b/spec/support/matchers/have_emoji.rb @@ -0,0 +1,5 @@ +RSpec::Matchers.define :have_emoji do |emoji_name| + match do |actual| + expect(actual).to have_selector("gl-emoji[data-name='#{emoji_name}']") + end +end |