Use dynamic fake data in the spec

This commit is contained in:
Henne Vogelsang 2016-05-02 15:25:18 +02:00
parent 4d38305110
commit 73ce49de25
14 changed files with 36 additions and 36 deletions

View file

@ -35,13 +35,13 @@ feature Lodging do
visit admin_conference_lodgings_path(
conference_id: conference.short_title)
expect(page.has_content?('Example Hotel')).to be true
expect(page.has_content?(lodging.name)).to be true
# Add lodging
click_link 'Edit'
fill_in 'lodging_name', with: 'New lodging'
fill_in 'lodging_website_link', with: 'http:\\www.google.com'
fill_in 'lodging_website_link', with: 'http://www.google.com'
attach_file 'Picture', path
click_button 'Update Lodging'
@ -51,26 +51,26 @@ feature Lodging do
expect(page.has_content?('New lodging')).to be true
lodging.reload
expect(lodging.name).to eq('New lodging')
expect(lodging.description).to eq('Lorem Ipsum Dolor')
expect(lodging.website_link).to eq('http:\\www.google.com')
expect(lodging.description).to eq(lodging.description)
expect(lodging.website_link).to eq('http://www.google.com')
expect(Lodging.count).to eq(1)
end
scenario 'Delete a lodging', feature: true, js: true do
conference.lodgings << create(:lodging)
lodging = create(:lodging, conference: conference)
sign_in organizer
visit admin_conference_lodgings_path(
conference_id: conference.short_title)
expect(page.has_content?('Example Hotel')).to be true
expect(page.has_content?(lodging.name)).to be true
# Add lodging
click_link 'Delete'
# Validations
expect(flash).to eq('Lodging successfully deleted.')
expect(page.has_content?('Example Hotel')).to be false
expect(page.has_content?(lodging.name)).to be false
expect(Lodging.count).to eq(0)
end
end

View file

@ -21,7 +21,7 @@ feature Sponsor do
fill_in 'sponsor_description', with: 'The original provider of the enterprise Linux distribution'
attach_file 'Picture', path
fill_in 'sponsor_website_url', with: 'http://www.suse.com'
select('Platin', from: 'sponsor_sponsorship_level_id')
select(conference.sponsorship_levels.first.title, from: 'sponsor_sponsorship_level_id')
click_button 'Create Sponsor'
@ -30,7 +30,7 @@ feature Sponsor do
expect(page.has_content?('SUSE')).to be true
expect(page.has_content?('The original provider')).to be true
expect(page.has_content?('http://www.suse.com')).to be true
expect(page.has_content?('Platin')).to be true
expect(page.has_content?(conference.sponsorship_levels.first.title)).to be true
expect(page).to have_selector("img[src*='rails.png']")
expect(page.assert_selector('tr', count: 2)).to be true
end

View file

@ -33,7 +33,7 @@ feature Registration do
expect(current_path).to eq(conference_conference_registrations_path(conference.short_title))
expect(flash).
to eq("Thank you for supporting #{conference.title} by purchasing a ticket.")
expect(page.has_content?('2 Business Ticket Tickets for 10')).to be true
expect(page.has_content?("2 #{ticket.title} Tickets for 10")).to be true
end
scenario 'deletes a purchased ticket', feature: true, js: true do
@ -41,7 +41,7 @@ feature Registration do
create(:ticket_purchase, conference: conference, user: participant, ticket: ticket, quantity: 4)
visit conference_conference_registrations_path(conference.short_title)
expect(page.has_content?('4 Business Ticket Tickets for 10')).to be true
expect(page.has_content?("4 #{ticket.title} Tickets for 10")).to be true
click_link "ticket-#{ticket.id}-delete"
expect(flash).to eq('Ticket successfully deleted.')