mirror of
https://github.com/openSUSE/osem.git
synced 2026-08-13 19:54:02 +00:00
Merge branch 'more_feature_tests' into feature_tests
This commit is contained in:
commit
4d4d684378
3 changed files with 115 additions and 0 deletions
10
spec/factories/event_type.rb
Normal file
10
spec/factories/event_type.rb
Normal file
|
|
@ -0,0 +1,10 @@
|
|||
# Read about factories at https://github.com/thoughtbot/factory_girl
|
||||
|
||||
FactoryGirl.define do
|
||||
factory :event_type do
|
||||
title 'Example Event Type'
|
||||
length 30
|
||||
minimum_abstract_length 0
|
||||
maximum_abstract_length 500
|
||||
end
|
||||
end
|
||||
|
|
@ -46,12 +46,66 @@ feature Conference do
|
|||
end
|
||||
end
|
||||
|
||||
shared_examples 'venue' do |user|
|
||||
scenario 'adds and updates venue' do
|
||||
conference = create(:conference)
|
||||
|
||||
sign_in create(user)
|
||||
visit admin_conference_venue_info_path(conference_id: conference.short_title)
|
||||
|
||||
expect(page.find("//*[@id='venue_submit_action']").text).to eq('Update Venue')
|
||||
|
||||
fill_in 'venue_name', with: 'Example University'
|
||||
fill_in 'venue_address', with: 'Example Street 42 \n 12345 Example City \n Germany'
|
||||
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 invidunt ut labore et dolore magna aliquyam erat,' \
|
||||
'sed diam voluptua.'
|
||||
|
||||
click_button 'Update Venue'
|
||||
|
||||
expect(page.find('#flash_notice').text).
|
||||
to eq('Venue was successfully updated.')
|
||||
|
||||
venue = Conference.find(conference.id).venue
|
||||
expect(venue.name).to eq('Example University')
|
||||
expect(venue.address).to eq('Example Street 42 \n 12345 Example City \n Germany')
|
||||
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 invidunt ut labore et dolore magna aliquyam erat,' \
|
||||
'sed diam voluptua.')
|
||||
|
||||
fill_in 'venue_name', with: 'Example University new'
|
||||
fill_in 'venue_address', with: 'Example Street 42 \n 12345 Example City \n Germany new'
|
||||
fill_in 'venue_website', with: 'www.example.com new'
|
||||
fill_in 'venue_description',
|
||||
with: 'Lorem ipsum dolor sit amet, consetetur sadipscing elitr, sed diam' \
|
||||
'nonumy eirmod tempor invidunt ut labore et dolore magna aliquyam erat,' \
|
||||
'sed diam voluptua. new'
|
||||
|
||||
click_button 'Update Venue'
|
||||
expect(page.find('#flash_notice').text).
|
||||
to eq('Venue was successfully updated.')
|
||||
|
||||
venue.reload
|
||||
expect(venue.name).to eq('Example University new')
|
||||
expect(venue.address).to eq('Example Street 42 \n 12345 Example City \n Germany new')
|
||||
expect(venue.website).to eq('www.example.com new')
|
||||
expect(venue.description).to eq('Lorem ipsum dolor sit amet, consetetur sadipscing elitr, sed diam' \
|
||||
'nonumy eirmod tempor invidunt ut labore et dolore magna aliquyam erat,' \
|
||||
'sed diam voluptua. new')
|
||||
end
|
||||
end
|
||||
|
||||
describe 'admin' do
|
||||
it_behaves_like 'add and update conference', :admin
|
||||
it_behaves_like 'venue', :admin
|
||||
end
|
||||
|
||||
describe 'organizer' do
|
||||
it_behaves_like 'add and update conference', :organizer
|
||||
it_behaves_like 'venue', :organizer
|
||||
end
|
||||
|
||||
end
|
||||
|
|
|
|||
51
spec/features/proposal_spec.rb
Normal file
51
spec/features/proposal_spec.rb
Normal file
|
|
@ -0,0 +1,51 @@
|
|||
require 'spec_helper'
|
||||
|
||||
feature Event do
|
||||
|
||||
shared_examples 'participant' do |user|
|
||||
scenario 'submitts a new proposal and updates account', feature: true, js: true do
|
||||
expected_count = Event.count + 1
|
||||
conference = create(:conference)
|
||||
conference.call_for_papers = create(:call_for_papers)
|
||||
conference.event_types = [create(:event_type)]
|
||||
|
||||
sign_in create(user)
|
||||
|
||||
visit conference_proposal_index_path(conference.short_title)
|
||||
click_link 'New Proposal'
|
||||
|
||||
fill_in 'event_title', with: 'Example Proposal'
|
||||
fill_in 'event_subtitle', with: 'Example Proposal Subtitle'
|
||||
|
||||
select('Example Event Type', from: 'event[event_type_id]')
|
||||
|
||||
fill_in 'event_abstract', with: 'Lorem ipsum abstract'
|
||||
fill_in 'event_description', with: 'Lorem ipsum description'
|
||||
|
||||
select('YouTube', from: 'event[media_type]')
|
||||
fill_in 'event_media_id', with: '123456'
|
||||
|
||||
fill_in 'person_biography', with: 'Lorem ipsum biography'
|
||||
fill_in 'person_public_name', with: 'Example User'
|
||||
|
||||
click_button 'Submit Session'
|
||||
expect(current_path).to eq(edit_user_registration_path)
|
||||
|
||||
fill_in 'user_person_attributes_first_name', with: 'Example'
|
||||
fill_in 'user_person_attributes_last_name', with: 'User'
|
||||
|
||||
click_button 'Update'
|
||||
|
||||
expect(page.find('#flash_notice').text).
|
||||
to eq('You updated your account successfully.')
|
||||
|
||||
expect(Event.count).to eq(expected_count)
|
||||
end
|
||||
end
|
||||
|
||||
describe 'participant' do
|
||||
it_behaves_like 'participant', :participant
|
||||
it_behaves_like 'participant', :organizer
|
||||
it_behaves_like 'participant', :admin
|
||||
end
|
||||
end
|
||||
Loading…
Add table
Add a link
Reference in a new issue