mirror of
https://github.com/openSUSE/osem.git
synced 2026-08-13 19:54:02 +00:00
Rubocop autocorrections
This commit is contained in:
parent
299738f58d
commit
43bef689fc
85 changed files with 622 additions and 578 deletions
|
|
@ -24,7 +24,7 @@ describe Admin::ConferencesController do
|
|||
|
||||
it 'changes conference attributes' do
|
||||
patch :update, id: conference.short_title, conference:
|
||||
attributes_for(:conference, title: 'Example Con',
|
||||
attributes_for(:conference, title: 'Example Con',
|
||||
short_title: 'ExCon')
|
||||
conference.reload
|
||||
expect(conference.title).to eq('Example Con')
|
||||
|
|
@ -52,7 +52,7 @@ describe Admin::ConferencesController do
|
|||
context 'invalid attributes' do
|
||||
it 'does not change conference attributes' do
|
||||
patch :update, id: conference.short_title, conference:
|
||||
attributes_for(:conference, title: 'Example Con',
|
||||
attributes_for(:conference, title: 'Example Con',
|
||||
short_title: nil)
|
||||
|
||||
conference.reload
|
||||
|
|
@ -64,7 +64,7 @@ describe Admin::ConferencesController do
|
|||
|
||||
it 're-renders the #show template' do
|
||||
patch :update, id: conference.short_title, conference:
|
||||
attributes_for(:conference, title: 'Example Con',
|
||||
attributes_for(:conference, title: 'Example Con',
|
||||
short_title: nil)
|
||||
|
||||
expect(flash[:error])
|
||||
|
|
@ -181,9 +181,9 @@ describe Admin::ConferencesController do
|
|||
conference
|
||||
date = Date.new(2014, 05, 26)
|
||||
create(:cfp,
|
||||
program: conference.program,
|
||||
program: conference.program,
|
||||
start_date: date,
|
||||
end_date: date + 14)
|
||||
end_date: date + 14)
|
||||
get :index
|
||||
expect(assigns(:cfp_weeks)).to match_array([1, 2, 3])
|
||||
end
|
||||
|
|
@ -214,14 +214,14 @@ describe Admin::ConferencesController do
|
|||
it 'saves the conference to the database' do
|
||||
expected = expect do
|
||||
post :create, conference:
|
||||
attributes_for(:conference, short_title: 'dps15', organization_id: organization.id)
|
||||
attributes_for(:conference, short_title: 'dps15', organization_id: organization.id)
|
||||
end
|
||||
expected.to change { Conference.count }.by 1
|
||||
end
|
||||
|
||||
it 'redirects to conference#show' do
|
||||
post :create, conference:
|
||||
attributes_for(:conference, short_title: 'dps15', organization_id: organization.id)
|
||||
attributes_for(:conference, short_title: 'dps15', organization_id: organization.id)
|
||||
|
||||
expect(response).to redirect_to admin_conference_path(
|
||||
assigns[:conference].short_title)
|
||||
|
|
@ -233,7 +233,7 @@ describe Admin::ConferencesController do
|
|||
volunteers_coordinator_role = Role.find_by(name: 'volunteers_coordinator', resource: conference)
|
||||
|
||||
post :create, conference:
|
||||
attributes_for(:conference, short_title: 'dps15')
|
||||
attributes_for(:conference, short_title: 'dps15')
|
||||
|
||||
expect(conference.roles.count).to eq 4
|
||||
|
||||
|
|
@ -245,14 +245,14 @@ describe Admin::ConferencesController do
|
|||
it 'does not save the conference to the database' do
|
||||
expected = expect do
|
||||
post :create, conference:
|
||||
attributes_for(:conference, short_title: nil, organization_id: organization.id)
|
||||
attributes_for(:conference, short_title: nil, organization_id: organization.id)
|
||||
end
|
||||
expected.to_not change { Conference.count }
|
||||
end
|
||||
|
||||
it 're-renders the new template' do
|
||||
post :create, conference:
|
||||
attributes_for(:conference, short_title: nil, organization_id: organization.id)
|
||||
attributes_for(:conference, short_title: nil, organization_id: organization.id)
|
||||
expect(response).to be_success
|
||||
end
|
||||
end
|
||||
|
|
@ -262,7 +262,7 @@ describe Admin::ConferencesController do
|
|||
conference
|
||||
expected = expect do
|
||||
post :create, conference:
|
||||
attributes_for(:conference, short_title: conference.short_title, organization_id: organization.id)
|
||||
attributes_for(:conference, short_title: conference.short_title, organization_id: organization.id)
|
||||
end
|
||||
expected.to_not change { Conference.count }
|
||||
end
|
||||
|
|
@ -352,7 +352,7 @@ describe Admin::ConferencesController do
|
|||
|
||||
describe 'PATCH #update' do
|
||||
it 'requires organizer privileges' do
|
||||
patch :update, id: conference.short_title,
|
||||
patch :update, id: conference.short_title,
|
||||
conference: attributes_for(:conference,
|
||||
short_title: 'ExCon')
|
||||
expect(response).to redirect_to(send(path))
|
||||
|
|
|
|||
|
|
@ -23,9 +23,9 @@ describe Admin::EventSchedulesController do
|
|||
post :create, conference_id: conference.short_title, event_schedule:
|
||||
attributes_for(:event_schedule,
|
||||
schedule_id: schedule.id,
|
||||
event_id: create(:event, program: conference.program).id,
|
||||
room_id: create(:room, venue: venue).id,
|
||||
start_time: conference.start_date + conference.start_hour.hours)
|
||||
event_id: create(:event, program: conference.program).id,
|
||||
room_id: create(:room, venue: venue).id,
|
||||
start_time: conference.start_date + conference.start_hour.hours)
|
||||
end
|
||||
|
||||
it 'saves the event schedule to the database' do
|
||||
|
|
@ -44,9 +44,9 @@ describe Admin::EventSchedulesController do
|
|||
post :create, conference_id: conference.short_title, event_schedule:
|
||||
attributes_for(:event_schedule,
|
||||
schedule_id: schedule.id,
|
||||
event_id: nil,
|
||||
room_id: nil,
|
||||
start_time: nil)
|
||||
event_id: nil,
|
||||
room_id: nil,
|
||||
start_time: nil)
|
||||
end
|
||||
|
||||
it 'does not save the event schedule to the database' do
|
||||
|
|
@ -66,9 +66,9 @@ describe Admin::EventSchedulesController do
|
|||
patch :update, id: event_schedule.id, conference_id: conference.short_title, event_schedule:
|
||||
attributes_for(:event_schedule,
|
||||
schedule_id: schedule.id,
|
||||
event_id: create(:event, program: conference.program).id,
|
||||
room_id: room.id,
|
||||
start_time: conference.start_date + conference.start_hour.hours)
|
||||
event_id: create(:event, program: conference.program).id,
|
||||
room_id: room.id,
|
||||
start_time: conference.start_date + conference.start_hour.hours)
|
||||
event_schedule.reload
|
||||
end
|
||||
|
||||
|
|
@ -90,9 +90,9 @@ describe Admin::EventSchedulesController do
|
|||
patch :update, id: event_schedule.id, conference_id: conference.short_title, event_schedule:
|
||||
attributes_for(:event_schedule,
|
||||
schedule_id: schedule.id,
|
||||
event_id: nil,
|
||||
room_id: nil,
|
||||
start_time: nil)
|
||||
event_id: nil,
|
||||
room_id: nil,
|
||||
start_time: nil)
|
||||
end
|
||||
it 'does not save the event schedule to the database' do
|
||||
expect{ update_action }.to_not change { event_schedule }
|
||||
|
|
|
|||
|
|
@ -174,7 +174,7 @@ describe Admin::OrganizationsController do
|
|||
let(:org_admin_role) { Role.find_by(name: 'organization_admin', resource: organization) }
|
||||
|
||||
before do
|
||||
post :assign_org_admins, id: organization.id,
|
||||
post :assign_org_admins, id: organization.id,
|
||||
user: { email: user.email }
|
||||
end
|
||||
|
||||
|
|
@ -188,7 +188,7 @@ describe Admin::OrganizationsController do
|
|||
let!(:org_admin_user) { create(:user, role_ids: [org_admin_role.id]) }
|
||||
|
||||
before do
|
||||
delete :unassign_org_admins, id: organization.id,
|
||||
delete :unassign_org_admins, id: organization.id,
|
||||
user: { email: org_admin_user.email }
|
||||
end
|
||||
|
||||
|
|
|
|||
|
|
@ -50,12 +50,12 @@ describe Admin::RegistrationPeriodsController do
|
|||
conference.email_settings = create(:email_settings)
|
||||
conference.registration_period = create(:registration_period,
|
||||
start_date: Date.today,
|
||||
end_date: Date.today + 2.days)
|
||||
end_date: Date.today + 2.days)
|
||||
|
||||
patch :update, conference_id: conference.short_title, registration_period:
|
||||
attributes_for(:registration_period,
|
||||
start_date: Date.today + 2.days,
|
||||
end_date: Date.today + 4.days)
|
||||
end_date: Date.today + 4.days)
|
||||
conference.reload
|
||||
allow(Mailbot).to receive(:conference_registration_date_update_mail).and_return(mailer)
|
||||
end
|
||||
|
|
@ -67,7 +67,7 @@ describe Admin::RegistrationPeriodsController do
|
|||
it 'saves the registration period to the database' do
|
||||
expected = expect do
|
||||
post :create,
|
||||
conference_id: conference.short_title,
|
||||
conference_id: conference.short_title,
|
||||
registration_period: attributes_for(:registration_period)
|
||||
end
|
||||
expected.to change { RegistrationPeriod.count }.by 1
|
||||
|
|
@ -75,7 +75,7 @@ describe Admin::RegistrationPeriodsController do
|
|||
|
||||
it 'redirects to registration_periods#show' do
|
||||
post :create,
|
||||
conference_id: conference.short_title,
|
||||
conference_id: conference.short_title,
|
||||
registration_period: attributes_for(:registration_period)
|
||||
|
||||
expect(response).to redirect_to admin_conference_registration_period_path(
|
||||
|
|
@ -87,20 +87,20 @@ describe Admin::RegistrationPeriodsController do
|
|||
it 'does not save the registration period to the database' do
|
||||
expected = expect do
|
||||
post :create,
|
||||
conference_id: conference.short_title,
|
||||
conference_id: conference.short_title,
|
||||
registration_period: attributes_for(:registration_period,
|
||||
start_date: nil,
|
||||
end_date: nil)
|
||||
end_date: nil)
|
||||
end
|
||||
expected.to_not change { Conference.count }
|
||||
end
|
||||
|
||||
it 're-renders the new template' do
|
||||
post :create,
|
||||
conference_id: conference.short_title,
|
||||
conference_id: conference.short_title,
|
||||
registration_period: attributes_for(:registration_period,
|
||||
start_date: nil,
|
||||
end_date: nil)
|
||||
end_date: nil)
|
||||
expect(response).to be_success
|
||||
end
|
||||
end
|
||||
|
|
|
|||
|
|
@ -30,7 +30,7 @@ describe Admin::RolesController do
|
|||
before :each do
|
||||
sign_in(admin)
|
||||
xhr :get, :show, conference_id: conference.short_title,
|
||||
id: 'organizer'
|
||||
id: 'organizer'
|
||||
end
|
||||
|
||||
it 'assigns correct value to selection variable' do
|
||||
|
|
@ -46,8 +46,8 @@ describe Admin::RolesController do
|
|||
before :each do
|
||||
sign_in admin
|
||||
patch :update, conference_id: conference.short_title,
|
||||
id: 'cfp',
|
||||
role: { description: 'New description for cfp role!' }
|
||||
id: 'cfp',
|
||||
role: { description: 'New description for cfp role!' }
|
||||
end
|
||||
|
||||
it 'changes the description of the role' do
|
||||
|
|
@ -59,8 +59,8 @@ describe Admin::RolesController do
|
|||
before :each do
|
||||
sign_in admin
|
||||
post :toggle_user, conference_id: conference.short_title,
|
||||
user: { email: 'user1@osem.io' },
|
||||
id: 'cfp'
|
||||
user: { email: 'user1@osem.io' },
|
||||
id: 'cfp'
|
||||
end
|
||||
|
||||
context 'assigns correct values to variables' do
|
||||
|
|
@ -80,16 +80,16 @@ describe Admin::RolesController do
|
|||
context 'adds role to user' do
|
||||
it 'adds second user' do
|
||||
post :toggle_user, conference_id: conference.short_title,
|
||||
user: { email: 'user2@osem.io' },
|
||||
id: 'cfp'
|
||||
user: { email: 'user2@osem.io' },
|
||||
id: 'cfp'
|
||||
|
||||
expect(user2.roles).to eq [cfp_role]
|
||||
end
|
||||
|
||||
it 'assigns second role to user' do
|
||||
post :toggle_user, conference_id: conference.short_title,
|
||||
user: { email: 'user1@osem.io' },
|
||||
id: 'organizer'
|
||||
user: { email: 'user1@osem.io' },
|
||||
id: 'organizer'
|
||||
|
||||
expect(user1.roles).to eq [organizer_role, cfp_role]
|
||||
end
|
||||
|
|
@ -98,22 +98,22 @@ describe Admin::RolesController do
|
|||
context 'removes role from user' do
|
||||
it 'removes role from user' do
|
||||
post :toggle_user, conference_id: conference.short_title,
|
||||
user: { email: 'user1@osem.io', state: 'false' },
|
||||
id: 'cfp'
|
||||
user: { email: 'user1@osem.io', state: 'false' },
|
||||
id: 'cfp'
|
||||
|
||||
expect(user1.roles).to eq []
|
||||
end
|
||||
|
||||
it 'removes second role from user' do
|
||||
post :toggle_user, conference_id: conference.short_title,
|
||||
user: { email: 'user1@osem.io' },
|
||||
id: 'organizer'
|
||||
user: { email: 'user1@osem.io' },
|
||||
id: 'organizer'
|
||||
|
||||
expect(user1.roles).to eq [organizer_role, cfp_role]
|
||||
|
||||
post :toggle_user, conference_id: conference.short_title,
|
||||
user: { email: 'user1@osem.io', state: 'false' },
|
||||
id: 'cfp'
|
||||
user: { email: 'user1@osem.io', state: 'false' },
|
||||
id: 'cfp'
|
||||
|
||||
user1.reload
|
||||
expect(user1.roles).to eq [organizer_role]
|
||||
|
|
@ -123,14 +123,14 @@ describe Admin::RolesController do
|
|||
it 'does not remove role if user is the last organizer' do
|
||||
# Add role organizer
|
||||
post :toggle_user, conference_id: conference.short_title,
|
||||
user: { email: 'user1@osem.io', state: 'true' },
|
||||
id: 'organizer'
|
||||
user: { email: 'user1@osem.io', state: 'true' },
|
||||
id: 'organizer'
|
||||
expect(organizer_role.users).to eq [user1]
|
||||
|
||||
# Try to remove role organizer, when there is only 1 user as organizer
|
||||
post :toggle_user, conference_id: conference.short_title,
|
||||
user: { email: 'user1@osem.io', state: 'false' },
|
||||
id: 'organizer'
|
||||
user: { email: 'user1@osem.io', state: 'false' },
|
||||
id: 'organizer'
|
||||
expect(organizer_role.users).to eq [user1]
|
||||
end
|
||||
end
|
||||
|
|
|
|||
|
|
@ -91,9 +91,9 @@ describe Admin::RoomsController do
|
|||
describe 'PATCH #update' do
|
||||
context 'updates successfully' do
|
||||
before do
|
||||
patch :update, room: attributes_for(:room, size: 2),
|
||||
patch :update, room: attributes_for(:room, size: 2),
|
||||
conference_id: conference.short_title,
|
||||
id: room.id
|
||||
id: room.id
|
||||
end
|
||||
|
||||
it 'redirects to admin room index path' do
|
||||
|
|
@ -113,9 +113,9 @@ describe Admin::RoomsController do
|
|||
context 'update fails' do
|
||||
before do
|
||||
allow_any_instance_of(Room).to receive(:save).and_return(false)
|
||||
patch :update, room: attributes_for(:room, size: 2),
|
||||
patch :update, room: attributes_for(:room, size: 2),
|
||||
conference_id: conference.short_title,
|
||||
id: room.id
|
||||
id: room.id
|
||||
end
|
||||
|
||||
it 'renders edit template' do
|
||||
|
|
|
|||
|
|
@ -51,7 +51,7 @@ describe Admin::SponsorshipLevelsController do
|
|||
context 'saves successfuly' do
|
||||
before(:each, run: true) do
|
||||
post :create, sponsorship_level: attributes_for(:sponsorship_level),
|
||||
conference_id: conference.short_title
|
||||
conference_id: conference.short_title
|
||||
end
|
||||
|
||||
it 'redirects to admin sponsorship_level index path', run: true do
|
||||
|
|
@ -65,7 +65,7 @@ describe Admin::SponsorshipLevelsController do
|
|||
it 'creates new sponsorship_level' do
|
||||
expect do
|
||||
post :create, sponsorship_level: attributes_for(:sponsorship_level),
|
||||
conference_id: conference.short_title
|
||||
conference_id: conference.short_title
|
||||
end.to change{ conference.sponsorship_levels.count }.from(0).to(1)
|
||||
end
|
||||
end
|
||||
|
|
@ -74,7 +74,7 @@ describe Admin::SponsorshipLevelsController do
|
|||
before do
|
||||
allow_any_instance_of(SponsorshipLevel).to receive(:save).and_return(false)
|
||||
post :create, sponsorship_level: attributes_for(:sponsorship_level),
|
||||
conference_id: conference.short_title
|
||||
conference_id: conference.short_title
|
||||
end
|
||||
|
||||
it 'renders new template' do
|
||||
|
|
@ -95,8 +95,8 @@ describe Admin::SponsorshipLevelsController do
|
|||
context 'updates successfully' do
|
||||
before do
|
||||
patch :update, sponsorship_level: attributes_for(:sponsorship_level, title: 'Gold'),
|
||||
conference_id: conference.short_title,
|
||||
id: sponsorship_level.id
|
||||
conference_id: conference.short_title,
|
||||
id: sponsorship_level.id
|
||||
end
|
||||
|
||||
it 'redirects to admin sponsorship_level index path' do
|
||||
|
|
@ -117,8 +117,8 @@ describe Admin::SponsorshipLevelsController do
|
|||
before do
|
||||
allow_any_instance_of(SponsorshipLevel).to receive(:save).and_return(false)
|
||||
patch :update, sponsorship_level: attributes_for(:sponsorship_level, title: 'Gold'),
|
||||
conference_id: conference.short_title,
|
||||
id: sponsorship_level.id
|
||||
conference_id: conference.short_title,
|
||||
id: sponsorship_level.id
|
||||
end
|
||||
|
||||
it 'renders edit template' do
|
||||
|
|
|
|||
|
|
@ -134,9 +134,9 @@ describe Admin::TracksController do
|
|||
describe 'PATCH #update' do
|
||||
context 'updates successfully' do
|
||||
before :each do
|
||||
patch :update, track: attributes_for(:track, color: '#FF0000'),
|
||||
patch :update, track: attributes_for(:track, color: '#FF0000'),
|
||||
conference_id: conference.short_title,
|
||||
id: track.short_name
|
||||
id: track.short_name
|
||||
end
|
||||
|
||||
it 'assigns the correct track' do
|
||||
|
|
@ -160,9 +160,9 @@ describe Admin::TracksController do
|
|||
context 'update fails' do
|
||||
before :each do
|
||||
allow_any_instance_of(Track).to receive(:save).and_return(false)
|
||||
patch :update, track: attributes_for(:track, color: '#FF0000'),
|
||||
patch :update, track: attributes_for(:track, color: '#FF0000'),
|
||||
conference_id: conference.short_title,
|
||||
id: track.short_name
|
||||
id: track.short_name
|
||||
end
|
||||
|
||||
it 'assigns the correct track' do
|
||||
|
|
|
|||
|
|
@ -248,8 +248,8 @@ describe ConferenceRegistrationsController, type: :controller do
|
|||
before do
|
||||
@ticket = create(:ticket, conference: conference)
|
||||
@purchased_ticket = create(:ticket_purchase, conference: conference,
|
||||
user: user,
|
||||
ticket: @ticket)
|
||||
user: user,
|
||||
ticket: @ticket)
|
||||
get :show, conference_id: conference.short_title
|
||||
end
|
||||
|
||||
|
|
@ -290,13 +290,13 @@ describe ConferenceRegistrationsController, type: :controller do
|
|||
before do
|
||||
@registration = create(:registration,
|
||||
conference: conference,
|
||||
user: user,
|
||||
arrival: Date.new(2014, 04, 25))
|
||||
user: user,
|
||||
arrival: Date.new(2014, 04, 25))
|
||||
end
|
||||
|
||||
context 'updates successfully' do
|
||||
before do
|
||||
patch :update, registration: attributes_for(:registration, arrival: Date.new(2014, 04, 29)),
|
||||
patch :update, registration: attributes_for(:registration, arrival: Date.new(2014, 04, 29)),
|
||||
conference_id: conference.short_title
|
||||
end
|
||||
|
||||
|
|
@ -317,7 +317,7 @@ describe ConferenceRegistrationsController, type: :controller do
|
|||
context 'update fails' do
|
||||
before do
|
||||
allow_any_instance_of(Registration).to receive(:update_attributes).and_return(false)
|
||||
patch :update, registration: attributes_for(:registration, arrival: Date.new(2014, 04, 27)),
|
||||
patch :update, registration: attributes_for(:registration, arrival: Date.new(2014, 04, 27)),
|
||||
conference_id: conference.short_title
|
||||
end
|
||||
|
||||
|
|
|
|||
|
|
@ -31,9 +31,9 @@ describe ProposalsController do
|
|||
before { create(:cfp, program: conference.program) }
|
||||
|
||||
it 'assigns url variables' do
|
||||
post :create, event: attributes_for(:event, event_type_id: event_type.id),
|
||||
post :create, event: attributes_for(:event, event_type_id: event_type.id),
|
||||
conference_id: conference.short_title,
|
||||
user: attributes_for(:user)
|
||||
user: attributes_for(:user)
|
||||
expect(assigns(:url)).to eq '/conferences/lama101/program/proposals'
|
||||
end
|
||||
|
||||
|
|
@ -41,9 +41,9 @@ describe ProposalsController do
|
|||
describe 'user related actions' do
|
||||
before do
|
||||
@new_user = attributes_for(:user)
|
||||
post :create, event: attributes_for(:event, event_type_id: event_type.id),
|
||||
post :create, event: attributes_for(:event, event_type_id: event_type.id),
|
||||
conference_id: conference.short_title,
|
||||
user: @new_user
|
||||
user: @new_user
|
||||
end
|
||||
|
||||
it 'creates new user' do
|
||||
|
|
@ -58,9 +58,9 @@ describe ProposalsController do
|
|||
context 'creates proposal successfully' do
|
||||
before(:each, run: true) do
|
||||
@new_user = attributes_for(:user)
|
||||
post :create, event: attributes_for(:event, event_type_id: event_type.id),
|
||||
post :create, event: attributes_for(:event, event_type_id: event_type.id),
|
||||
conference_id: conference.short_title,
|
||||
user: @new_user
|
||||
user: @new_user
|
||||
end
|
||||
|
||||
it 'assigns event variable', run: true do
|
||||
|
|
@ -86,9 +86,9 @@ describe ProposalsController do
|
|||
|
||||
it 'creates new event' do
|
||||
expect do
|
||||
post :create, event: attributes_for(:event, event_type_id: event_type.id),
|
||||
post :create, event: attributes_for(:event, event_type_id: event_type.id),
|
||||
conference_id: conference.short_title,
|
||||
user: attributes_for(:user)
|
||||
user: attributes_for(:user)
|
||||
end.to change{ Event.count }.by 1
|
||||
end
|
||||
end
|
||||
|
|
@ -96,9 +96,9 @@ describe ProposalsController do
|
|||
context 'proposal save fails' do
|
||||
before(:each, run: true) do
|
||||
allow_any_instance_of(Event).to receive(:save).and_return(false)
|
||||
post :create, event: attributes_for(:event, event_type_id: event_type.id),
|
||||
post :create, event: attributes_for(:event, event_type_id: event_type.id),
|
||||
conference_id: conference.short_title,
|
||||
user: attributes_for(:user)
|
||||
user: attributes_for(:user)
|
||||
end
|
||||
|
||||
it 'renders new template', run: true do
|
||||
|
|
@ -112,9 +112,9 @@ describe ProposalsController do
|
|||
it 'does not create new proposal' do
|
||||
allow_any_instance_of(Event).to receive(:save).and_return(false)
|
||||
expect do
|
||||
post :create, event: attributes_for(:event, event_type_id: event_type.id),
|
||||
post :create, event: attributes_for(:event, event_type_id: event_type.id),
|
||||
conference_id: conference.short_title,
|
||||
user: attributes_for(:user)
|
||||
user: attributes_for(:user)
|
||||
end.not_to change{ Event.count }
|
||||
end
|
||||
end
|
||||
|
|
@ -125,25 +125,25 @@ describe ProposalsController do
|
|||
|
||||
it 'does not create new user' do
|
||||
expect do
|
||||
post :create, event: attributes_for(:event, event_type_id: event_type.id),
|
||||
post :create, event: attributes_for(:event, event_type_id: event_type.id),
|
||||
conference_id: conference.short_title,
|
||||
user: attributes_for(:user)
|
||||
user: attributes_for(:user)
|
||||
end.not_to change { User.count }
|
||||
end
|
||||
|
||||
it 'does not create new event' do
|
||||
expect do
|
||||
post :create, event: attributes_for(:event, event_type_id: event_type.id),
|
||||
post :create, event: attributes_for(:event, event_type_id: event_type.id),
|
||||
conference_id: conference.short_title,
|
||||
user: attributes_for(:user)
|
||||
user: attributes_for(:user)
|
||||
end.not_to change { Event.count }
|
||||
end
|
||||
|
||||
describe 'response' do
|
||||
before do
|
||||
post :create, event: attributes_for(:event, event_type_id: event_type.id),
|
||||
post :create, event: attributes_for(:event, event_type_id: event_type.id),
|
||||
conference_id: conference.short_title,
|
||||
user: attributes_for(:user)
|
||||
user: attributes_for(:user)
|
||||
end
|
||||
|
||||
it 'renders new template' do
|
||||
|
|
@ -228,14 +228,14 @@ describe ProposalsController do
|
|||
before { create(:cfp, program: conference.program) }
|
||||
|
||||
it 'assigns url variables' do
|
||||
post :create, event: attributes_for(:event, event_type_id: event_type.id),
|
||||
post :create, event: attributes_for(:event, event_type_id: event_type.id),
|
||||
conference_id: conference.short_title
|
||||
expect(assigns(:url)).to eq '/conferences/lama101/program/proposals'
|
||||
end
|
||||
|
||||
context 'creates proposal successfully' do
|
||||
before(:each, run: true) do
|
||||
post :create, event: attributes_for(:event, event_type_id: event_type.id),
|
||||
post :create, event: attributes_for(:event, event_type_id: event_type.id),
|
||||
conference_id: conference.short_title
|
||||
end
|
||||
|
||||
|
|
@ -262,7 +262,7 @@ describe ProposalsController do
|
|||
|
||||
it 'creates new event' do
|
||||
expect do
|
||||
post :create, event: attributes_for(:event, event_type_id: event_type.id),
|
||||
post :create, event: attributes_for(:event, event_type_id: event_type.id),
|
||||
conference_id: conference.short_title
|
||||
end.to change{ Event.count }.by 1
|
||||
end
|
||||
|
|
@ -271,7 +271,7 @@ describe ProposalsController do
|
|||
context 'proposal save fails' do
|
||||
before(:each, run: true) do
|
||||
allow_any_instance_of(Event).to receive(:save).and_return(false)
|
||||
post :create, event: attributes_for(:event, event_type_id: event_type.id),
|
||||
post :create, event: attributes_for(:event, event_type_id: event_type.id),
|
||||
conference_id: conference.short_title
|
||||
end
|
||||
|
||||
|
|
@ -286,7 +286,7 @@ describe ProposalsController do
|
|||
it 'does not create new proposal' do
|
||||
allow_any_instance_of(Event).to receive(:save).and_return(false)
|
||||
expect do
|
||||
post :create, event: attributes_for(:event, event_type_id: event_type.id),
|
||||
post :create, event: attributes_for(:event, event_type_id: event_type.id),
|
||||
conference_id: conference.short_title
|
||||
end.not_to change{ Event.count }
|
||||
end
|
||||
|
|
@ -296,17 +296,17 @@ describe ProposalsController do
|
|||
describe 'PATCH #update' do
|
||||
|
||||
it 'assigns url variable' do
|
||||
patch :update, event: attributes_for(:event, title: 'some title', event_type_id: event_type.id),
|
||||
patch :update, event: attributes_for(:event, title: 'some title', event_type_id: event_type.id),
|
||||
conference_id: conference.short_title,
|
||||
id: event.id
|
||||
id: event.id
|
||||
expect(assigns(:url)).to eq "/conferences/lama101/program/proposals/#{event.id}"
|
||||
end
|
||||
|
||||
context 'updates successfully' do
|
||||
before do
|
||||
patch :update, event: attributes_for(:event, title: 'some title', event_type_id: event_type.id),
|
||||
patch :update, event: attributes_for(:event, title: 'some title', event_type_id: event_type.id),
|
||||
conference_id: conference.short_title,
|
||||
id: event.id
|
||||
id: event.id
|
||||
end
|
||||
|
||||
it 'updates the proposal' do
|
||||
|
|
@ -326,9 +326,9 @@ describe ProposalsController do
|
|||
context 'update fails' do
|
||||
before do
|
||||
allow_any_instance_of(Event).to receive(:save).and_return(false)
|
||||
patch :update, event: attributes_for(:event, title: 'some title', event_type_id: event_type.id),
|
||||
patch :update, event: attributes_for(:event, title: 'some title', event_type_id: event_type.id),
|
||||
conference_id: conference.short_title,
|
||||
id: event.id
|
||||
id: event.id
|
||||
end
|
||||
|
||||
it 'does not update the proposal' do
|
||||
|
|
|
|||
|
|
@ -128,9 +128,9 @@ describe TracksController do
|
|||
describe 'PATCH #update' do
|
||||
context 'updates successfully' do
|
||||
before :each do
|
||||
patch :update, track: attributes_for(:track, :self_organized, color: '#FF0000'),
|
||||
patch :update, track: attributes_for(:track, :self_organized, color: '#FF0000'),
|
||||
conference_id: conference.short_title,
|
||||
id: self_organized_track.short_name
|
||||
id: self_organized_track.short_name
|
||||
end
|
||||
|
||||
it 'assigns the correct track' do
|
||||
|
|
@ -154,9 +154,9 @@ describe TracksController do
|
|||
context 'update fails' do
|
||||
before :each do
|
||||
allow_any_instance_of(Track).to receive(:save).and_return(false)
|
||||
patch :update, track: attributes_for(:track, :self_organized, color: '#FF0000'),
|
||||
patch :update, track: attributes_for(:track, :self_organized, color: '#FF0000'),
|
||||
conference_id: conference.short_title,
|
||||
id: self_organized_track.short_name
|
||||
id: self_organized_track.short_name
|
||||
end
|
||||
|
||||
it 'assigns the correct track' do
|
||||
|
|
|
|||
|
|
@ -16,15 +16,15 @@ end
|
|||
def stub_env_for_omniauth
|
||||
request.env['devise.mapping'] = Devise.mappings[:user]
|
||||
env = OmniAuth::AuthHash.new(
|
||||
provider: 'google',
|
||||
uid: 'google-test-uid-1',
|
||||
info: {
|
||||
name: 'google user',
|
||||
email: nil,
|
||||
provider: 'google',
|
||||
uid: 'google-test-uid-1',
|
||||
info: {
|
||||
name: 'google user',
|
||||
email: nil,
|
||||
username: 'user_google'
|
||||
},
|
||||
credentials: {
|
||||
token: 'google_mock_token',
|
||||
token: 'google_mock_token',
|
||||
secret: 'google_mock_secret'
|
||||
}
|
||||
)
|
||||
|
|
|
|||
|
|
@ -66,11 +66,11 @@ describe UserDatatable do
|
|||
'search' => { 'value' => '', 'regex' => 'false' }
|
||||
}
|
||||
},
|
||||
'order' => { '0' => { 'column' => '0', 'dir' => 'asc' } },
|
||||
'start' => '0',
|
||||
'length' => '10',
|
||||
'search' => { 'value' => '', 'regex' => 'false' },
|
||||
'_' => '1532637360488'
|
||||
'order' => { '0' => { 'column' => '0', 'dir' => 'asc' } },
|
||||
'start' => '0',
|
||||
'length' => '10',
|
||||
'search' => { 'value' => '', 'regex' => 'false' },
|
||||
'_' => '1532637360488'
|
||||
}.with_indifferent_access
|
||||
)
|
||||
allow(view).to receive(:admin_user_path) do |arg|
|
||||
|
|
|
|||
|
|
@ -4,9 +4,11 @@
|
|||
|
||||
FactoryBot.define do
|
||||
factory :splashpage do
|
||||
|
||||
public { false }
|
||||
|
||||
factory :full_splashpage do
|
||||
|
||||
public { true }
|
||||
|
||||
include_tracks { true }
|
||||
|
|
|
|||
|
|
@ -46,8 +46,8 @@ feature Commercial do
|
|||
|
||||
before(:each) do
|
||||
event.event_users = [create(:event_user,
|
||||
user_id: participant.id,
|
||||
event_id: event.id,
|
||||
user_id: participant.id,
|
||||
event_id: event.id,
|
||||
event_role: 'submitter')]
|
||||
sign_in participant
|
||||
end
|
||||
|
|
@ -85,7 +85,7 @@ feature Commercial do
|
|||
|
||||
scenario 'updates a commercial of an event', feature: true, versioning: true, js: true do
|
||||
commercial = create(:commercial,
|
||||
commercialable_id: event.id,
|
||||
commercialable_id: event.id,
|
||||
commercialable_type: 'Event')
|
||||
visit edit_conference_program_proposal_path(conference.short_title, event.id)
|
||||
click_link 'Commercials'
|
||||
|
|
@ -99,9 +99,9 @@ feature Commercial do
|
|||
|
||||
scenario 'does not update a commercial of an event with invalid data', feature: true, versioning: true, js: true do
|
||||
commercial = create(:commercial,
|
||||
commercialable_id: event.id,
|
||||
commercialable_id: event.id,
|
||||
commercialable_type: 'Event',
|
||||
url: 'https://www.youtube.com/watch?v=BTTygyxuGj8')
|
||||
url: 'https://www.youtube.com/watch?v=BTTygyxuGj8')
|
||||
visit edit_conference_program_proposal_path(conference.short_title, event.id)
|
||||
click_link 'Commercials'
|
||||
fill_in "commercial_url_#{commercial.id}", with: 'invalid_commercial_url'
|
||||
|
|
@ -114,7 +114,7 @@ feature Commercial do
|
|||
|
||||
scenario 'deletes a commercial of an event', feature: true, versioning: true, js: true do
|
||||
create(:commercial,
|
||||
commercialable_id: event.id,
|
||||
commercialable_id: event.id,
|
||||
commercialable_type: 'Event')
|
||||
visit edit_conference_program_proposal_path(conference.short_title, event.id)
|
||||
click_link 'Commercials'
|
||||
|
|
|
|||
|
|
@ -41,7 +41,7 @@ describe Mailbot do
|
|||
before do
|
||||
conference.email_settings.update_attributes(send_on_accepted: true,
|
||||
accepted_subject: 'Lorem Ipsum Dolsum',
|
||||
accepted_body: 'Lorem ipsum dolor sit amet, consectetuer adipiscing elit')
|
||||
accepted_body: 'Lorem ipsum dolor sit amet, consectetuer adipiscing elit')
|
||||
end
|
||||
|
||||
include_examples 'mailer actions' do
|
||||
|
|
@ -53,7 +53,7 @@ describe Mailbot do
|
|||
before do
|
||||
conference.email_settings.update_attributes(send_on_rejected: true,
|
||||
rejected_subject: 'Lorem Ipsum Dolsum',
|
||||
rejected_body: 'Lorem ipsum dolor sit amet, consectetuer adipiscing elit')
|
||||
rejected_body: 'Lorem ipsum dolor sit amet, consectetuer adipiscing elit')
|
||||
end
|
||||
|
||||
include_examples 'mailer actions' do
|
||||
|
|
@ -65,7 +65,7 @@ describe Mailbot do
|
|||
before do
|
||||
conference.email_settings.update_attributes(send_on_confirmed_without_registration: true,
|
||||
confirmed_without_registration_subject: 'Lorem Ipsum Dolsum',
|
||||
confirmed_without_registration_body: 'Lorem ipsum dolor sit amet, consectetuer adipiscing elit')
|
||||
confirmed_without_registration_body: 'Lorem ipsum dolor sit amet, consectetuer adipiscing elit')
|
||||
end
|
||||
|
||||
include_examples 'mailer actions' do
|
||||
|
|
|
|||
|
|
@ -38,13 +38,13 @@ describe Booth do
|
|||
states = [:new, :withdrawn, :to_accept, :accepted, :to_reject, :rejected, :canceled, :confirmed]
|
||||
transitions = [:restart, :withdraw, :accept, :reject, :to_accept, :to_reject, :cancel]
|
||||
|
||||
states_transitions = { new: { restart: false, withdraw: true, accept: true, to_accept: true, to_reject: true, reject: true, cancel: false, confirm: false },
|
||||
states_transitions = { new: { restart: false, withdraw: true, accept: true, to_accept: true, to_reject: true, reject: true, cancel: false, confirm: false },
|
||||
withdrawn: { restart: true, withdraw: false, accept: false, to_accept: false, to_reject: false, reject: false, cancel: false, confirm: false },
|
||||
to_accept: { restart: false, withdraw: true, accept: true, to_accept: false, to_reject: true, reject: false, cancel: true, confirm: false },
|
||||
to_reject: { restart: false, withdraw: true, accept: false, to_accept: true, to_reject: false, reject: true, cancel: true, confirm: false },
|
||||
accepted: { restart: false, withdraw: true, accept: false, to_accept: false, to_reject: false, reject: false, cancel: true, confirm: true },
|
||||
rejected: { restart: true, withdraw: true, accept: false, to_accept: false, to_reject: false, reject: false, cancel: true, confirm: false },
|
||||
canceled: { restart: true, withdraw: false, accept: false, to_accept: false, to_reject: false, reject: false, cancel: false, confirm: false },
|
||||
accepted: { restart: false, withdraw: true, accept: false, to_accept: false, to_reject: false, reject: false, cancel: true, confirm: true },
|
||||
rejected: { restart: true, withdraw: true, accept: false, to_accept: false, to_reject: false, reject: false, cancel: true, confirm: false },
|
||||
canceled: { restart: true, withdraw: false, accept: false, to_accept: false, to_reject: false, reject: false, cancel: false, confirm: false },
|
||||
confirmed: { restart: false, withdraw: true, accept: false, to_accept: false, to_reject: false, reject: false, cancel: true, confirm: false } }
|
||||
|
||||
states.each do |state|
|
||||
|
|
|
|||
|
|
@ -12,21 +12,21 @@ describe Conference do
|
|||
it 'updates pending conferences' do
|
||||
create(:conference,
|
||||
start_date: Date.today - 2.weeks,
|
||||
end_date: Date.today - 1.weeks)
|
||||
end_date: Date.today - 1.weeks)
|
||||
|
||||
subject.start_date = Date.today + 1.weeks
|
||||
subject.end_date = Date.today + 2.weeks
|
||||
|
||||
result = {
|
||||
DateTime.now.end_of_week =>
|
||||
{
|
||||
confirmed: 0,
|
||||
unconfirmed: 0,
|
||||
new: 0,
|
||||
withdrawn: 0,
|
||||
canceled: 0,
|
||||
rejected: 0
|
||||
},
|
||||
{
|
||||
confirmed: 0,
|
||||
unconfirmed: 0,
|
||||
new: 0,
|
||||
withdrawn: 0,
|
||||
canceled: 0,
|
||||
rejected: 0
|
||||
},
|
||||
}
|
||||
|
||||
Conference.write_event_distribution_to_db
|
||||
|
|
@ -37,7 +37,7 @@ describe Conference do
|
|||
it 'does not update past conferences' do
|
||||
old_conference = create(:conference,
|
||||
start_date: Date.today - 2.weeks,
|
||||
end_date: Date.today - 1.weeks)
|
||||
end_date: Date.today - 1.weeks)
|
||||
|
||||
Conference.write_event_distribution_to_db
|
||||
old_conference.reload
|
||||
|
|
@ -76,14 +76,14 @@ describe Conference do
|
|||
|
||||
result = {
|
||||
DateTime.now.end_of_week =>
|
||||
{
|
||||
confirmed: 1,
|
||||
unconfirmed: 1,
|
||||
new: 1,
|
||||
withdrawn: 1,
|
||||
canceled: 1,
|
||||
rejected: 1
|
||||
},
|
||||
{
|
||||
confirmed: 1,
|
||||
unconfirmed: 1,
|
||||
new: 1,
|
||||
withdrawn: 1,
|
||||
canceled: 1,
|
||||
rejected: 1
|
||||
},
|
||||
}
|
||||
|
||||
subject.reload
|
||||
|
|
@ -96,23 +96,23 @@ describe Conference do
|
|||
subject.end_date = Date.today + 7.weeks
|
||||
db_data = {
|
||||
DateTime.now.end_of_week - 2.weeks =>
|
||||
{
|
||||
confirmed: 1,
|
||||
unconfirmed: 2,
|
||||
new: 0,
|
||||
withdrawn: 0,
|
||||
canceled: 0,
|
||||
rejected: 0
|
||||
},
|
||||
{
|
||||
confirmed: 1,
|
||||
unconfirmed: 2,
|
||||
new: 0,
|
||||
withdrawn: 0,
|
||||
canceled: 0,
|
||||
rejected: 0
|
||||
},
|
||||
DateTime.now.end_of_week - 1.weeks =>
|
||||
{
|
||||
confirmed: 3,
|
||||
unconfirmed: 4,
|
||||
new: 0,
|
||||
withdrawn: 0,
|
||||
canceled: 0,
|
||||
rejected: 0
|
||||
},
|
||||
{
|
||||
confirmed: 3,
|
||||
unconfirmed: 4,
|
||||
new: 0,
|
||||
withdrawn: 0,
|
||||
canceled: 0,
|
||||
rejected: 0
|
||||
},
|
||||
}
|
||||
subject.events_per_week = db_data
|
||||
subject.save
|
||||
|
|
@ -131,32 +131,32 @@ describe Conference do
|
|||
|
||||
result = {
|
||||
DateTime.now.end_of_week - 2.weeks =>
|
||||
{
|
||||
confirmed: 1,
|
||||
unconfirmed: 2,
|
||||
new: 0,
|
||||
withdrawn: 0,
|
||||
canceled: 0,
|
||||
rejected: 0
|
||||
},
|
||||
{
|
||||
confirmed: 1,
|
||||
unconfirmed: 2,
|
||||
new: 0,
|
||||
withdrawn: 0,
|
||||
canceled: 0,
|
||||
rejected: 0
|
||||
},
|
||||
DateTime.now.end_of_week - 1.weeks =>
|
||||
{
|
||||
confirmed: 3,
|
||||
unconfirmed: 4,
|
||||
new: 0,
|
||||
withdrawn: 0,
|
||||
canceled: 0,
|
||||
rejected: 0
|
||||
},
|
||||
DateTime.now.end_of_week =>
|
||||
{
|
||||
confirmed: 1,
|
||||
unconfirmed: 1,
|
||||
new: 1,
|
||||
withdrawn: 0,
|
||||
canceled: 0,
|
||||
rejected: 0
|
||||
},
|
||||
{
|
||||
confirmed: 3,
|
||||
unconfirmed: 4,
|
||||
new: 0,
|
||||
withdrawn: 0,
|
||||
canceled: 0,
|
||||
rejected: 0
|
||||
},
|
||||
DateTime.now.end_of_week =>
|
||||
{
|
||||
confirmed: 1,
|
||||
unconfirmed: 1,
|
||||
new: 1,
|
||||
withdrawn: 0,
|
||||
canceled: 0,
|
||||
rejected: 0
|
||||
},
|
||||
}
|
||||
|
||||
subject.reload
|
||||
|
|
@ -176,11 +176,11 @@ describe Conference do
|
|||
# Inject last two weeks to database
|
||||
db_data = {
|
||||
Date.today.end_of_week - 2.weeks => {
|
||||
confirmed: 1,
|
||||
confirmed: 1,
|
||||
unconfirmed: 2,
|
||||
},
|
||||
Date.today.end_of_week - 1.weeks => {
|
||||
confirmed: 3,
|
||||
confirmed: 3,
|
||||
unconfirmed: 4,
|
||||
}
|
||||
}
|
||||
|
|
@ -192,10 +192,10 @@ describe Conference do
|
|||
create(:event, program: subject.program, created_at: Date.today - 2.weeks)
|
||||
|
||||
result = {
|
||||
'Submitted' => [1, 1, 1],
|
||||
'Confirmed' => [1, 3, 0],
|
||||
'Submitted' => [1, 1, 1],
|
||||
'Confirmed' => [1, 3, 0],
|
||||
'Unconfirmed' => [2, 4, 0],
|
||||
'Weeks' => [1, 2, 3, 4, 5, 6, 7, 8, 9, 10]
|
||||
'Weeks' => [1, 2, 3, 4, 5, 6, 7, 8, 9, 10]
|
||||
}
|
||||
expect(subject.get_submissions_data).to eq(result)
|
||||
end
|
||||
|
|
@ -208,10 +208,10 @@ describe Conference do
|
|||
create(:event, program: subject.program)
|
||||
|
||||
result = {
|
||||
'Submitted' => [1],
|
||||
'Confirmed' => [0],
|
||||
'Submitted' => [1],
|
||||
'Confirmed' => [0],
|
||||
'Unconfirmed' => [0],
|
||||
'Weeks' => [1, 2, 3, 4, 5, 6, 7, 8]
|
||||
'Weeks' => [1, 2, 3, 4, 5, 6, 7, 8]
|
||||
}
|
||||
expect(subject.get_submissions_data).to eq(result)
|
||||
end
|
||||
|
|
@ -233,10 +233,10 @@ describe Conference do
|
|||
confirmed.confirm!
|
||||
|
||||
result = {
|
||||
'Submitted' => [0, 0, 3],
|
||||
'Confirmed' => [0, 0, 1],
|
||||
'Submitted' => [0, 0, 3],
|
||||
'Confirmed' => [0, 0, 1],
|
||||
'Unconfirmed' => [0, 0, 1],
|
||||
'Weeks' => [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11]
|
||||
'Weeks' => [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11]
|
||||
}
|
||||
expect(subject.get_submissions_data).to eq(result)
|
||||
end
|
||||
|
|
@ -248,11 +248,11 @@ describe Conference do
|
|||
# Inject last two weeks to database
|
||||
db_data = {
|
||||
Date.today.end_of_week - 3.weeks => {
|
||||
confirmed: 1,
|
||||
confirmed: 1,
|
||||
unconfirmed: 2,
|
||||
},
|
||||
Date.today.end_of_week - 1.weeks => {
|
||||
confirmed: 3,
|
||||
confirmed: 3,
|
||||
unconfirmed: 4,
|
||||
}
|
||||
}
|
||||
|
|
@ -264,10 +264,10 @@ describe Conference do
|
|||
create(:event, program: subject.program, created_at: Date.today - 3.weeks)
|
||||
|
||||
result = {
|
||||
'Submitted' => [1, 1, 1, 1],
|
||||
'Confirmed' => [1, 0, 3, 0],
|
||||
'Submitted' => [1, 1, 1, 1],
|
||||
'Confirmed' => [1, 0, 3, 0],
|
||||
'Unconfirmed' => [2, 0, 4, 0],
|
||||
'Weeks' => [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11]
|
||||
'Weeks' => [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11]
|
||||
}
|
||||
expect(subject.get_submissions_data).to eq(result)
|
||||
end
|
||||
|
|
@ -1083,7 +1083,7 @@ describe Conference do
|
|||
it 'calculates new year' do
|
||||
subject.registration_period = create(:registration_period,
|
||||
start_date: Date.new(2013, 12, 31),
|
||||
end_date: Date.new(2013, 12, 30) + 6)
|
||||
end_date: Date.new(2013, 12, 30) + 6)
|
||||
expect(subject.registration_weeks).to eq(1)
|
||||
end
|
||||
|
||||
|
|
|
|||
|
|
@ -8,18 +8,18 @@ describe EmailSettings do
|
|||
let(:event) { create(:event, program: conference.program, title: 'Talk about talks', submitter: user) }
|
||||
let(:expected_hash) do
|
||||
{
|
||||
'email' => 'john@doe.com',
|
||||
'name' => 'John Doe',
|
||||
'conference' => conference.title,
|
||||
'conference_start_date' => Date.new(2014, 05, 01),
|
||||
'conference_end_date' => Date.new(2014, 05, 06),
|
||||
'registrationlink' => 'http://localhost:3000/conferences/goto/register',
|
||||
'email' => 'john@doe.com',
|
||||
'name' => 'John Doe',
|
||||
'conference' => conference.title,
|
||||
'conference_start_date' => Date.new(2014, 05, 01),
|
||||
'conference_end_date' => Date.new(2014, 05, 06),
|
||||
'registrationlink' => 'http://localhost:3000/conferences/goto/register',
|
||||
'conference_splash_link' => 'http://localhost:3000/conferences/goto',
|
||||
'schedule_link' => 'http://localhost:3000/conferences/goto/schedule',
|
||||
'cfp_end_date' => 'Unknown',
|
||||
'cfp_start_date' => 'Unknown',
|
||||
'venue' => 'Unknown',
|
||||
'venue_address' => 'Unknown'
|
||||
'schedule_link' => 'http://localhost:3000/conferences/goto/schedule',
|
||||
'cfp_end_date' => 'Unknown',
|
||||
'cfp_start_date' => 'Unknown',
|
||||
'venue' => 'Unknown',
|
||||
'venue_address' => 'Unknown'
|
||||
}
|
||||
end
|
||||
|
||||
|
|
@ -50,8 +50,8 @@ describe EmailSettings do
|
|||
before do
|
||||
create(:cfp,
|
||||
start_date: Date.new(2014, 04, 29),
|
||||
end_date: Date.new(2014, 05, 06),
|
||||
program: conference.program)
|
||||
end_date: Date.new(2014, 05, 06),
|
||||
program: conference.program)
|
||||
cfp_dates_hash = { 'cfp_start_date' => Date.new(2014, 04, 29), 'cfp_end_date' => Date.new(2014, 05, 06) }
|
||||
expected_hash.merge!(cfp_dates_hash)
|
||||
end
|
||||
|
|
@ -77,7 +77,7 @@ describe EmailSettings do
|
|||
before do
|
||||
conference.update_attributes(registration_period: create(:registration_period,
|
||||
start_date: Date.new(2014, 05, 03),
|
||||
end_date: Date.new(2014, 05, 05)))
|
||||
end_date: Date.new(2014, 05, 05)))
|
||||
registration_period_hash = { 'registration_start_date' => Date.new(2014, 05, 03), 'registration_end_date' => Date.new(2014, 05, 05) }
|
||||
expected_hash.merge!(registration_period_hash)
|
||||
end
|
||||
|
|
|
|||
|
|
@ -320,12 +320,12 @@ describe Event do
|
|||
states = [:new, :withdrawn, :unconfirmed, :confirmed, :canceled, :rejected]
|
||||
transitions = [:restart, :withdraw, :accept, :confirm, :cancel, :reject]
|
||||
|
||||
states_transitions = { new: { restart: false, withdraw: true, accept: true, confirm: false, cancel: false, reject: true},
|
||||
withdrawn: { restart: true, withdraw: false, accept: false, confirm: false, cancel: false, reject: false},
|
||||
states_transitions = { new: { restart: false, withdraw: true, accept: true, confirm: false, cancel: false, reject: true},
|
||||
withdrawn: { restart: true, withdraw: false, accept: false, confirm: false, cancel: false, reject: false},
|
||||
unconfirmed: { restart: false, withdraw: true, accept: false, confirm: true, cancel: true, reject: false},
|
||||
confirmed: { restart: false, withdraw: true, accept: false, confirm: false, cancel: true, reject: false},
|
||||
canceled: { restart: true, withdraw: false, accept: false, confirm: false, cancel: false, reject: false},
|
||||
rejected: { restart: true, withdraw: false, accept: false, confirm: false, cancel: false, reject: false}
|
||||
confirmed: { restart: false, withdraw: true, accept: false, confirm: false, cancel: true, reject: false},
|
||||
canceled: { restart: true, withdraw: false, accept: false, confirm: false, cancel: false, reject: false},
|
||||
rejected: { restart: true, withdraw: false, accept: false, confirm: false, cancel: false, reject: false}
|
||||
}
|
||||
|
||||
states.each do |state|
|
||||
|
|
|
|||
|
|
@ -65,8 +65,8 @@ describe TicketPurchase do
|
|||
tickets = { free_ticket.id.to_s => '10' }
|
||||
message = TicketPurchase.purchase(conference, participant, tickets)
|
||||
purchase = TicketPurchase.where(conference_id: conference.id,
|
||||
user_id: participant.id,
|
||||
ticket_id: free_ticket.id).first
|
||||
user_id: participant.id,
|
||||
ticket_id: free_ticket.id).first
|
||||
|
||||
expect(TicketPurchase.count).to eq(1)
|
||||
expect(purchase.quantity).to eq(10)
|
||||
|
|
@ -77,8 +77,8 @@ describe TicketPurchase do
|
|||
tickets = { ticket_1.id.to_s => '1' }
|
||||
message = TicketPurchase.purchase(conference, participant, tickets)
|
||||
purchase = TicketPurchase.where(conference_id: conference.id,
|
||||
user_id: participant.id,
|
||||
ticket_id: ticket_1.id).first
|
||||
user_id: participant.id,
|
||||
ticket_id: ticket_1.id).first
|
||||
|
||||
expect(TicketPurchase.count).to eq(1)
|
||||
expect(purchase.quantity).to eq(1)
|
||||
|
|
@ -89,12 +89,12 @@ describe TicketPurchase do
|
|||
tickets = { ticket_1.id.to_s => '1', ticket_2.id.to_s => '1' }
|
||||
message = TicketPurchase.purchase(conference, participant, tickets)
|
||||
purchase_1 = TicketPurchase.where(conference_id: conference.id,
|
||||
user_id: participant.id,
|
||||
ticket_id: ticket_1.id).first
|
||||
user_id: participant.id,
|
||||
ticket_id: ticket_1.id).first
|
||||
|
||||
purchase_2 = TicketPurchase.where(conference_id: conference.id,
|
||||
user_id: participant.id,
|
||||
ticket_id: ticket_2.id).first
|
||||
user_id: participant.id,
|
||||
ticket_id: ticket_2.id).first
|
||||
|
||||
expect(TicketPurchase.count).to eq(2)
|
||||
expect(purchase_1.quantity).to eq(1)
|
||||
|
|
@ -119,9 +119,9 @@ describe TicketPurchase do
|
|||
it 'updates the quantity if the user already bought this ticket' do
|
||||
purchase = create(:ticket_purchase,
|
||||
conference: conference,
|
||||
user: participant,
|
||||
ticket: ticket_1,
|
||||
quantity: 5)
|
||||
user: participant,
|
||||
ticket: ticket_1,
|
||||
quantity: 5)
|
||||
|
||||
tickets = { ticket_1.id.to_s => '10' }
|
||||
message = TicketPurchase.purchase(conference, participant, tickets)
|
||||
|
|
|
|||
|
|
@ -39,7 +39,7 @@ describe Ticket do
|
|||
|
||||
it 'is not valid if tickets of conference do not have same currency' do
|
||||
conflicting_currency_ticket = build(:ticket,
|
||||
conference: ticket.conference,
|
||||
conference: ticket.conference,
|
||||
price_currency: 'INR')
|
||||
expected_error_message = 'Price currency is different from the existing tickets of this conference.'
|
||||
|
||||
|
|
@ -57,7 +57,7 @@ describe Ticket do
|
|||
describe '#bought?' do
|
||||
it 'returns true if the user has bought this ticket' do
|
||||
create(:ticket_purchase,
|
||||
user: user,
|
||||
user: user,
|
||||
ticket: ticket)
|
||||
expect(ticket.bought?(user)).to eq(true)
|
||||
end
|
||||
|
|
@ -112,8 +112,8 @@ describe Ticket do
|
|||
context 'user has not paid' do
|
||||
it 'returns the correct value if the user has bought this ticket' do
|
||||
create(:ticket_purchase,
|
||||
user: user,
|
||||
ticket: ticket,
|
||||
user: user,
|
||||
ticket: ticket,
|
||||
quantity: 20)
|
||||
expect(ticket.quantity_bought_by(user, paid: false)).to eq(20)
|
||||
end
|
||||
|
|
@ -137,8 +137,8 @@ describe Ticket do
|
|||
context 'user has not paid' do
|
||||
it 'returns the correct value if the user has bought this ticket' do
|
||||
create(:ticket_purchase,
|
||||
user: user,
|
||||
ticket: ticket,
|
||||
user: user,
|
||||
ticket: ticket,
|
||||
quantity: 20)
|
||||
expect(ticket.total_price(user, paid: false)).to eq(Money.new(100000, 'USD'))
|
||||
end
|
||||
|
|
|
|||
|
|
@ -326,13 +326,13 @@ describe Track do
|
|||
states = [:new, :to_accept, :accepted, :confirmed, :to_reject, :rejected, :canceled, :withdrawn]
|
||||
transitions = [:restart, :to_accept, :accept, :confirm, :to_reject, :reject, :cancel, :withdraw]
|
||||
|
||||
states_transitions = { new: { restart: false, to_accept: true, accept: true, confirm: false, to_reject: true, reject: true, cancel: false, withdraw: true },
|
||||
states_transitions = { new: { restart: false, to_accept: true, accept: true, confirm: false, to_reject: true, reject: true, cancel: false, withdraw: true },
|
||||
to_accept: { restart: false, to_accept: false, accept: true, confirm: false, to_reject: true, reject: false, cancel: true, withdraw: true },
|
||||
accepted: { restart: false, to_accept: false, accept: false, confirm: true, to_reject: false, reject: false, cancel: true, withdraw: true },
|
||||
accepted: { restart: false, to_accept: false, accept: false, confirm: true, to_reject: false, reject: false, cancel: true, withdraw: true },
|
||||
confirmed: { restart: false, to_accept: false, accept: false, confirm: false, to_reject: false, reject: false, cancel: true, withdraw: true },
|
||||
to_reject: { restart: false, to_accept: true, accept: false, confirm: false, to_reject: false, reject: true, cancel: true, withdraw: true },
|
||||
rejected: { restart: true, to_accept: false, accept: false, confirm: false, to_reject: false, reject: false, cancel: false, withdraw: false },
|
||||
canceled: { restart: true, to_accept: false, accept: false, confirm: false, to_reject: false, reject: false, cancel: false, withdraw: false },
|
||||
rejected: { restart: true, to_accept: false, accept: false, confirm: false, to_reject: false, reject: false, cancel: false, withdraw: false },
|
||||
canceled: { restart: true, to_accept: false, accept: false, confirm: false, to_reject: false, reject: false, cancel: false, withdraw: false },
|
||||
withdrawn: { restart: true, to_accept: false, accept: false, confirm: false, to_reject: false, reject: false, cancel: false, withdraw: false } }
|
||||
|
||||
states.each do |state|
|
||||
|
|
|
|||
|
|
@ -234,15 +234,15 @@ describe User do
|
|||
|
||||
describe '.find_for_auth' do
|
||||
let(:auth) do
|
||||
OmniAuth::AuthHash.new(provider: 'google',
|
||||
uid: 'google-test-uid-1',
|
||||
info: {
|
||||
name: 'new user name',
|
||||
email: 'test-1@gmail.com',
|
||||
OmniAuth::AuthHash.new(provider: 'google',
|
||||
uid: 'google-test-uid-1',
|
||||
info: {
|
||||
name: 'new user name',
|
||||
email: 'test-1@gmail.com',
|
||||
username: 'newuser'
|
||||
},
|
||||
credentials: {
|
||||
token: 'mock_token',
|
||||
token: 'mock_token',
|
||||
secret: 'mock_secret'
|
||||
}
|
||||
)
|
||||
|
|
@ -285,7 +285,7 @@ describe User do
|
|||
it 'returns hash of role and conference' do
|
||||
expected_hash = {
|
||||
'organizer' => %w[oSC16 oSC15],
|
||||
'cfp' => ['oSC16']
|
||||
'cfp' => ['oSC16']
|
||||
}
|
||||
|
||||
expect(user.get_roles).to eq expected_hash
|
||||
|
|
|
|||
|
|
@ -6,8 +6,8 @@ describe ConferenceSerializer, type: :serializer do
|
|||
let(:conference) do
|
||||
create(:conference, short_title: 'goto',
|
||||
description: 'Lorem ipsum dolor sit',
|
||||
start_date: Date.new(2014, 03, 04),
|
||||
end_date: Date.new(2014, 03, 10))
|
||||
start_date: Date.new(2014, 03, 04),
|
||||
end_date: Date.new(2014, 03, 10))
|
||||
end
|
||||
|
||||
let(:serializer) { ConferenceSerializer.new(conference) }
|
||||
|
|
|
|||
|
|
@ -9,16 +9,16 @@ describe EventSerializer, type: :serializer do
|
|||
it 'sets guid, title, length, abstract and type' do
|
||||
expected_json = {
|
||||
event: {
|
||||
guid: event.guid,
|
||||
title: 'Some Talk',
|
||||
length: 30,
|
||||
guid: event.guid,
|
||||
title: 'Some Talk',
|
||||
length: 30,
|
||||
scheduled_date: '',
|
||||
language: nil,
|
||||
abstract: 'Lorem ipsum dolor sit amet',
|
||||
speaker_ids: event.speaker_ids,
|
||||
type: 'Example Event Type',
|
||||
room: nil,
|
||||
track: nil
|
||||
language: nil,
|
||||
abstract: 'Lorem ipsum dolor sit amet',
|
||||
speaker_ids: event.speaker_ids,
|
||||
type: 'Example Event Type',
|
||||
room: nil,
|
||||
track: nil
|
||||
}
|
||||
}.to_json
|
||||
|
||||
|
|
@ -41,16 +41,16 @@ describe EventSerializer, type: :serializer do
|
|||
it 'sets guid, title, length, abstract, type, date, language, speakers, room and track' do
|
||||
expected_json = {
|
||||
event: {
|
||||
guid: event.guid,
|
||||
title: 'Some Talk',
|
||||
length: 30,
|
||||
guid: event.guid,
|
||||
title: 'Some Talk',
|
||||
length: 30,
|
||||
scheduled_date: ' 2014-03-04T09:00:00+0000 ',
|
||||
language: 'English',
|
||||
abstract: 'Lorem ipsum dolor sit amet',
|
||||
speaker_ids: [speaker.id],
|
||||
type: 'Example Event Type',
|
||||
room: room.guid,
|
||||
track: track.guid
|
||||
language: 'English',
|
||||
abstract: 'Lorem ipsum dolor sit amet',
|
||||
speaker_ids: [speaker.id],
|
||||
type: 'Example Event Type',
|
||||
room: room.guid,
|
||||
track: track.guid
|
||||
}
|
||||
}.to_json
|
||||
|
||||
|
|
|
|||
|
|
@ -8,8 +8,8 @@ describe RoomSerializer, type: :serializer do
|
|||
it 'set guid, name and description' do
|
||||
expected_json = {
|
||||
room: {
|
||||
guid: room.guid,
|
||||
name: room.name,
|
||||
guid: room.guid,
|
||||
name: room.name,
|
||||
description: ''
|
||||
}
|
||||
}.to_json
|
||||
|
|
|
|||
|
|
@ -9,9 +9,9 @@ describe SpeakerSerializer, type: :serializer do
|
|||
it 'sets name and affiliation' do
|
||||
expected_json = {
|
||||
speaker: {
|
||||
name: 'John Doe',
|
||||
name: 'John Doe',
|
||||
affiliation: 'JohnDoesInc',
|
||||
biography: nil
|
||||
biography: nil
|
||||
}
|
||||
}.to_json
|
||||
|
||||
|
|
@ -25,9 +25,9 @@ describe SpeakerSerializer, type: :serializer do
|
|||
it 'sets name, affiliation and biography' do
|
||||
expected_json = {
|
||||
speaker: {
|
||||
name: 'John Doe',
|
||||
name: 'John Doe',
|
||||
affiliation: 'JohnDoesInc',
|
||||
biography: 'Doest of all Jon Does'
|
||||
biography: 'Doest of all Jon Does'
|
||||
}
|
||||
}.to_json
|
||||
|
||||
|
|
|
|||
|
|
@ -9,8 +9,8 @@ describe TrackSerializer, type: :serializer do
|
|||
it 'sets guild, name, color' do
|
||||
expected_json = {
|
||||
track: {
|
||||
guid: track.guid,
|
||||
name: track.name,
|
||||
guid: track.guid,
|
||||
name: track.name,
|
||||
color: track.color
|
||||
}
|
||||
}.to_json
|
||||
|
|
|
|||
|
|
@ -12,19 +12,19 @@ end
|
|||
|
||||
def mock_commercial_request
|
||||
response = {
|
||||
author_name: 'Confreaks',
|
||||
html: '<iframe width="560" height="315" frameborder="0" allowfullscreen></iframe>',
|
||||
thumbnail_width: 480,
|
||||
thumbnail_url: '/images/rails.png',
|
||||
provider_name: 'YouTube',
|
||||
width: 459,
|
||||
type: 'video',
|
||||
provider_url: 'http://www.youtube.com/',
|
||||
version: '1.0',
|
||||
author_name: 'Confreaks',
|
||||
html: '<iframe width="560" height="315" frameborder="0" allowfullscreen></iframe>',
|
||||
thumbnail_width: 480,
|
||||
thumbnail_url: '/images/rails.png',
|
||||
provider_name: 'YouTube',
|
||||
width: 459,
|
||||
type: 'video',
|
||||
provider_url: 'http://www.youtube.com/',
|
||||
version: '1.0',
|
||||
thumbnail_height: 360,
|
||||
title: 'RailsConf 2014 - Closing Keynote by Aaron Patterson',
|
||||
author_url: 'https://www.youtube.com/user/Confreaks',
|
||||
height: 344
|
||||
title: 'RailsConf 2014 - Closing Keynote by Aaron Patterson',
|
||||
author_url: 'https://www.youtube.com/user/Confreaks',
|
||||
height: 344
|
||||
}
|
||||
WebMock.stub_request(:get, /.*youtube.*/)
|
||||
.to_return(status: 200, body: response.to_json, headers: {})
|
||||
|
|
|
|||
|
|
@ -6,6 +6,7 @@ module Flash
|
|||
if results.empty?
|
||||
return 'none'
|
||||
end
|
||||
|
||||
if results.count > 1
|
||||
texts = results.map { |r| r.text }
|
||||
fail "One flash expected, but we had #{texts.inspect}"
|
||||
|
|
|
|||
|
|
@ -16,14 +16,14 @@ module OmniauthMacros
|
|||
def mock_auth_new_user
|
||||
OmniAuth.config.mock_auth[:google] =
|
||||
OmniAuth::AuthHash.new(
|
||||
provider: 'google',
|
||||
uid: 'google-test-uid-1',
|
||||
info: {
|
||||
name: 'new user name',
|
||||
provider: 'google',
|
||||
uid: 'google-test-uid-1',
|
||||
info: {
|
||||
name: 'new user name',
|
||||
email: 'test-1@example.com'
|
||||
},
|
||||
credentials: {
|
||||
token: 'mock_token',
|
||||
token: 'mock_token',
|
||||
secret: 'mock_secret'
|
||||
}
|
||||
)
|
||||
|
|
@ -32,14 +32,14 @@ module OmniauthMacros
|
|||
def mock_auth_new_user_fb
|
||||
OmniAuth.config.mock_auth[:facebook] =
|
||||
OmniAuth::AuthHash.new(
|
||||
provider: 'facebook',
|
||||
uid: 'facebook-test-uid-1',
|
||||
info: {
|
||||
name: 'new user fb name',
|
||||
provider: 'facebook',
|
||||
uid: 'facebook-test-uid-1',
|
||||
info: {
|
||||
name: 'new user fb name',
|
||||
email: 'test-1@example.com'
|
||||
},
|
||||
credentials: {
|
||||
token: 'mock_token',
|
||||
token: 'mock_token',
|
||||
secret: 'mock_secret'
|
||||
}
|
||||
)
|
||||
|
|
@ -50,14 +50,14 @@ module OmniauthMacros
|
|||
# authentication hashes to return during integration testing.
|
||||
OmniAuth.config.mock_auth[:google] =
|
||||
OmniAuth::AuthHash.new(
|
||||
provider: 'google',
|
||||
uid: 'google-test-uid-participant-1',
|
||||
info: {
|
||||
name: 'existing user participant name',
|
||||
provider: 'google',
|
||||
uid: 'google-test-uid-participant-1',
|
||||
info: {
|
||||
name: 'existing user participant name',
|
||||
email: 'test-participant-1@example.com'
|
||||
},
|
||||
credentials: {
|
||||
token: 'mock_token',
|
||||
token: 'mock_token',
|
||||
secret: 'mock_secret'
|
||||
}
|
||||
)
|
||||
|
|
@ -68,14 +68,14 @@ module OmniauthMacros
|
|||
# authentication hashes to return during integration testing.
|
||||
OmniAuth.config.mock_auth[:google] =
|
||||
OmniAuth::AuthHash.new(
|
||||
provider: 'google',
|
||||
uid: 'google-test-uid-admin-1',
|
||||
info: {
|
||||
name: 'existing user admin name',
|
||||
provider: 'google',
|
||||
uid: 'google-test-uid-admin-1',
|
||||
info: {
|
||||
name: 'existing user admin name',
|
||||
email: 'test-admin-1@example.com'
|
||||
},
|
||||
credentials: {
|
||||
token: 'mock_token',
|
||||
token: 'mock_token',
|
||||
secret: 'mock_secret'
|
||||
}
|
||||
)
|
||||
|
|
@ -89,60 +89,60 @@ module OmniauthMacros
|
|||
def mock_auth_accounts
|
||||
OmniAuth.config.mock_auth[:facebook] =
|
||||
OmniAuth::AuthHash.new(
|
||||
provider: 'facebook',
|
||||
uid: 'facebook-test-uid-1',
|
||||
info: {
|
||||
name: 'facebook user',
|
||||
email: 'user-facebook@example.com',
|
||||
provider: 'facebook',
|
||||
uid: 'facebook-test-uid-1',
|
||||
info: {
|
||||
name: 'facebook user',
|
||||
email: 'user-facebook@example.com',
|
||||
username: 'user_facebook'
|
||||
},
|
||||
credentials: {
|
||||
token: 'fb_mock_token',
|
||||
token: 'fb_mock_token',
|
||||
secret: 'fb_mock_secret'
|
||||
}
|
||||
)
|
||||
|
||||
OmniAuth.config.mock_auth[:google] =
|
||||
OmniAuth::AuthHash.new(
|
||||
provider: 'google',
|
||||
uid: 'google-test-uid-1',
|
||||
info: {
|
||||
name: 'google user',
|
||||
email: 'user-google@example.com',
|
||||
provider: 'google',
|
||||
uid: 'google-test-uid-1',
|
||||
info: {
|
||||
name: 'google user',
|
||||
email: 'user-google@example.com',
|
||||
username: 'user_google'
|
||||
},
|
||||
credentials: {
|
||||
token: 'google_mock_token',
|
||||
token: 'google_mock_token',
|
||||
secret: 'google_mock_secret'
|
||||
}
|
||||
)
|
||||
|
||||
OmniAuth.config.mock_auth[:suse] =
|
||||
OmniAuth::AuthHash.new(
|
||||
provider: 'suse',
|
||||
uid: 'suse-test-uid-1',
|
||||
info: {
|
||||
name: 'suse user',
|
||||
email: 'user-suse@example.com',
|
||||
provider: 'suse',
|
||||
uid: 'suse-test-uid-1',
|
||||
info: {
|
||||
name: 'suse user',
|
||||
email: 'user-suse@example.com',
|
||||
username: 'user_suse'
|
||||
},
|
||||
credentials: {
|
||||
token: 'suse_mock_token',
|
||||
token: 'suse_mock_token',
|
||||
secret: 'suse_mock_secret'
|
||||
}
|
||||
)
|
||||
|
||||
OmniAuth.config.mock_auth[:github] =
|
||||
OmniAuth::AuthHash.new(
|
||||
provider: 'github',
|
||||
uid: 'github-test-uid-1',
|
||||
info: {
|
||||
name: 'github user',
|
||||
email: 'user-github@example.com',
|
||||
provider: 'github',
|
||||
uid: 'github-test-uid-1',
|
||||
info: {
|
||||
name: 'github user',
|
||||
email: 'user-github@example.com',
|
||||
username: 'user_github'
|
||||
},
|
||||
credentials: {
|
||||
token: 'github_mock_token',
|
||||
token: 'github_mock_token',
|
||||
secret: 'github_mock_secret'
|
||||
}
|
||||
)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue