Merge pull request #2591 from openSUSE/remove-travel-schedule

Remove travel schedule from registration
This commit is contained in:
Henne Vogelsang 2021-03-06 05:04:07 +01:00 committed by GitHub
commit 823f41427f
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
16 changed files with 29 additions and 144 deletions

View file

@ -290,14 +290,15 @@ describe ConferenceRegistrationsController, type: :controller do
before do
@registration = create(:registration,
conference: conference,
user: user,
arrival: Date.new(2014, 04, 25))
user: user)
end
context 'updates successfully' do
before do
patch :update, params: { registration: attributes_for(:registration, arrival: Date.new(2014, 04, 29)),
conference_id: conference.short_title }
patch :update, params: {
registration: attributes_for(:registration, volunteer: true),
conference_id: conference.short_title
}
end
it 'redirects to registration show path' do
@ -309,16 +310,17 @@ describe ConferenceRegistrationsController, type: :controller do
end
it 'updates the registration' do
@registration.reload
expect(@registration.arrival).to eq Date.new(2014, 04, 29)
expect{ @registration.reload }.to change(@registration, :updated_at)
end
end
context 'update fails' do
before do
allow_any_instance_of(Registration).to receive(:update_attributes).and_return(false)
patch :update, params: { registration: attributes_for(:registration, arrival: Date.new(2014, 04, 27)),
conference_id: conference.short_title }
patch :update, params: {
registration: attributes_for(:registration, volunteer: true),
conference_id: conference.short_title
}
end
it 'renders edit template' do
@ -331,7 +333,7 @@ describe ConferenceRegistrationsController, type: :controller do
it 'does not update the registration' do
@registration.reload
expect(@registration.arrival).to eq Date.new(2014, 04, 25)
expect { @registration.reload }.not_to change(@registration, :updated_at)
end
end
end

View file

@ -51,26 +51,4 @@ describe Registration do
expect(subject).to receive(:send_registration_mail)
end
end
describe 'registration_to_events_only_if_present' do
context 'valid' do
it 'when user registers for events happening while user is at the conference' do
registration.arrival = conference.start_date
registration.departure = conference.end_date
registration.events << create(:event, program: conference.program, start_time: conference.end_date)
expect(registration.valid?).to eq true
end
end
context 'invalid' do
it 'when user registers for events happening while user is not at the conference' do
registration.arrival = conference.start_date
registration.departure = conference.start_date
registration.events << create(:event, program: conference.program, start_time: conference.end_date)
expect(registration.valid?).to eq false
end
end
end
end