Commit 2bf3846a authored by Bob Van Landuyt's avatar Bob Van Landuyt

Add matcher for emoji

parent c39e3f22
...@@ -45,7 +45,7 @@ feature 'Admin Broadcast Messages' do ...@@ -45,7 +45,7 @@ feature 'Admin Broadcast Messages' do
page.within('.broadcast-message-preview') do page.within('.broadcast-message-preview') do
expect(page).to have_selector('strong', text: 'Markdown') 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 end
end end
...@@ -98,7 +98,7 @@ feature 'Group show page' do ...@@ -98,7 +98,7 @@ feature 'Group show page' do
it 'shows the project info' do it 'shows the project info' do
expect(page).to have_content(project.title) 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 end
end end
...@@ -99,7 +99,7 @@ describe 'User interacts with awards in an issue', :js do ...@@ -99,7 +99,7 @@ describe 'User interacts with awards in an issue', :js do
click_button('Comment') click_button('Comment')
end end
expect(page).to have_selector('gl-emoji[data-name="smile"]') expect(page).to have_emoji('smile')
end end
context 'when a project is archived' do context 'when a project is archived' do
...@@ -118,7 +118,7 @@ describe 'User interacts with awards in an issue', :js do ...@@ -118,7 +118,7 @@ describe 'User interacts with awards in an issue', :js do
it 'shows the award on the note' do it 'shows the award on the note' do
page.within('.note-awards') do page.within('.note-awards') do
expect(page).to have_selector('gl-emoji[data-name="100"]') expect(page).to have_emoji('100')
end end
end end
...@@ -141,7 +141,7 @@ describe 'User interacts with awards in an issue', :js do ...@@ -141,7 +141,7 @@ describe 'User interacts with awards in an issue', :js do
wait_for_requests wait_for_requests
page.within('.note-awards') do page.within('.note-awards') do
expect(page).to have_selector('gl-emoji[data-name="8ball"]') expect(page).to have_emoji('8ball')
end end
expect(note.reload.award_emoji.size).to eq(2) expect(note.reload.award_emoji.size).to eq(2)
end end
......
RSpec::Matchers.define :have_emoji do |emoji_name|
match do |actual|
expect(actual).to have_selector("gl-emoji[data-name='#{emoji_name}']")
end
end
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment