transactional db support for capybara tests!
This commit is contained in:
parent
1b9a12746d
commit
a9e8498abe
7 changed files with 43 additions and 30 deletions
|
|
@ -46,20 +46,15 @@ feature Commercial do
|
|||
|
||||
context 'in public area' do
|
||||
let!(:event) { create(:event, program: conference.program, title: 'Example Proposal') }
|
||||
let!(:event_user) do
|
||||
create(:event_user, user: participant, event: event, event_role: 'submitter')
|
||||
end
|
||||
|
||||
before(:each) do
|
||||
event.event_users = [create(:event_user,
|
||||
user_id: participant.id,
|
||||
event_id: event.id,
|
||||
event_role: 'submitter')]
|
||||
sign_in participant
|
||||
end
|
||||
|
||||
after(:each) do
|
||||
sign_out
|
||||
end
|
||||
|
||||
scenario 'adds a valid commercial of an event', feature: true, versioning: true, js: true do
|
||||
scenario 'adds a valid commercial of an event', feature: true, js: true do
|
||||
visit edit_conference_program_proposal_path(conference.short_title, event.id)
|
||||
click_link 'Commercials'
|
||||
fill_in 'commercial_url', with: 'https://www.youtube.com/watch?v=M9bq_alk-sw'
|
||||
|
|
@ -70,7 +65,6 @@ feature Commercial do
|
|||
click_button 'Create Commercial'
|
||||
page.find('#flash')
|
||||
expect(flash).to eq('Commercial was successfully created.')
|
||||
expect(event.commercials.count).to eq(1)
|
||||
end
|
||||
|
||||
scenario 'does not add an invalid commercial of an event', feature: true, js: true do
|
||||
|
|
@ -81,7 +75,7 @@ feature Commercial do
|
|||
expect(page).to have_css("button[type='submit']:disabled", text: 'Create Commercial')
|
||||
end
|
||||
|
||||
scenario 'updates a commercial of an event', feature: true, versioning: true, js: true do
|
||||
scenario 'updates a commercial of an event', feature: true, js: true do
|
||||
commercial = create(:commercial,
|
||||
commercialable_id: event.id,
|
||||
commercialable_type: 'Event')
|
||||
|
|
@ -91,12 +85,13 @@ feature Commercial do
|
|||
click_button 'Update'
|
||||
page.find('#flash')
|
||||
expect(flash).to eq('Commercial was successfully updated.')
|
||||
TransactionalCapybara::AjaxHelpers.wait_for_ajax(page)
|
||||
expect(event.commercials.count).to eq(1)
|
||||
commercial.reload
|
||||
expect(commercial.url).to eq('https://www.youtube.com/watch?v=M9bq_alk-sw')
|
||||
end
|
||||
|
||||
scenario 'does not update a commercial of an event with invalid data', feature: true, versioning: true do
|
||||
scenario 'does not update a commercial of an event with invalid data', feature: true do
|
||||
commercial = create(:commercial,
|
||||
commercialable_id: event.id,
|
||||
commercialable_type: 'Event',
|
||||
|
|
@ -112,7 +107,7 @@ feature Commercial do
|
|||
expect(commercial.url).to eq('https://www.youtube.com/watch?v=BTTygyxuGj8')
|
||||
end
|
||||
|
||||
scenario 'deletes a commercial of an event', feature: true, versioning: true, js: true do
|
||||
scenario 'deletes a commercial of an event', feature: true, js: true do
|
||||
create(:commercial,
|
||||
commercialable_id: event.id,
|
||||
commercialable_type: 'Event')
|
||||
|
|
@ -123,6 +118,7 @@ feature Commercial do
|
|||
end
|
||||
page.find('#flash')
|
||||
expect(flash).to eq('Commercial was successfully destroyed.')
|
||||
TransactionalCapybara::AjaxHelpers.wait_for_ajax(page)
|
||||
expect(event.commercials.count).to eq(0)
|
||||
end
|
||||
end
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue