adds a helper for avatars in specs

This commit is contained in:
David Gil
2015-08-14 21:18:31 +02:00
parent c6154fe48d
commit f835154233
4 changed files with 7 additions and 3 deletions

View File

@@ -16,7 +16,7 @@ feature 'Account' do
expect(page).to have_selector("input[value='Manuela']")
expect(page).to have_selector("input[value='Colau']")
expect(page).to have_selector("img.initialjs-avatar[data-name='Manuela Colau'][data-height='100']", count: 1)
expect(page).to have_selector(avatar('Manuela Colau'), count: 1)
end
scenario "Failed Edit" do

View File

@@ -17,7 +17,7 @@ feature 'Comments' do
expect(page).to have_content comment.user.name
expect(page).to have_content time_ago_in_words(comment.created_at)
expect(page).to have_content comment.body
expect(page).to have_selector("img.initialjs-avatar[data-name='#{comment.user.name}'][data-height='32']", count: 1)
expect(page).to have_selector(avatar(comment.user.name), count: 1)
end
end

View File

@@ -25,7 +25,7 @@ feature 'Debates' do
expect(page).to have_content "Debate description"
expect(page).to have_content debate.author.name
expect(page).to have_content I18n.l(Date.today)
expect(page).to have_selector("img.initialjs-avatar[data-name='#{debate.author.name}'][data-height='32']", count: 1)
expect(page).to have_selector(avatar(debate.author.name), count: 1)
within('.social-share-button') do
expect(page.all('a').count).to be(3) # Twitter, Facebook, Google+

View File

@@ -56,4 +56,8 @@ module CommonActions
SimpleCaptcha::SimpleCaptchaData.first.value
end
def avatar(name)
"img.initialjs-avatar[data-name='#{name}']"
end
end