fix failing tests

This commit is contained in:
Chrisbr 2014-05-14 13:18:19 +02:00
parent f6088e9abe
commit f485f4ce57
4 changed files with 23 additions and 7 deletions

View file

@ -24,7 +24,7 @@ feature Conference do
click_button 'Create Conference'
expect(page.find('#flash_notice').text).
expect(flash).
to eq('Conference was successfully created.')
expect(Conference.count).to eq(expected_count)
end
@ -40,7 +40,7 @@ feature Conference do
fill_in 'conference_social_tag', with: 'NewCon'
click_button 'Update Conference'
expect(page.find('#flash_notice').text).
expect(flash).
to eq('Conference was successfully updated.')
conference.reload
@ -70,7 +70,7 @@ feature Conference do
click_button 'Update Venue'
expect(page.find('#flash_notice').text).
expect(flash).
to eq('Venue was successfully updated.')
venue = Conference.find(conference.id).venue
@ -90,7 +90,7 @@ feature Conference do
'sed diam voluptua. new'
click_button 'Update Venue'
expect(page.find('#flash_notice').text).
expect(flash).
to eq('Venue was successfully updated.')
venue.reload

View file

@ -48,7 +48,7 @@ feature Event do
click_button 'Update'
expect(page.find('#flash_notice').text).
expect(flash).
to eq('You updated your account successfully.')
expect(Event.count).to eq(expected_count)
@ -78,12 +78,12 @@ feature Event do
expect(page.has_content?('Example Proposal')).to be true
expect(page.has_content?('Accepted (confirmation pending)')).to be true
click_link "confirm_proposal_#{event.id}"
expect(page.find('#flash_notice').text).
expect(flash).
to eq('Event was confirmed. Please register to attend the conference.')
find('#register').click
expect(page.find('#flash_notice').text).
expect(flash).
to eq('You are now registered.')
end
end

View file

@ -50,6 +50,9 @@ RSpec.configure do |config|
# Includes support/login_macros for feature tests
config.include LoginMacros, type: :feature
# Includes support/flash for feature tests
config.include Flash, type: :feature
# As we start from scratch in April 2014, let's forbid the old :should syntax
config.expect_with :rspec do |c|
c.syntax = :expect

13
spec/support/flash.rb Normal file
View file

@ -0,0 +1,13 @@
module Flash
def flash
results = all(:css, 'div#flash p')
if results.empty?
return 'none'
end
if results.count > 1
texts = results.map { |r| r.text }
fail "One flash expected, but we had #{texts.inspect}"
end
results.first.text
end
end