2018-05-07 16:47:29 -07:00
|
|
|
# frozen_string_literal: true
|
|
|
|
|
|
2014-05-14 17:27:42 +02:00
|
|
|
require 'spec_helper'
|
|
|
|
|
|
|
|
|
|
feature Conference do
|
2014-08-12 15:48:29 +03:00
|
|
|
let!(:conference) { create(:conference) }
|
2019-03-13 10:31:42 +01:00
|
|
|
let!(:organizer) { create(:organizer, resource: conference) }
|
2014-05-14 17:27:42 +02:00
|
|
|
|
2014-08-12 15:48:29 +03:00
|
|
|
shared_examples 'venue' do
|
2014-05-14 17:27:42 +02:00
|
|
|
scenario 'adds and updates venue' do
|
|
|
|
|
|
2014-08-12 15:48:29 +03:00
|
|
|
sign_in organizer
|
|
|
|
|
|
2015-04-14 17:33:59 +02:00
|
|
|
# create the venue
|
|
|
|
|
visit admin_conference_venue_path(
|
2014-05-14 17:27:42 +02:00
|
|
|
conference_id: conference.short_title)
|
2015-04-14 17:33:59 +02:00
|
|
|
click_link 'Create Venue'
|
2014-05-14 17:27:42 +02:00
|
|
|
fill_in 'venue_name', with: 'Example University'
|
2014-11-20 14:57:03 +01:00
|
|
|
fill_in 'venue_street', with: 'Example Street 42'
|
|
|
|
|
fill_in 'venue_city', with: 'Example City'
|
|
|
|
|
fill_in 'venue_postalcode', with: '12345'
|
|
|
|
|
select 'Germany', from: 'venue_country'
|
2014-05-14 17:27:42 +02:00
|
|
|
fill_in 'venue_website', with: 'www.example.com'
|
|
|
|
|
fill_in 'venue_description',
|
|
|
|
|
with: 'Lorem ipsum dolor sit amet, consetetur' \
|
|
|
|
|
'sadipscing elitr, sed diam nonumy eirmod tempor'
|
2015-04-14 17:33:59 +02:00
|
|
|
click_button 'Create Venue'
|
2025-08-06 13:04:53 +02:00
|
|
|
|
|
|
|
|
within('#flash') { expect(page).to have_text('Venue was successfully created.') }
|
|
|
|
|
|
2014-05-14 17:27:42 +02:00
|
|
|
venue = Conference.find(conference.id).venue
|
|
|
|
|
expect(venue.name).to eq('Example University')
|
2014-11-20 14:57:03 +01:00
|
|
|
expect(venue.street).to eq('Example Street 42')
|
2014-05-14 17:27:42 +02:00
|
|
|
expect(venue.website).to eq('www.example.com')
|
|
|
|
|
expect(venue.description).to eq('Lorem ipsum dolor sit amet, consetetur' \
|
|
|
|
|
'sadipscing elitr, sed diam nonumy eirmod tempor')
|
|
|
|
|
|
2015-04-14 17:33:59 +02:00
|
|
|
# edit the venue
|
2014-11-20 14:57:03 +01:00
|
|
|
click_link 'Edit Venue'
|
2014-05-14 17:27:42 +02:00
|
|
|
fill_in 'venue_name', with: 'Example University new'
|
|
|
|
|
fill_in 'venue_website', with: 'www.example.com new'
|
2015-04-14 17:33:59 +02:00
|
|
|
fill_in 'venue_description', with: 'new'
|
2014-05-14 17:27:42 +02:00
|
|
|
click_button 'Update Venue'
|
2025-08-06 13:04:53 +02:00
|
|
|
|
|
|
|
|
within('#flash') { expect(page).to have_text('Venue was successfully updated.') }
|
|
|
|
|
|
|
|
|
|
expect(venue.reload.name).to eq('Example University new')
|
|
|
|
|
expect(venue.reload.website).to eq('www.example.com new')
|
|
|
|
|
expect(venue.reload.description).to eq('new')
|
2014-05-14 17:27:42 +02:00
|
|
|
end
|
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
describe 'organizer' do
|
2014-08-12 15:48:29 +03:00
|
|
|
it_behaves_like 'venue'
|
2014-05-14 17:27:42 +02:00
|
|
|
end
|
|
|
|
|
|
|
|
|
|
end
|