Merge 7822a8d4e3 into 6cde2a5f4a
This commit is contained in:
commit
19855d9cba
9 changed files with 469 additions and 34 deletions
|
|
@ -1,6 +1,7 @@
|
|||
require 'spec_helper'
|
||||
|
||||
feature Registration do
|
||||
let!(:first_user) { create(:user) } # first user is admin
|
||||
let!(:conference) { create(:conference, registration_period: create(:registration_period, start_date: 3.days.ago)) }
|
||||
let!(:participant) { create(:user) }
|
||||
|
||||
|
|
@ -28,13 +29,29 @@ feature Registration do
|
|||
expect(conference.user_registered?(participant)).to be(true)
|
||||
end
|
||||
|
||||
scenario 'unregisters for a conference', feature: true, js: true do
|
||||
visit root_path
|
||||
click_link 'My Registration'
|
||||
expect(current_path).to eq(conference_conference_registrations_path(conference.short_title))
|
||||
context 'unregisters for a conference', feature: true, js: true do
|
||||
before do
|
||||
visit root_path
|
||||
click_link 'My Registration'
|
||||
end
|
||||
|
||||
click_link 'Unregister'
|
||||
expect(conference.user_registered?(participant)).to be(false)
|
||||
scenario 'deletion of registration is successful' do
|
||||
expect(current_path).to eq(conference_conference_registrations_path(conference.short_title))
|
||||
|
||||
click_link 'Unregister'
|
||||
expect(conference.user_registered?(participant)).to be(false)
|
||||
expect(current_path).to eq root_path
|
||||
expect(flash).to eq 'You are not registered for The dog and pony show anymore!'
|
||||
end
|
||||
|
||||
scenario 'deletion of registration is unsuccessful' do
|
||||
allow_any_instance_of(Registration).to receive(:destroy).and_return(false)
|
||||
|
||||
click_link 'Unregister'
|
||||
expect(conference.user_registered?(participant)).to be(true)
|
||||
expect(current_path).to eq conference_conference_registrations_path(conference.short_title)
|
||||
expect(flash).to eq "Could not delete your registration for #{conference.title}: #{registration.errors.full_messages.join('. ')}."
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
|
|
@ -49,5 +66,15 @@ feature Registration do
|
|||
expect(conference.user_registered?(participant)).to be(true)
|
||||
end
|
||||
end
|
||||
|
||||
context 'registration is closed' do
|
||||
let(:conference_with_closed_registration) { create(:conference, registration_period: create(:registration_period)) }
|
||||
|
||||
scenario 'registers for a conference', feature: true do
|
||||
visit new_conference_conference_registrations_path(conference_with_closed_registration.short_title)
|
||||
expect(current_path).to eq(root_path)
|
||||
expect(flash).to eq 'You are not authorized to access this page.'
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
|
|||
|
|
@ -2,6 +2,7 @@ require 'spec_helper'
|
|||
|
||||
feature Event do
|
||||
let!(:conference) { create(:conference) }
|
||||
let!(:registration_period) { create(:registration_period, conference: conference, start_date: Date.current) }
|
||||
let!(:cfp) { create(:cfp, program_id: conference.program.id) }
|
||||
let!(:organizer_role) { Role.find_by(name: 'organizer', resource: conference) }
|
||||
let!(:organizer) { create(:user, email: 'admin@example.com', role_ids: [organizer_role.id]) }
|
||||
|
|
@ -134,6 +135,7 @@ feature Event do
|
|||
click_link "confirm_proposal_#{@event.id}"
|
||||
expect(flash).
|
||||
to eq('The proposal was confirmed. Please register to attend the conference.')
|
||||
expect(current_path).to eq(new_conference_conference_registrations_path(conference.short_title))
|
||||
@event.reload
|
||||
expect(@event.state).to eq('confirmed')
|
||||
end
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue