parent
518e1cc62b
commit
5fe99dd041
26 changed files with 352 additions and 130 deletions
|
|
@ -8,51 +8,58 @@ feature Lodging do
|
|||
|
||||
shared_examples 'lodgings' do |user|
|
||||
scenario 'adds and updates lodgings', feature: true, js: true do
|
||||
path = "#{Rails.root}/app/assets/images/rails.png"
|
||||
expected_count = Lodging.count + 1
|
||||
conference = create(:conference)
|
||||
conference.venue = create(:venue)
|
||||
sign_in create(user)
|
||||
|
||||
visit admin_conference_lodgings_path(
|
||||
conference_id: conference.short_title)
|
||||
|
||||
# Add lodging
|
||||
click_link 'Add lodging'
|
||||
expect(page.all('div.nested-fields').count == 1).to be true
|
||||
page.
|
||||
find('div.nested-fields:nth-of-type(1) div:nth-of-type(1) input').
|
||||
set('Example Hotel')
|
||||
|
||||
page.
|
||||
find('div.nested-fields:nth-of-type(1) div:nth-of-type(2) textarea').
|
||||
set('Lorem Ipsum Dolor')
|
||||
|
||||
attach_file 'Photo', path
|
||||
|
||||
page.
|
||||
find('div.nested-fields:nth-of-type(1) div:nth-of-type(4) input').
|
||||
set('http://www.example.com')
|
||||
|
||||
click_button 'Update Venue'
|
||||
click_link 'New Lodging'
|
||||
fill_in 'lodging_name', with: 'Lodging1000'
|
||||
fill_in 'lodging_description', with: 'Lorem ipsum dolorem'
|
||||
attach_file('lodging_photo', Rails.root + 'spec/fixtures/suse.jpg')
|
||||
fill_in 'lodging_website_link', with: 'http://www.suse.com'
|
||||
click_button 'Save Lodging'
|
||||
|
||||
# Validations
|
||||
expect(flash).to eq('Lodgings were successfully updated.')
|
||||
expect(Lodging.count).to eq(expected_count)
|
||||
expect(flash).to eq('Lodging was successfully created.')
|
||||
expect(page.has_content?('Lodging1000')).to be true
|
||||
expect(page.has_content?('Lorem ipsum dolorem')).to be true
|
||||
expect(page.has_content?('http://www.suse.com')).to be true
|
||||
|
||||
expect(find('div.nested-fields:nth-of-type(1) div:nth-of-type(1) input').
|
||||
value).to eq('Example Hotel')
|
||||
# Update room
|
||||
click_link 'Edit'
|
||||
fill_in 'lodging_name', with: 'Lodging2000'
|
||||
fill_in 'lodging_description', with: 'Lorem ipsum dolorem...'
|
||||
attach_file('lodging_photo', Rails.root + 'spec/fixtures/suse_pinguin.png')
|
||||
fill_in 'lodging_website_link', with: 'http://www.opensuse.com'
|
||||
click_button 'Save Lodging'
|
||||
|
||||
expect(find('div.nested-fields:nth-of-type(1) div:nth-of-type(2) textarea').
|
||||
value).to eq('Lorem Ipsum Dolor')
|
||||
|
||||
expect(page).to have_selector("img[src*='rails.png']")
|
||||
|
||||
expect(find('div.nested-fields:nth-of-type(1) div:nth-of-type(4) input').
|
||||
value).to eq('http://www.example.com')
|
||||
# Validations
|
||||
expect(Lodging.count).to eq(expected_count)
|
||||
expect(flash).to eq('Lodging was successfully updated.')
|
||||
expect(page.has_content?('Lodging2000')).to be true
|
||||
expect(page.has_content?('Lorem ipsum dolorem...')).to be true
|
||||
expect(page.has_content?('http://www.opensuse.com')).to be true
|
||||
|
||||
# Remove room
|
||||
click_link 'Remove lodging'
|
||||
expect(page.all('div.nested-fields').count == 0).to be true
|
||||
click_link 'Delete'
|
||||
|
||||
# Validations
|
||||
expect(Lodging.count).to eq(expected_count - 1)
|
||||
expect(flash).to eq('Lodging was successfully destroyed.')
|
||||
expect(page.has_content?('Lodging2000')).to be false
|
||||
expect(page.has_content?('Lorem ipsum dolorem...')).to be false
|
||||
expect(page.has_content?('http://www.opensuse.com')).to be false
|
||||
|
||||
# Enable lodgings for splash page
|
||||
check('venue_include_lodgings_in_splash')
|
||||
click_button 'Update Venue'
|
||||
expect(flash).to eq('Lodgings were successfully updated.')
|
||||
expect(page.all('div.nested-fields').count == 0).to be true
|
||||
expect(flash).to eq('Venue was successfully updated.')
|
||||
end
|
||||
end
|
||||
|
||||
|
|
|
|||
|
|
@ -9,37 +9,45 @@ feature Room do
|
|||
shared_examples 'rooms' do |user|
|
||||
scenario 'adds and updates rooms', feature: true, js: true do
|
||||
conference = create(:conference)
|
||||
expected_count = Room.count + 1
|
||||
sign_in create(user)
|
||||
visit admin_conference_rooms_path(
|
||||
conference_id: conference.short_title)
|
||||
|
||||
# Add room
|
||||
click_link 'Add room'
|
||||
expect(page.all('div.nested-fields').count == 1).to be true
|
||||
|
||||
page.
|
||||
find('div.nested-fields:nth-of-type(1) div:nth-of-type(1) input').
|
||||
set('Example room')
|
||||
|
||||
page.
|
||||
find('div.nested-fields:nth-of-type(1) div:nth-of-type(2) input').
|
||||
set('100')
|
||||
|
||||
click_button 'Update Conference'
|
||||
click_link 'New Room'
|
||||
fill_in 'room_name', with: 'Room1000'
|
||||
fill_in 'room_size', with: '500'
|
||||
check('room_public')
|
||||
click_button 'Save Room'
|
||||
|
||||
# Validations
|
||||
expect(flash).to eq('Rooms were successfully updated.')
|
||||
expect(find('div.nested-fields:nth-of-type(1) div:nth-of-type(1) input').
|
||||
value).to eq('Example room')
|
||||
expect(find('div.nested-fields:nth-of-type(1) div:nth-of-type(2) input').
|
||||
value).to eq('100')
|
||||
expect(Room.count).to eq(expected_count)
|
||||
expect(flash).to eq('Room was successfully created.')
|
||||
expect(page.has_content?('Room1000')).to be true
|
||||
expect(page.has_content?('500')).to be true
|
||||
|
||||
# Update room
|
||||
click_link 'Room1000'
|
||||
fill_in 'room_name', with: 'Room2000'
|
||||
fill_in 'room_size', with: '600'
|
||||
check('room_public')
|
||||
click_button 'Save Room'
|
||||
|
||||
# Validations
|
||||
expect(Room.count).to eq(expected_count)
|
||||
expect(flash).to eq('Room was successfully updated.')
|
||||
expect(page.has_content?('Room2000')).to be true
|
||||
expect(page.has_content?('600')).to be true
|
||||
|
||||
# Remove room
|
||||
click_link 'Remove room'
|
||||
expect(page.all('div.nested-fields').count == 0).to be true
|
||||
click_button 'Update Conference'
|
||||
expect(flash).to eq('Rooms were successfully updated.')
|
||||
expect(page.all('div.nested-fields').count == 0).to be true
|
||||
click_link 'Delete'
|
||||
|
||||
# Validations
|
||||
expect(Room.count).to eq(expected_count - 1)
|
||||
expect(flash).to eq('Room was successfully destroyed.')
|
||||
expect(page.has_content?('Room2000')).to be false
|
||||
expect(page.has_content?('600')).to be false
|
||||
end
|
||||
end
|
||||
|
||||
|
|
|
|||
|
|
@ -12,12 +12,14 @@ feature Conference do
|
|||
conference = create(:conference)
|
||||
|
||||
sign_in create(user)
|
||||
visit admin_conference_venue_info_path(
|
||||
visit edit_admin_conference_venue_path(
|
||||
conference_id: conference.short_title)
|
||||
|
||||
expect(page.find("//*[@id='venue_submit_action']").
|
||||
text).to eq('Update Venue')
|
||||
|
||||
click_link 'Edit'
|
||||
|
||||
fill_in 'venue_name', with: 'Example University'
|
||||
fill_in 'venue_address', with: 'Example Street 42 \n' +
|
||||
'12345 Example City \n Germany'
|
||||
|
|
|
|||
BIN
spec/fixtures/suse.jpg
vendored
Normal file
BIN
spec/fixtures/suse.jpg
vendored
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 189 KiB |
BIN
spec/fixtures/suse_pinguin.png
vendored
Normal file
BIN
spec/fixtures/suse_pinguin.png
vendored
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 53 KiB |
|
|
@ -3,6 +3,7 @@ describe 'admin/rooms/index' do
|
|||
|
||||
it 'renders rooms list' do
|
||||
@room = create(:room)
|
||||
assign :rooms, [@room]
|
||||
assign :conference, @room.conference
|
||||
render
|
||||
expect(rendered).to include('Example Room')
|
||||
|
|
|
|||
|
|
@ -1,15 +1,14 @@
|
|||
require 'spec_helper'
|
||||
|
||||
describe 'admin/venue/venue_info' do
|
||||
describe 'admin/venues/edit' do
|
||||
|
||||
it 'renders venue#show' do
|
||||
it 'renders venue#edit' do
|
||||
@conference = create(:conference)
|
||||
@venue = @conference.venue
|
||||
@venue.name = 'Croatia'
|
||||
@venue.description = 'Lorem ipsum dolsum'
|
||||
@venue.save!
|
||||
assign :conference, @conference
|
||||
assign :venue, @venue
|
||||
render
|
||||
expect(rendered).to include('Croatia')
|
||||
expect(rendered).to include('Lorem ipsum dolsum')
|
||||
Loading…
Add table
Add a link
Reference in a new issue