Add matcher for emoji

This commit is contained in:
Bob Van Landuyt 2018-04-11 10:34:42 +02:00
parent c39e3f22ce
commit 2bf3846adc
4 changed files with 10 additions and 5 deletions

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -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