mirror of
https://github.com/openSUSE/osem.git
synced 2026-08-13 19:54:02 +00:00
Implements feature test for proposal workflog
- submitt proposal - accept proposal - confirm proposal
This commit is contained in:
parent
147310b8b7
commit
656ded9d96
6 changed files with 73 additions and 19 deletions
10
spec/factories/email_settings.rb
Normal file
10
spec/factories/email_settings.rb
Normal file
|
|
@ -0,0 +1,10 @@
|
|||
# Read about factories at https://github.com/thoughtbot/factory_girl
|
||||
|
||||
FactoryGirl.define do
|
||||
factory :email_settings do
|
||||
send_on_registration false
|
||||
send_on_accepted false
|
||||
send_on_rejected false
|
||||
send_on_confirmed_without_registration false
|
||||
end
|
||||
end
|
||||
|
|
@ -2,14 +2,19 @@ require 'spec_helper'
|
|||
|
||||
feature Event do
|
||||
|
||||
shared_examples 'proposal' do |user|
|
||||
scenario 'submitts a new proposal and updates account', feature: true, js: true do
|
||||
shared_examples 'proposal workflow' do
|
||||
scenario 'submitts a new proposal, accepts and confirms', feature: true, js: true do
|
||||
admin = create(:admin, email: 'admin@example.com')
|
||||
participant = create(:participant, email: 'participant@example.com')
|
||||
|
||||
expected_count = Event.count + 1
|
||||
conference = create(:conference)
|
||||
conference.call_for_papers = create(:call_for_papers)
|
||||
conference.email_settings = create(:email_settings)
|
||||
conference.event_types = [create(:event_type)]
|
||||
|
||||
sign_in create(user)
|
||||
#Submit a new proposal as participant
|
||||
sign_in participant
|
||||
|
||||
visit conference_proposal_index_path(conference.short_title)
|
||||
click_link 'New Proposal'
|
||||
|
|
@ -33,6 +38,7 @@ feature Event do
|
|||
|
||||
fill_in 'user_person_attributes_first_name', with: 'Example'
|
||||
fill_in 'user_person_attributes_last_name', with: 'User'
|
||||
fill_in 'user_person_attributes_biography', with: 'Lorem ipsum biography'
|
||||
|
||||
click_button 'Update'
|
||||
|
||||
|
|
@ -40,12 +46,41 @@ feature Event do
|
|||
to eq('You updated your account successfully.')
|
||||
|
||||
expect(Event.count).to eq(expected_count)
|
||||
|
||||
visit conference_proposal_index_path(conference.short_title)
|
||||
expect(page.has_content?('Example Proposal')).to be true
|
||||
|
||||
sign_out
|
||||
|
||||
#Accept proposal as admin
|
||||
sign_in admin
|
||||
|
||||
visit admin_conference_events_path(conference.short_title)
|
||||
expect(page.has_content?('Example Proposal')).to be true
|
||||
|
||||
click_link 'New'
|
||||
click_link 'accept_event'
|
||||
|
||||
expect(page.has_content?('Unconfirmed')).to be true
|
||||
sign_out
|
||||
|
||||
#Confirm proposal as participant
|
||||
sign_in participant
|
||||
visit conference_proposal_index_path(conference.short_title)
|
||||
expect(page.has_content?('Example Proposal')).to be true
|
||||
expect(page.has_content?('Accepted (confirmation pending)')).to be true
|
||||
click_link 'confirm_proposal'
|
||||
expect(page.find('#flash_notice').text).
|
||||
to eq('Event was confirmed. Please register to attend the conference.')
|
||||
|
||||
find('#register').click
|
||||
|
||||
expect(page.find('#flash_notice').text).
|
||||
to eq('You are now registered.')
|
||||
end
|
||||
end
|
||||
|
||||
describe 'proposal workflow' do
|
||||
it_behaves_like 'proposal', :participant
|
||||
it_behaves_like 'proposal', :organizer
|
||||
it_behaves_like 'proposal', :admin
|
||||
describe 'proposal' do
|
||||
it_behaves_like 'proposal workflow'
|
||||
end
|
||||
end
|
||||
|
|
|
|||
|
|
@ -8,4 +8,10 @@ module LoginMacros
|
|||
|
||||
expect(page.has_content?('Signed in successfully')).to be true
|
||||
end
|
||||
|
||||
def sign_out
|
||||
Capybara.current_session.driver.browser.clear_cookies
|
||||
visit root_path
|
||||
expect(page.has_content?('Sign In')).to be true
|
||||
end
|
||||
end
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue