Use keyword arguments in tests
Raisl 5.1 removes support for non-keyword arguments in `#process`, `#get`, `#post`, `#patch`, `#put`, `#delete`, and `#head` for the `ActionDispatch::IntegrationTest` and `ActionController::TestCase` classes. This means we have to add `params` everywhere in the controller tests.
This commit is contained in:
parent
b8013661a2
commit
d1180e2767
35 changed files with 975 additions and 364 deletions
|
|
@ -13,14 +13,14 @@ describe Admin::BoothsController do
|
|||
|
||||
describe 'GET index' do
|
||||
it 'does not render admin/booths#index' do
|
||||
get :index, conference_id: conference.short_title
|
||||
get :index, params: { conference_id: conference.short_title }
|
||||
expect(response).to redirect_to(user_session_path)
|
||||
end
|
||||
end
|
||||
|
||||
describe 'GET show' do
|
||||
it 'does not render admin/booths#show' do
|
||||
get :show, id: booth.id, conference_id: conference.short_title
|
||||
get :show, params: { id: booth.id, conference_id: conference.short_title }
|
||||
expect(response).to redirect_to(user_session_path)
|
||||
end
|
||||
end
|
||||
|
|
@ -32,7 +32,7 @@ describe Admin::BoothsController do
|
|||
end
|
||||
|
||||
describe 'GET index' do
|
||||
before { get :index, conference_id: conference.short_title }
|
||||
before { get :index, params: { conference_id: conference.short_title } }
|
||||
|
||||
it 'assigns attributes for booths' do
|
||||
expect(assigns(:booths)).to eq([booth])
|
||||
|
|
@ -44,7 +44,7 @@ describe Admin::BoothsController do
|
|||
end
|
||||
|
||||
describe 'GET new' do
|
||||
before { get :new, conference_id: conference.short_title }
|
||||
before { get :new, params: { conference_id: conference.short_title } }
|
||||
|
||||
it 'assigns attributes for booths' do
|
||||
expect(assigns(:booth)).to be_a_new(Booth)
|
||||
|
|
@ -57,11 +57,11 @@ describe Admin::BoothsController do
|
|||
|
||||
describe 'POST #create' do
|
||||
context 'successfully created' do
|
||||
before { post :create, booth: attributes_for(:booth), conference_id: conference.short_title }
|
||||
before { post :create, params: { booth: attributes_for(:booth), conference_id: conference.short_title } }
|
||||
|
||||
it 'creates a new booth' do
|
||||
expected = expect do
|
||||
post :create, booth: attributes_for(:booth), conference_id: conference.short_title
|
||||
post :create, params: { booth: attributes_for(:booth), conference_id: conference.short_title }
|
||||
end
|
||||
expected.to change { Booth.count }.by(1)
|
||||
end
|
||||
|
|
@ -80,11 +80,11 @@ describe Admin::BoothsController do
|
|||
end
|
||||
|
||||
context 'create action fails' do
|
||||
before { post :create, booth: attributes_for(:booth, title: ''), conference_id: conference.short_title }
|
||||
before { post :create, params: { booth: attributes_for(:booth, title: ''), conference_id: conference.short_title } }
|
||||
|
||||
it 'does not create any record' do
|
||||
expected = expect do
|
||||
post :create, booth: attributes_for(:booth, title: ''), conference_id: conference.short_title
|
||||
post :create, params: { booth: attributes_for(:booth, title: ''), conference_id: conference.short_title }
|
||||
end
|
||||
expected.to_not change(Booth, :count)
|
||||
end
|
||||
|
|
@ -100,7 +100,7 @@ describe Admin::BoothsController do
|
|||
end
|
||||
|
||||
describe 'GET #edit' do
|
||||
before { get :edit, id: booth.id, conference_id: conference.short_title }
|
||||
before { get :edit, params: { id: booth.id, conference_id: conference.short_title } }
|
||||
|
||||
it 'renders edit template' do
|
||||
expect(response).to render_template('edit')
|
||||
|
|
@ -113,7 +113,7 @@ describe Admin::BoothsController do
|
|||
|
||||
describe 'PATCH #update' do
|
||||
context 'updates suchessfully' do
|
||||
before { patch :update, id: booth.id, booth: attributes_for(:booth, title: 'different'), conference_id: conference.short_title }
|
||||
before { patch :update, params: { id: booth.id, booth: attributes_for(:booth, title: 'different'), conference_id: conference.short_title } }
|
||||
it 'redirects to admin booth index path' do
|
||||
expect(response).to redirect_to admin_conference_booths_path
|
||||
end
|
||||
|
|
|
|||
|
|
@ -14,14 +14,14 @@ describe Admin::CfpsController do
|
|||
|
||||
describe 'POST #create' do
|
||||
it 'successes' do
|
||||
post :create, conference_id: conference.short_title, cfp: { cfp_type: 'events', start_date: today, end_date: today + 6.days, description: 'We call for papers, or tabak, or you know what!' }
|
||||
post :create, params: { conference_id: conference.short_title, cfp: { cfp_type: 'events', start_date: today, end_date: today + 6.days, description: 'We call for papers, or tabak, or you know what!' } }
|
||||
expect(flash[:notice]).to match('Call for papers successfully created.')
|
||||
end
|
||||
end
|
||||
|
||||
describe 'POST #update' do
|
||||
it 'successes' do
|
||||
patch :update, conference_id: conference.short_title, id: cfp.id, cfp: { end_date: today + 10.days }
|
||||
patch :update, params: { conference_id: conference.short_title, id: cfp.id, cfp: { end_date: today + 10.days } }
|
||||
expect(flash[:notice]).to match('Call for papers successfully updated.')
|
||||
end
|
||||
end
|
||||
|
|
|
|||
|
|
@ -18,22 +18,22 @@ describe Admin::ConferencesController do
|
|||
describe 'PATCH #update' do
|
||||
context 'valid attributes' do
|
||||
it 'locates the requested conference' do
|
||||
patch :update, id: conference.short_title, conference: attributes_for(:conference, title: 'Example Con')
|
||||
patch :update, params: { id: conference.short_title, conference: attributes_for(:conference, title: 'Example Con') }
|
||||
expect(assigns(:conference)).to eq(conference)
|
||||
end
|
||||
|
||||
it 'changes conference attributes' do
|
||||
patch :update, id: conference.short_title, conference:
|
||||
patch :update, params: { id: conference.short_title, conference:
|
||||
attributes_for(:conference, title: 'Example Con',
|
||||
short_title: 'ExCon')
|
||||
short_title: 'ExCon') }
|
||||
conference.reload
|
||||
expect(conference.title).to eq('Example Con')
|
||||
expect(conference.short_title).to eq('ExCon')
|
||||
end
|
||||
|
||||
it 'redirects to the updated conference' do
|
||||
patch :update, id: conference.short_title, conference:
|
||||
attributes_for(:conference, title: 'Example Con')
|
||||
patch :update, params: { id: conference.short_title, conference:
|
||||
attributes_for(:conference, title: 'Example Con') }
|
||||
conference.reload
|
||||
expect(response).to redirect_to edit_admin_conference_path(
|
||||
conference.short_title)
|
||||
|
|
@ -43,7 +43,7 @@ describe Admin::ConferencesController do
|
|||
mailer = double
|
||||
allow(mailer).to receive(:deliver)
|
||||
conference.email_settings = create(:email_settings)
|
||||
patch :update, id: conference.short_title, conference: attributes_for(:conference, start_date: Time.zone.today + 2.days, end_date: Time.zone.today + 4.days)
|
||||
patch :update, params: { id: conference.short_title, conference: attributes_for(:conference, start_date: Time.zone.today + 2.days, end_date: Time.zone.today + 4.days) }
|
||||
conference.reload
|
||||
allow(Mailbot).to receive(:conference_date_update_mail).and_return(mailer)
|
||||
end
|
||||
|
|
@ -51,9 +51,9 @@ describe Admin::ConferencesController do
|
|||
|
||||
context 'invalid attributes' do
|
||||
it 'does not change conference attributes' do
|
||||
patch :update, id: conference.short_title, conference:
|
||||
patch :update, params: { id: conference.short_title, conference:
|
||||
attributes_for(:conference, title: 'Example Con',
|
||||
short_title: nil)
|
||||
short_title: nil) }
|
||||
|
||||
conference.reload
|
||||
expect(flash[:error])
|
||||
|
|
@ -63,9 +63,9 @@ describe Admin::ConferencesController do
|
|||
end
|
||||
|
||||
it 're-renders the #show template' do
|
||||
patch :update, id: conference.short_title, conference:
|
||||
patch :update, params: { id: conference.short_title, conference:
|
||||
attributes_for(:conference, title: 'Example Con',
|
||||
short_title: nil)
|
||||
short_title: nil) }
|
||||
|
||||
expect(flash[:error])
|
||||
.to eq("Updating conference failed. Short title can't be blank.")
|
||||
|
|
@ -77,24 +77,24 @@ describe Admin::ConferencesController do
|
|||
|
||||
describe 'GET #edit' do
|
||||
it 'assigns the requested conference to conference' do
|
||||
get :edit, id: conference.short_title
|
||||
get :edit, params: { id: conference.short_title }
|
||||
expect(assigns(:conference)).to eq conference
|
||||
end
|
||||
|
||||
it 'renders the show template' do
|
||||
get :edit, id: conference.short_title
|
||||
get :edit, params: { id: conference.short_title }
|
||||
expect(response).to render_template :edit
|
||||
end
|
||||
end
|
||||
|
||||
describe 'GET #show' do
|
||||
it 'assigns the requested conference to conference' do
|
||||
get :show, id: conference.short_title
|
||||
get :show, params: { id: conference.short_title }
|
||||
expect(assigns(:conference)).to eq conference
|
||||
end
|
||||
|
||||
it 'renders the show template' do
|
||||
get :show, id: conference.short_title
|
||||
get :show, params: { id: conference.short_title }
|
||||
expect(response).to render_template :show
|
||||
end
|
||||
|
||||
|
|
@ -103,11 +103,11 @@ describe Admin::ConferencesController do
|
|||
create(:event, program: conference.program)
|
||||
workshop = create(:event_type, title: 'Workshop', color: '#000000', program: conference.program)
|
||||
lecture = create(:event_type, title: 'Lecture', color: '#ffffff', program: conference.program)
|
||||
get :show, id: conference.short_title
|
||||
get :show, params: { id: conference.short_title }
|
||||
expect(assigns(:event_type_distribution_withdrawn)).to be_empty
|
||||
create(:event, program: conference.program, state: 'withdrawn', event_type: lecture)
|
||||
create(:event, program: conference.program, state: 'withdrawn', event_type: workshop)
|
||||
get :show, id: conference.short_title
|
||||
get :show, params: { id: conference.short_title }
|
||||
expect(assigns(:event_type_distribution_withdrawn)).not_to be_empty
|
||||
result = {}
|
||||
result['Workshop'] = {
|
||||
|
|
@ -124,13 +124,13 @@ describe Admin::ConferencesController do
|
|||
it 'assigns conference withdrawn difficulty level distribution to difficulty_levels_distribution_withdrawn' do
|
||||
conference
|
||||
create(:event, program: conference.program)
|
||||
get :show, id: conference.short_title
|
||||
get :show, params: { id: conference.short_title }
|
||||
expect(assigns(:difficulty_levels_distribution_withdrawn)).to be_empty
|
||||
easy = create(:difficulty_level, title: 'Easy', color: '#000000')
|
||||
hard = create(:difficulty_level, title: 'Hard', color: '#ffffff')
|
||||
create(:event, program: conference.program, state: 'withdrawn', difficulty_level: easy)
|
||||
create(:event, program: conference.program, state: 'withdrawn', difficulty_level: hard)
|
||||
get :show, id: conference.short_title
|
||||
get :show, params: { id: conference.short_title }
|
||||
expect(assigns(:difficulty_levels_distribution_withdrawn)).not_to be_empty
|
||||
result = {}
|
||||
result['Easy'] = {
|
||||
|
|
@ -147,13 +147,13 @@ describe Admin::ConferencesController do
|
|||
it 'assigns conference withdrawn track distribution to tracks_distribution_withdrawn' do
|
||||
conference
|
||||
create(:event, program: conference.program)
|
||||
get :show, id: conference.short_title
|
||||
get :show, params: { id: conference.short_title }
|
||||
expect(assigns(:tracks_distribution_withdrawn)).to be_empty
|
||||
track_one = create(:track, name: 'Track One', color: '#000000', program: conference.program)
|
||||
track_two = create(:track, name: 'Track Two', color: '#FFFFFF', program: conference.program)
|
||||
create(:event, program: conference.program, state: 'withdrawn', track: track_one)
|
||||
create(:event, program: conference.program, state: 'withdrawn', track: track_two)
|
||||
get :show, id: conference.short_title
|
||||
get :show, params: { id: conference.short_title }
|
||||
expect(assigns(:tracks_distribution_withdrawn)).not_to be_empty
|
||||
result = {}
|
||||
result['Track One'] = {
|
||||
|
|
@ -202,15 +202,15 @@ describe Admin::ConferencesController do
|
|||
context 'with valid attributes' 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)
|
||||
post :create, params: { conference:
|
||||
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)
|
||||
post :create, params: { conference:
|
||||
attributes_for(:conference, short_title: 'dps15', organization_id: organization.id) }
|
||||
|
||||
expect(response).to redirect_to admin_conference_path(
|
||||
assigns[:conference].short_title)
|
||||
|
|
@ -221,8 +221,8 @@ describe Admin::ConferencesController do
|
|||
info_desk_role = Role.find_by(name: 'info_desk', resource: conference)
|
||||
volunteers_coordinator_role = Role.find_by(name: 'volunteers_coordinator', resource: conference)
|
||||
|
||||
post :create, conference:
|
||||
attributes_for(:conference, short_title: 'dps15')
|
||||
post :create, params: { conference:
|
||||
attributes_for(:conference, short_title: 'dps15') }
|
||||
|
||||
expect(conference.roles.count).to eq 4
|
||||
|
||||
|
|
@ -233,15 +233,15 @@ describe Admin::ConferencesController do
|
|||
context 'with invalid attributes' 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)
|
||||
post :create, params: { conference:
|
||||
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)
|
||||
post :create, params: { conference:
|
||||
attributes_for(:conference, short_title: nil, organization_id: organization.id) }
|
||||
expect(response).to be_success
|
||||
end
|
||||
end
|
||||
|
|
@ -250,15 +250,15 @@ describe Admin::ConferencesController do
|
|||
it 'does not save the conference to the database' do
|
||||
conference
|
||||
expected = expect do
|
||||
post :create, conference:
|
||||
attributes_for(:conference, short_title: conference.short_title, organization_id: organization.id)
|
||||
post :create, params: { conference:
|
||||
attributes_for(:conference, short_title: conference.short_title, organization_id: organization.id) }
|
||||
end
|
||||
expected.to_not change { Conference.count }
|
||||
end
|
||||
|
||||
it 're-renders the new template' do
|
||||
conference
|
||||
post :create, conference: attributes_for(:conference, short_title: conference.short_title, organization_id: organization.id)
|
||||
post :create, params: { conference: attributes_for(:conference, short_title: conference.short_title, organization_id: organization.id) }
|
||||
expect(response).to be_success
|
||||
end
|
||||
end
|
||||
|
|
@ -299,8 +299,8 @@ describe Admin::ConferencesController do
|
|||
|
||||
describe 'POST #create' do
|
||||
it 'requires organizer privileges' do
|
||||
post :create, conference: attributes_for(:conference,
|
||||
short_title: 'ExCon', organization_id: organization.id)
|
||||
post :create, params: { conference: attributes_for(:conference,
|
||||
short_title: 'ExCon', organization_id: organization.id) }
|
||||
expect(response).to redirect_to(send(path))
|
||||
if message
|
||||
expect(flash[:alert]).to match(/#{message}/)
|
||||
|
|
@ -321,7 +321,7 @@ describe Admin::ConferencesController do
|
|||
shared_examples 'access as participant or guest' do |path, message|
|
||||
describe 'GET #show' do
|
||||
it 'requires organizer privileges' do
|
||||
get :show, id: conference.short_title
|
||||
get :show, params: { id: conference.short_title }
|
||||
expect(response).to redirect_to(send(path))
|
||||
if message
|
||||
expect(flash[:alert]).to match(/#{message}/)
|
||||
|
|
@ -341,9 +341,9 @@ describe Admin::ConferencesController do
|
|||
|
||||
describe 'PATCH #update' do
|
||||
it 'requires organizer privileges' do
|
||||
patch :update, id: conference.short_title,
|
||||
conference: attributes_for(:conference,
|
||||
short_title: 'ExCon')
|
||||
patch :update, params: { id: conference.short_title,
|
||||
conference: attributes_for(:conference,
|
||||
short_title: 'ExCon') }
|
||||
expect(response).to redirect_to(send(path))
|
||||
if message
|
||||
expect(flash[:alert]).to match(/#{message}/)
|
||||
|
|
|
|||
|
|
@ -19,12 +19,12 @@ describe Admin::EventSchedulesController do
|
|||
describe 'POST #create' do
|
||||
context 'with valid attributes' do
|
||||
let(:create_action) do
|
||||
post :create, conference_id: conference.short_title, event_schedule:
|
||||
post :create, params: { 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)
|
||||
start_time: conference.start_date + conference.start_hour.hours) }
|
||||
end
|
||||
|
||||
it 'saves the event schedule to the database' do
|
||||
|
|
@ -40,12 +40,12 @@ describe Admin::EventSchedulesController do
|
|||
context 'with invalid attributes' do
|
||||
|
||||
let(:create_action) do
|
||||
post :create, conference_id: conference.short_title, event_schedule:
|
||||
post :create, params: { conference_id: conference.short_title, event_schedule:
|
||||
attributes_for(:event_schedule,
|
||||
schedule_id: schedule.id,
|
||||
event_id: nil,
|
||||
room_id: nil,
|
||||
start_time: nil)
|
||||
start_time: nil) }
|
||||
end
|
||||
|
||||
it 'does not save the event schedule to the database' do
|
||||
|
|
@ -62,12 +62,12 @@ describe Admin::EventSchedulesController do
|
|||
describe 'POST #update' do
|
||||
context 'with valid attributes' do
|
||||
before :each do
|
||||
patch :update, id: event_schedule.id, conference_id: conference.short_title, event_schedule:
|
||||
patch :update, params: { 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)
|
||||
start_time: conference.start_date + conference.start_hour.hours) }
|
||||
event_schedule.reload
|
||||
end
|
||||
|
||||
|
|
@ -86,12 +86,12 @@ describe Admin::EventSchedulesController do
|
|||
|
||||
context 'with invalid attributes' do
|
||||
let(:update_action) do
|
||||
patch :update, id: event_schedule.id, conference_id: conference.short_title, event_schedule:
|
||||
patch :update, params: { 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)
|
||||
start_time: nil) }
|
||||
end
|
||||
it 'does not save the event schedule to the database' do
|
||||
expect{ update_action }.to_not change { event_schedule }
|
||||
|
|
@ -106,7 +106,7 @@ describe Admin::EventSchedulesController do
|
|||
|
||||
describe 'DELETE #destroy' do
|
||||
let(:destroy_action) do
|
||||
delete :destroy, id: event_schedule.id, conference_id: conference.short_title
|
||||
delete :destroy, params: { id: event_schedule.id, conference_id: conference.short_title }
|
||||
end
|
||||
|
||||
it 'deletes the event schedule' do
|
||||
|
|
|
|||
|
|
@ -17,7 +17,7 @@ describe Admin::EventsController do
|
|||
describe 'GET #show' do
|
||||
before :each do
|
||||
sign_in(organizer)
|
||||
get :show, id: event_without_commercial.id, conference_id: conference.short_title
|
||||
get :show, params: { id: event_without_commercial.id, conference_id: conference.short_title }
|
||||
end
|
||||
|
||||
it 'assigns versions' do
|
||||
|
|
|
|||
|
|
@ -37,13 +37,13 @@ describe Admin::OrganizationsController do
|
|||
describe 'POST #create' do
|
||||
it 'does not create new organization' do
|
||||
expected = expect do
|
||||
post :create, organization: attributes_for(:organization)
|
||||
post :create, params: { organization: attributes_for(:organization) }
|
||||
end
|
||||
expected.to_not change(Organization, :count)
|
||||
end
|
||||
|
||||
it 'redirects to root' do
|
||||
post :create, organization: attributes_for(:organization)
|
||||
post :create, params: { organization: attributes_for(:organization) }
|
||||
|
||||
expect(flash[:alert]).to eq('You are not authorized to access this page.')
|
||||
expect(response).to redirect_to(root_path)
|
||||
|
|
@ -53,7 +53,7 @@ describe Admin::OrganizationsController do
|
|||
describe 'PATCH #update' do
|
||||
it 'does not update and redirects to root' do
|
||||
old_name = organization.name
|
||||
patch :update, id: organization.id, organization: attributes_for(:organization, name: 'new name')
|
||||
patch :update, params: { id: organization.id, organization: attributes_for(:organization, name: 'new name') }
|
||||
|
||||
organization.reload
|
||||
expect(organization.name).to eq(old_name)
|
||||
|
|
@ -66,13 +66,13 @@ describe Admin::OrganizationsController do
|
|||
context 'for a valid organization' do
|
||||
it 'does not destroy a resource' do
|
||||
expected = expect do
|
||||
delete :destroy, id: organization.id
|
||||
delete :destroy, params: { id: organization.id }
|
||||
end
|
||||
expected.to_not change(Organization, :count)
|
||||
end
|
||||
|
||||
it 'redirects to root' do
|
||||
delete :destroy, id: organization.id
|
||||
delete :destroy, params: { id: organization.id }
|
||||
|
||||
expect(flash[:alert]).to eq('You are not authorized to access this page.')
|
||||
expect(response).to redirect_to(root_path)
|
||||
|
|
@ -104,13 +104,13 @@ describe Admin::OrganizationsController do
|
|||
context 'with valid attributes' do
|
||||
it 'creates new organization' do
|
||||
expected = expect do
|
||||
post :create, organization: attributes_for(:organization)
|
||||
post :create, params: { organization: attributes_for(:organization) }
|
||||
end
|
||||
expected.to change { Organization.count }.by(1)
|
||||
end
|
||||
|
||||
it 'redirects to index' do
|
||||
post :create, organization: attributes_for(:organization)
|
||||
post :create, params: { organization: attributes_for(:organization) }
|
||||
|
||||
expect(flash[:notice]).to eq('Organization successfully created')
|
||||
expect(response).to redirect_to(admin_organizations_path)
|
||||
|
|
@ -120,13 +120,13 @@ describe Admin::OrganizationsController do
|
|||
context 'with invalid attributes' do
|
||||
it 'does not create new organization' do
|
||||
expected = expect do
|
||||
post :create, organization: attributes_for(:organization, name: '')
|
||||
post :create, params: { organization: attributes_for(:organization, name: '') }
|
||||
end
|
||||
expected.to_not change(Organization, :count)
|
||||
end
|
||||
|
||||
it 'redirects to new' do
|
||||
post :create, organization: attributes_for(:organization, name: '')
|
||||
post :create, params: { organization: attributes_for(:organization, name: '') }
|
||||
|
||||
expect(flash[:error]).to eq("Name can't be blank")
|
||||
expect(response).to redirect_to(new_admin_organization_path)
|
||||
|
|
@ -136,7 +136,7 @@ describe Admin::OrganizationsController do
|
|||
|
||||
describe 'PATCH #update' do
|
||||
it 'saves and redirects to index when the attributes are valid' do
|
||||
patch :update, id: organization.id, organization: attributes_for(:organization, name: 'changed name')
|
||||
patch :update, params: { id: organization.id, organization: attributes_for(:organization, name: 'changed name') }
|
||||
|
||||
organization.reload
|
||||
expect(organization.name).to eq('changed name')
|
||||
|
|
@ -145,7 +145,7 @@ describe Admin::OrganizationsController do
|
|||
end
|
||||
|
||||
it 'redirects to edit when attributes are invalid' do
|
||||
patch :update, id: organization.id, organization: attributes_for(:organization, name: '')
|
||||
patch :update, params: { id: organization.id, organization: attributes_for(:organization, name: '') }
|
||||
|
||||
expect(flash[:error]).to eq("Name can't be blank")
|
||||
expect(response).to redirect_to(edit_admin_organization_path(organization))
|
||||
|
|
@ -156,13 +156,13 @@ describe Admin::OrganizationsController do
|
|||
context 'for a valid organization' do
|
||||
it 'should successfully destroy a resource' do
|
||||
expected = expect do
|
||||
delete :destroy, id: organization.id
|
||||
delete :destroy, params: { id: organization.id }
|
||||
end
|
||||
expected.to change { Organization.count }.by(-1)
|
||||
end
|
||||
|
||||
it 'redirects to index' do
|
||||
delete :destroy, id: organization.id
|
||||
delete :destroy, params: { id: organization.id }
|
||||
|
||||
expect(flash[:notice]).to eq('Organization successfully destroyed')
|
||||
expect(response).to redirect_to(admin_organizations_path)
|
||||
|
|
@ -174,8 +174,8 @@ 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,
|
||||
user: { email: user.email }
|
||||
post :assign_org_admins, params: { id: organization.id,
|
||||
user: { email: user.email } }
|
||||
end
|
||||
|
||||
it 'assigns organization_admin role' do
|
||||
|
|
@ -188,8 +188,8 @@ 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,
|
||||
user: { email: org_admin_user.email }
|
||||
delete :unassign_org_admins, params: { id: organization.id,
|
||||
user: { email: org_admin_user.email } }
|
||||
end
|
||||
|
||||
it 'unassigns organization_admin role' do
|
||||
|
|
|
|||
|
|
@ -11,7 +11,7 @@ describe Admin::ProgramsController, type: :controller do
|
|||
context 'not logged in user' do
|
||||
describe 'GET #show' do
|
||||
it 'does not render admin/programs#show' do
|
||||
get :show, conference_id: conference.short_title
|
||||
get :show, params: { conference_id: conference.short_title }
|
||||
expect(response).to redirect_to(user_session_path)
|
||||
end
|
||||
end
|
||||
|
|
@ -24,7 +24,7 @@ describe Admin::ProgramsController, type: :controller do
|
|||
|
||||
describe 'PATCH #update' do
|
||||
it 'redirects to admin/programs#index' do
|
||||
patch :update, conference_id: conference.short_title, program: attributes_for(:program)
|
||||
patch :update, params: { conference_id: conference.short_title, program: attributes_for(:program) }
|
||||
conference.program.reload
|
||||
expect(response).to redirect_to admin_conference_program_path(conference.short_title)
|
||||
end
|
||||
|
|
|
|||
|
|
@ -22,22 +22,22 @@ describe Admin::RegistrationPeriodsController do
|
|||
context 'valid attributes' do
|
||||
|
||||
it 'locates the requested registration period object' do
|
||||
patch :update, conference_id: conference.short_title, registration_period: attributes_for(:registration_period)
|
||||
patch :update, params: { conference_id: conference.short_title, registration_period: attributes_for(:registration_period) }
|
||||
expect(assigns(:registration_period)).to eq(conference.registration_period)
|
||||
end
|
||||
|
||||
it 'changes registration period attributes' do
|
||||
the_date = conference.end_date - 10
|
||||
patch :update, conference_id: conference.short_title, registration_period:
|
||||
attributes_for(:registration_period, start_date: the_date)
|
||||
patch :update, params: { conference_id: conference.short_title, registration_period:
|
||||
attributes_for(:registration_period, start_date: the_date) }
|
||||
|
||||
conference.reload
|
||||
expect(conference.registration_period.start_date.to_s).to eq(the_date.to_s)
|
||||
end
|
||||
|
||||
it 'redirects to the updated registration period' do
|
||||
patch :update, conference_id: conference.short_title, registration_period:
|
||||
attributes_for(:registration_period)
|
||||
patch :update, params: { conference_id: conference.short_title, registration_period:
|
||||
attributes_for(:registration_period) }
|
||||
conference.reload
|
||||
expect(response).to redirect_to admin_conference_registration_period_path(
|
||||
conference.short_title)
|
||||
|
|
@ -51,10 +51,10 @@ describe Admin::RegistrationPeriodsController do
|
|||
start_date: Date.today,
|
||||
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)
|
||||
patch :update, params: { conference_id: conference.short_title, registration_period:
|
||||
attributes_for(:registration_period,
|
||||
start_date: Date.today + 2.days,
|
||||
end_date: Date.today + 4.days) }
|
||||
conference.reload
|
||||
allow(Mailbot).to receive(:conference_registration_date_update_mail).and_return(mailer)
|
||||
end
|
||||
|
|
@ -65,17 +65,19 @@ describe Admin::RegistrationPeriodsController do
|
|||
context 'with valid attributes' do
|
||||
it 'saves the registration period to the database' do
|
||||
expected = expect do
|
||||
post :create,
|
||||
conference_id: conference.short_title,
|
||||
registration_period: attributes_for(:registration_period)
|
||||
post :create, params: {
|
||||
conference_id: conference.short_title,
|
||||
registration_period: attributes_for(:registration_period)
|
||||
}
|
||||
end
|
||||
expected.to change { RegistrationPeriod.count }.by 1
|
||||
end
|
||||
|
||||
it 'redirects to registration_periods#show' do
|
||||
post :create,
|
||||
conference_id: conference.short_title,
|
||||
registration_period: attributes_for(:registration_period)
|
||||
post :create, params: {
|
||||
conference_id: conference.short_title,
|
||||
registration_period: attributes_for(:registration_period)
|
||||
}
|
||||
|
||||
expect(response).to redirect_to admin_conference_registration_period_path(
|
||||
assigns[:conference].short_title)
|
||||
|
|
@ -85,21 +87,23 @@ describe Admin::RegistrationPeriodsController do
|
|||
context 'with invalid attributes' do
|
||||
it 'does not save the registration period to the database' do
|
||||
expected = expect do
|
||||
post :create,
|
||||
conference_id: conference.short_title,
|
||||
registration_period: attributes_for(:registration_period,
|
||||
start_date: nil,
|
||||
end_date: nil)
|
||||
post :create, params: {
|
||||
conference_id: conference.short_title,
|
||||
registration_period: attributes_for(:registration_period,
|
||||
start_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,
|
||||
registration_period: attributes_for(:registration_period,
|
||||
start_date: nil,
|
||||
end_date: nil)
|
||||
post :create, params: {
|
||||
conference_id: conference.short_title,
|
||||
registration_period: attributes_for(:registration_period,
|
||||
start_date: nil,
|
||||
end_date: nil)
|
||||
}
|
||||
expect(response).to be_success
|
||||
end
|
||||
end
|
||||
|
|
@ -107,46 +111,46 @@ describe Admin::RegistrationPeriodsController do
|
|||
|
||||
describe 'GET #edit' do
|
||||
it 'assigns the requested registration period to @registration_period' do
|
||||
get :edit, conference_id: conference.short_title
|
||||
get :edit, params: { conference_id: conference.short_title }
|
||||
expect(assigns(:registration_period)).to eq conference.registration_period
|
||||
end
|
||||
|
||||
it 'renders the show template' do
|
||||
get :edit, conference_id: conference.short_title
|
||||
get :edit, params: { conference_id: conference.short_title }
|
||||
expect(response).to render_template :edit
|
||||
end
|
||||
end
|
||||
|
||||
describe 'GET #show' do
|
||||
it 'assigns the requested registration period to @registration_period' do
|
||||
get :show, conference_id: conference.short_title
|
||||
get :show, params: { conference_id: conference.short_title }
|
||||
expect(assigns(:registration_period)).to eq conference.registration_period
|
||||
end
|
||||
|
||||
it 'renders the show template' do
|
||||
get :show, conference_id: conference.short_title
|
||||
get :show, params: { conference_id: conference.short_title }
|
||||
expect(response).to render_template :show
|
||||
end
|
||||
end
|
||||
|
||||
describe 'GET #new' do
|
||||
it 'assigns a new registration period to @registration_period' do
|
||||
get :new, conference_id: conference.short_title
|
||||
get :new, params: { conference_id: conference.short_title }
|
||||
expect(assigns(:registration_period)).to be_a_new(RegistrationPeriod)
|
||||
end
|
||||
|
||||
it 'renders the :new template' do
|
||||
get :new, conference_id: conference.short_title
|
||||
get :new, params: { conference_id: conference.short_title }
|
||||
expect(response).to render_template :new
|
||||
end
|
||||
end
|
||||
|
||||
describe 'DELETE #destroy' do
|
||||
it 'it deletes the registration period' do
|
||||
expect { delete :destroy, conference_id: conference.short_title }.to change(RegistrationPeriod, :count).by(-1)
|
||||
expect { delete :destroy, params: { conference_id: conference.short_title } }.to change(RegistrationPeriod, :count).by(-1)
|
||||
end
|
||||
it 'redirects to users#show' do
|
||||
delete :destroy, conference_id: conference.short_title
|
||||
delete :destroy, params: { conference_id: conference.short_title }
|
||||
expect(response).to redirect_to admin_conference_registration_period_path
|
||||
end
|
||||
end
|
||||
|
|
|
|||
|
|
@ -25,12 +25,12 @@ describe Admin::ReportsController do
|
|||
|
||||
describe 'GET #index' do
|
||||
it 'renders the index template' do
|
||||
get :index, conference_id: conference.short_title
|
||||
get :index, params: { conference_id: conference.short_title }
|
||||
expect(response).to render_template :index
|
||||
end
|
||||
|
||||
it 'initialises missing speakers' do
|
||||
get :index, conference_id: conference.short_title
|
||||
get :index, params: { conference_id: conference.short_title }
|
||||
expect(assigns(:missing_event_speakers).pluck(:user_id)).to eq [user1.id]
|
||||
end
|
||||
end
|
||||
|
|
|
|||
|
|
@ -14,7 +14,7 @@ describe Admin::RolesController do
|
|||
describe 'GET #index' do
|
||||
before :each do
|
||||
sign_in(admin)
|
||||
get :index, conference_id: conference.short_title
|
||||
get :index, params: { conference_id: conference.short_title }
|
||||
end
|
||||
|
||||
it 'assigns default value to selection variable' do
|
||||
|
|
@ -29,8 +29,8 @@ describe Admin::RolesController do
|
|||
describe 'GET #show' do
|
||||
before :each do
|
||||
sign_in(admin)
|
||||
xhr :get, :show, conference_id: conference.short_title,
|
||||
id: 'organizer'
|
||||
get :show, params: { conference_id: conference.short_title,
|
||||
id: 'organizer' }
|
||||
end
|
||||
|
||||
it 'assigns correct value to selection variable' do
|
||||
|
|
@ -45,9 +45,9 @@ describe Admin::RolesController do
|
|||
describe 'PATCH #update' do
|
||||
before :each do
|
||||
sign_in admin
|
||||
patch :update, conference_id: conference.short_title,
|
||||
id: 'cfp',
|
||||
role: { description: 'New description for cfp role!' }
|
||||
patch :update, params: { conference_id: conference.short_title,
|
||||
id: 'cfp',
|
||||
role: { description: 'New description for cfp role!' } }
|
||||
end
|
||||
|
||||
it 'changes the description of the role' do
|
||||
|
|
@ -58,9 +58,9 @@ describe Admin::RolesController do
|
|||
describe 'POST #toggle' do
|
||||
before :each do
|
||||
sign_in admin
|
||||
post :toggle_user, conference_id: conference.short_title,
|
||||
user: { email: 'user1@osem.io' },
|
||||
id: 'cfp'
|
||||
post :toggle_user, params: { conference_id: conference.short_title,
|
||||
user: { email: 'user1@osem.io' },
|
||||
id: 'cfp' }
|
||||
end
|
||||
|
||||
context 'assigns correct values to variables' do
|
||||
|
|
@ -79,17 +79,17 @@ 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'
|
||||
post :toggle_user, params: { conference_id: conference.short_title,
|
||||
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'
|
||||
post :toggle_user, params: { conference_id: conference.short_title,
|
||||
user: { email: 'user1@osem.io' },
|
||||
id: 'organizer' }
|
||||
|
||||
expect(user1.roles).to eq [organizer_role, cfp_role]
|
||||
end
|
||||
|
|
@ -97,23 +97,23 @@ 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'
|
||||
post :toggle_user, params: { conference_id: conference.short_title,
|
||||
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'
|
||||
post :toggle_user, params: { conference_id: conference.short_title,
|
||||
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'
|
||||
post :toggle_user, params: { conference_id: conference.short_title,
|
||||
user: { email: 'user1@osem.io', state: 'false' },
|
||||
id: 'cfp' }
|
||||
|
||||
user1.reload
|
||||
expect(user1.roles).to eq [organizer_role]
|
||||
|
|
@ -122,15 +122,15 @@ 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'
|
||||
post :toggle_user, params: { conference_id: conference.short_title,
|
||||
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'
|
||||
post :toggle_user, params: { conference_id: conference.short_title,
|
||||
user: { email: 'user1@osem.io', state: 'false' },
|
||||
id: 'organizer' }
|
||||
expect(organizer_role.users).to eq [user1]
|
||||
end
|
||||
end
|
||||
|
|
|
|||
|
|
@ -12,7 +12,7 @@ describe Admin::RoomsController do
|
|||
before { sign_in admin }
|
||||
|
||||
describe 'GET #index' do
|
||||
before { get :index, conference_id: conference.short_title }
|
||||
before { get :index, params: { conference_id: conference.short_title } }
|
||||
|
||||
it 'assigns conference, venue and rooms variables' do
|
||||
expect(assigns(:conference)).to eq conference
|
||||
|
|
@ -26,7 +26,7 @@ describe Admin::RoomsController do
|
|||
end
|
||||
|
||||
describe 'GET #edit' do
|
||||
before { get :edit, conference_id: conference.short_title, id: room.id }
|
||||
before { get :edit, params: { conference_id: conference.short_title, id: room.id } }
|
||||
|
||||
it 'renders edit template' do
|
||||
expect(response).to render_template('edit')
|
||||
|
|
@ -38,7 +38,7 @@ describe Admin::RoomsController do
|
|||
end
|
||||
|
||||
describe 'GET #new' do
|
||||
before { get :new, conference_id: conference.short_title }
|
||||
before { get :new, params: { conference_id: conference.short_title } }
|
||||
|
||||
it 'renders new template' do
|
||||
expect(response).to render_template('new')
|
||||
|
|
@ -52,7 +52,7 @@ describe Admin::RoomsController do
|
|||
describe 'POST #create' do
|
||||
context 'saves successfuly' do
|
||||
before do
|
||||
post :create, room: attributes_for(:room), conference_id: conference.short_title
|
||||
post :create, params: { room: attributes_for(:room), conference_id: conference.short_title }
|
||||
end
|
||||
|
||||
it 'redirects to admin room index path' do
|
||||
|
|
@ -71,7 +71,7 @@ describe Admin::RoomsController do
|
|||
context 'save fails' do
|
||||
before do
|
||||
allow_any_instance_of(Room).to receive(:save).and_return(false)
|
||||
post :create, room: attributes_for(:room), conference_id: conference.short_title
|
||||
post :create, params: { room: attributes_for(:room), conference_id: conference.short_title }
|
||||
end
|
||||
|
||||
it 'renders new template' do
|
||||
|
|
@ -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),
|
||||
conference_id: conference.short_title,
|
||||
id: room.id
|
||||
patch :update, params: { room: attributes_for(:room, size: 2),
|
||||
conference_id: conference.short_title,
|
||||
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),
|
||||
conference_id: conference.short_title,
|
||||
id: room.id
|
||||
patch :update, params: { room: attributes_for(:room, size: 2),
|
||||
conference_id: conference.short_title,
|
||||
id: room.id }
|
||||
end
|
||||
|
||||
it 'renders edit template' do
|
||||
|
|
@ -135,7 +135,7 @@ describe Admin::RoomsController do
|
|||
|
||||
describe 'DELETE #destroy' do
|
||||
context 'deletes successfully' do
|
||||
before { delete :destroy, conference_id: conference.short_title, id: room.id }
|
||||
before { delete :destroy, params: { conference_id: conference.short_title, id: room.id } }
|
||||
|
||||
it 'redirects to admin room index path' do
|
||||
expect(response).to redirect_to admin_conference_venue_rooms_path(conference_id: conference.short_title)
|
||||
|
|
@ -153,7 +153,7 @@ describe Admin::RoomsController do
|
|||
context 'delete fails' do
|
||||
before do
|
||||
allow_any_instance_of(Room).to receive(:destroy).and_return(false)
|
||||
delete :destroy, conference_id: conference.short_title, id: room.id
|
||||
delete :destroy, params: { conference_id: conference.short_title, id: room.id }
|
||||
end
|
||||
|
||||
it 'redirects to admin room index path' do
|
||||
|
|
|
|||
|
|
@ -15,13 +15,13 @@ describe Admin::SchedulesController do
|
|||
|
||||
describe 'GET #index' do
|
||||
it 'renders the index template' do
|
||||
get :index, conference_id: conference.short_title
|
||||
get :index, params: { conference_id: conference.short_title }
|
||||
expect(response).to render_template :index
|
||||
end
|
||||
end
|
||||
|
||||
describe 'POST #create' do
|
||||
let(:create_action){ post :create, conference_id: conference.short_title }
|
||||
let(:create_action){ post :create, params: { conference_id: conference.short_title } }
|
||||
|
||||
it 'saves the schedule to the database' do
|
||||
expect{ create_action }.to change { Schedule.count }.by 1
|
||||
|
|
@ -35,7 +35,7 @@ describe Admin::SchedulesController do
|
|||
end
|
||||
|
||||
describe 'GET #show' do
|
||||
let(:show_action){ get :show, id: schedule.id, conference_id: conference.short_title }
|
||||
let(:show_action){ get :show, params: { id: schedule.id, conference_id: conference.short_title } }
|
||||
|
||||
it 'assigns the requested schedule to schedule' do
|
||||
show_action
|
||||
|
|
@ -49,7 +49,7 @@ describe Admin::SchedulesController do
|
|||
end
|
||||
|
||||
describe 'DELETE #destroy' do
|
||||
let(:destroy_action){ delete :destroy, id: schedule.id, conference_id: conference.short_title }
|
||||
let(:destroy_action){ delete :destroy, params: { id: schedule.id, conference_id: conference.short_title } }
|
||||
|
||||
it 'deletes the schedule' do
|
||||
expect{ destroy_action }.to change { Schedule.count }.by(-1)
|
||||
|
|
|
|||
|
|
@ -11,7 +11,7 @@ describe Admin::SponsorshipLevelsController do
|
|||
before { sign_in admin }
|
||||
|
||||
describe 'GET #index' do
|
||||
before { get :index, conference_id: conference.short_title }
|
||||
before { get :index, params: { conference_id: conference.short_title } }
|
||||
|
||||
it 'assigns conference and sponsorship_levels variables' do
|
||||
expect(assigns(:conference)).to eq conference
|
||||
|
|
@ -24,7 +24,7 @@ describe Admin::SponsorshipLevelsController do
|
|||
end
|
||||
|
||||
describe 'GET #edit' do
|
||||
before { get :edit, conference_id: conference.short_title, id: sponsorship_level.id }
|
||||
before { get :edit, params: { conference_id: conference.short_title, id: sponsorship_level.id } }
|
||||
|
||||
it 'renders edit template' do
|
||||
expect(response).to render_template('edit')
|
||||
|
|
@ -36,7 +36,7 @@ describe Admin::SponsorshipLevelsController do
|
|||
end
|
||||
|
||||
describe 'GET #new' do
|
||||
before { get :new, conference_id: conference.short_title }
|
||||
before { get :new, params: { conference_id: conference.short_title } }
|
||||
|
||||
it 'renders new template' do
|
||||
expect(response).to render_template('new')
|
||||
|
|
@ -50,8 +50,8 @@ describe Admin::SponsorshipLevelsController do
|
|||
describe 'POST #create' do
|
||||
context 'saves successfuly' do
|
||||
before(:each, run: true) do
|
||||
post :create, sponsorship_level: attributes_for(:sponsorship_level),
|
||||
conference_id: conference.short_title
|
||||
post :create, params: { sponsorship_level: attributes_for(:sponsorship_level),
|
||||
conference_id: conference.short_title }
|
||||
end
|
||||
|
||||
it 'redirects to admin sponsorship_level index path', run: true do
|
||||
|
|
@ -64,8 +64,8 @@ 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
|
||||
post :create, params: { sponsorship_level: attributes_for(:sponsorship_level),
|
||||
conference_id: conference.short_title }
|
||||
end.to change{ conference.sponsorship_levels.count }.from(0).to(1)
|
||||
end
|
||||
end
|
||||
|
|
@ -73,8 +73,8 @@ describe Admin::SponsorshipLevelsController do
|
|||
context 'save fails' 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
|
||||
post :create, params: { sponsorship_level: attributes_for(:sponsorship_level),
|
||||
conference_id: conference.short_title }
|
||||
end
|
||||
|
||||
it 'renders new template' do
|
||||
|
|
@ -94,9 +94,9 @@ describe Admin::SponsorshipLevelsController do
|
|||
describe 'PATCH #update' 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
|
||||
patch :update, params: { sponsorship_level: attributes_for(:sponsorship_level, title: 'Gold'),
|
||||
conference_id: conference.short_title,
|
||||
id: sponsorship_level.id }
|
||||
end
|
||||
|
||||
it 'redirects to admin sponsorship_level index path' do
|
||||
|
|
@ -116,9 +116,9 @@ describe Admin::SponsorshipLevelsController do
|
|||
context 'update fails' 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
|
||||
patch :update, params: { sponsorship_level: attributes_for(:sponsorship_level, title: 'Gold'),
|
||||
conference_id: conference.short_title,
|
||||
id: sponsorship_level.id }
|
||||
end
|
||||
|
||||
it 'renders edit template' do
|
||||
|
|
@ -139,7 +139,7 @@ describe Admin::SponsorshipLevelsController do
|
|||
describe 'DELETE #destroy' do
|
||||
context 'deletes successfully' do
|
||||
before(:each, run: true) do
|
||||
delete :destroy, conference_id: conference.short_title, id: sponsorship_level.id
|
||||
delete :destroy, params: { conference_id: conference.short_title, id: sponsorship_level.id }
|
||||
end
|
||||
|
||||
it 'redirects to admin sponsorship_level index path', run: true do
|
||||
|
|
@ -153,7 +153,7 @@ describe Admin::SponsorshipLevelsController do
|
|||
it 'deletes the sponsorship_level' do
|
||||
sponsorship_level
|
||||
expect do
|
||||
delete :destroy, conference_id: conference.short_title, id: sponsorship_level.id
|
||||
delete :destroy, params: { conference_id: conference.short_title, id: sponsorship_level.id }
|
||||
end.to change{ conference.sponsorship_levels.count }.from(1).to(0)
|
||||
end
|
||||
end
|
||||
|
|
@ -161,7 +161,7 @@ describe Admin::SponsorshipLevelsController do
|
|||
context 'delete fails' do
|
||||
before do
|
||||
allow_any_instance_of(SponsorshipLevel).to receive(:destroy).and_return(false)
|
||||
delete :destroy, conference_id: conference.short_title, id: sponsorship_level.id
|
||||
delete :destroy, params: { conference_id: conference.short_title, id: sponsorship_level.id }
|
||||
end
|
||||
|
||||
it 'redirects to admin sponsorship_level index path' do
|
||||
|
|
@ -182,7 +182,7 @@ describe Admin::SponsorshipLevelsController do
|
|||
before do
|
||||
sponsorship_level
|
||||
@second_sponsorship_level = create(:sponsorship_level, conference: conference)
|
||||
patch :up, conference_id: conference.short_title, id: @second_sponsorship_level.id
|
||||
patch :up, params: { conference_id: conference.short_title, id: @second_sponsorship_level.id }
|
||||
end
|
||||
|
||||
it 'moves sponsorship_level up by one position' do
|
||||
|
|
@ -197,7 +197,7 @@ describe Admin::SponsorshipLevelsController do
|
|||
before do
|
||||
sponsorship_level
|
||||
@second_sponsorship_level = create(:sponsorship_level, conference: conference)
|
||||
patch :down, conference_id: conference.short_title, id: sponsorship_level.id
|
||||
patch :down, params: { conference_id: conference.short_title, id: sponsorship_level.id }
|
||||
end
|
||||
|
||||
it 'moves sponsorship_level down by one position' do
|
||||
|
|
|
|||
|
|
@ -18,13 +18,13 @@ describe Admin::TicketScanningsController do
|
|||
describe 'POST #create' do
|
||||
it 'does not create new ticket scanning' do
|
||||
expected = expect do
|
||||
post :create, physical_ticket_id: physical_ticket.token
|
||||
post :create, params: { physical_ticket_id: physical_ticket.token }
|
||||
end
|
||||
expected.to_not change(TicketScanning, :count)
|
||||
end
|
||||
|
||||
it 'redirects to root' do
|
||||
post :create, physical_ticket_id: physical_ticket.token
|
||||
post :create, params: { physical_ticket_id: physical_ticket.token }
|
||||
expect(flash[:alert]).to eq('You are not authorized to access this page.')
|
||||
expect(response).to redirect_to(root_path)
|
||||
end
|
||||
|
|
@ -39,13 +39,13 @@ describe Admin::TicketScanningsController do
|
|||
context 'with valid physical_ticket' do
|
||||
it 'creates new ticket scanning' do
|
||||
expected = expect do
|
||||
post :create, physical_ticket_id: physical_ticket.token
|
||||
post :create, params: { physical_ticket_id: physical_ticket.token }
|
||||
end
|
||||
expected.to change { TicketScanning.count }.by(1)
|
||||
end
|
||||
|
||||
it 'redirects to index' do
|
||||
post :create, physical_ticket_id: physical_ticket.token
|
||||
post :create, params: { physical_ticket_id: physical_ticket.token }
|
||||
expect(flash[:notice]).to eq("Ticket with token #{physical_ticket.token} successfully scanned.")
|
||||
expect(response).to redirect_to(conferences_path)
|
||||
end
|
||||
|
|
@ -54,7 +54,7 @@ describe Admin::TicketScanningsController do
|
|||
context 'with Invalid physical_ticket' do
|
||||
it 'raises exception' do
|
||||
expected = expect do
|
||||
post :create, physical_ticket_id: 'XXXX'
|
||||
post :create, params: { physical_ticket_id: 'XXXX' }
|
||||
end
|
||||
expected.to raise_exception(ActiveRecord::RecordNotFound)
|
||||
end
|
||||
|
|
|
|||
|
|
@ -17,7 +17,7 @@ describe Admin::TracksController do
|
|||
|
||||
describe 'GET #index' do
|
||||
before :each do
|
||||
get :index, conference_id: conference.short_title
|
||||
get :index, params: { conference_id: conference.short_title }
|
||||
end
|
||||
|
||||
it 'assigns @tracks with the correct values' do
|
||||
|
|
@ -33,7 +33,7 @@ describe Admin::TracksController do
|
|||
|
||||
describe 'GET #show' do
|
||||
before :each do
|
||||
get :show, conference_id: conference.short_title, id: track.short_name
|
||||
get :show, params: { conference_id: conference.short_title, id: track.short_name }
|
||||
end
|
||||
|
||||
it 'assigns the correct track' do
|
||||
|
|
@ -47,7 +47,7 @@ describe Admin::TracksController do
|
|||
|
||||
describe 'GET #new' do
|
||||
before :each do
|
||||
get :new, conference_id: conference.short_title
|
||||
get :new, params: { conference_id: conference.short_title }
|
||||
end
|
||||
|
||||
it 'assigns a new track with the correct conference' do
|
||||
|
|
@ -64,7 +64,7 @@ describe Admin::TracksController do
|
|||
describe 'POST #create' do
|
||||
context 'saves successfuly' do
|
||||
before :each do
|
||||
post :create, track: attributes_for(:track), conference_id: conference.short_title
|
||||
post :create, params: { track: attributes_for(:track), conference_id: conference.short_title }
|
||||
end
|
||||
|
||||
it 'assigns a new track with the correct conference' do
|
||||
|
|
@ -94,7 +94,7 @@ describe Admin::TracksController do
|
|||
context 'save fails' do
|
||||
before :each do
|
||||
allow_any_instance_of(Track).to receive(:save).and_return(false)
|
||||
post :create, track: attributes_for(:track, short_name: 'my_track'), conference_id: conference.short_title
|
||||
post :create, params: { track: attributes_for(:track, short_name: 'my_track'), conference_id: conference.short_title }
|
||||
end
|
||||
|
||||
it 'assigns a new track with the correct conference' do
|
||||
|
|
@ -119,7 +119,7 @@ describe Admin::TracksController do
|
|||
|
||||
describe 'GET #edit' do
|
||||
before :each do
|
||||
get :edit, conference_id: conference.short_title, id: track.short_name
|
||||
get :edit, params: { conference_id: conference.short_title, id: track.short_name }
|
||||
end
|
||||
|
||||
it 'assigns the correct track' 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'),
|
||||
conference_id: conference.short_title,
|
||||
id: track.short_name
|
||||
patch :update, params: { track: attributes_for(:track, color: '#FF0000'),
|
||||
conference_id: conference.short_title,
|
||||
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'),
|
||||
conference_id: conference.short_title,
|
||||
id: track.short_name
|
||||
patch :update, params: { track: attributes_for(:track, color: '#FF0000'),
|
||||
conference_id: conference.short_title,
|
||||
id: track.short_name }
|
||||
end
|
||||
|
||||
it 'assigns the correct track' do
|
||||
|
|
@ -187,7 +187,7 @@ describe Admin::TracksController do
|
|||
describe 'DELETE #destroy' do
|
||||
context 'deletes successfully' do
|
||||
before :each do
|
||||
delete :destroy, conference_id: conference.short_title, id: track.short_name
|
||||
delete :destroy, params: { conference_id: conference.short_title, id: track.short_name }
|
||||
end
|
||||
|
||||
it 'redirects to admin tracks index path' do
|
||||
|
|
@ -206,7 +206,7 @@ describe Admin::TracksController do
|
|||
context 'delete fails' do
|
||||
before :each do
|
||||
allow_any_instance_of(Track).to receive(:destroy).and_return(false)
|
||||
delete :destroy, conference_id: conference.short_title, id: track.short_name
|
||||
delete :destroy, params: { conference_id: conference.short_title, id: track.short_name }
|
||||
end
|
||||
|
||||
it 'assigns the correct track' do
|
||||
|
|
@ -236,7 +236,7 @@ describe Admin::TracksController do
|
|||
|
||||
context 'toggles successfully' do
|
||||
before :each do
|
||||
patch :toggle_cfp_inclusion, conference_id: conference.short_title, id: self_organized_track.short_name, format: :js
|
||||
patch :toggle_cfp_inclusion, params: { conference_id: conference.short_title, id: self_organized_track.short_name, format: :js }
|
||||
self_organized_track.reload
|
||||
end
|
||||
|
||||
|
|
@ -256,7 +256,7 @@ describe Admin::TracksController do
|
|||
context 'save fails' do
|
||||
before :each do
|
||||
allow_any_instance_of(Track).to receive(:save).and_return(false)
|
||||
patch :toggle_cfp_inclusion, conference_id: conference.short_title, id: self_organized_track.short_name, format: :js
|
||||
patch :toggle_cfp_inclusion, params: { conference_id: conference.short_title, id: self_organized_track.short_name, format: :js }
|
||||
self_organized_track.reload
|
||||
end
|
||||
|
||||
|
|
@ -282,7 +282,7 @@ describe Admin::TracksController do
|
|||
|
||||
context 'toggles successfully' do
|
||||
before :each do
|
||||
patch :toggle_cfp_inclusion, conference_id: conference.short_title, id: self_organized_track.short_name, format: :js
|
||||
patch :toggle_cfp_inclusion, params: { conference_id: conference.short_title, id: self_organized_track.short_name, format: :js }
|
||||
self_organized_track.reload
|
||||
end
|
||||
|
||||
|
|
@ -302,7 +302,7 @@ describe Admin::TracksController do
|
|||
context 'save fails' do
|
||||
before :each do
|
||||
allow_any_instance_of(Track).to receive(:save).and_return(false)
|
||||
patch :toggle_cfp_inclusion, conference_id: conference.short_title, id: self_organized_track.short_name, format: :js
|
||||
patch :toggle_cfp_inclusion, params: { conference_id: conference.short_title, id: self_organized_track.short_name, format: :js }
|
||||
self_organized_track.reload
|
||||
end
|
||||
|
||||
|
|
@ -325,7 +325,7 @@ describe Admin::TracksController do
|
|||
before :each do
|
||||
self_organized_track.state = 'canceled'
|
||||
self_organized_track.save!
|
||||
patch :restart, conference_id: conference.short_title, id: self_organized_track.short_name
|
||||
patch :restart, params: { conference_id: conference.short_title, id: self_organized_track.short_name }
|
||||
self_organized_track.reload
|
||||
end
|
||||
|
||||
|
|
@ -344,7 +344,7 @@ describe Admin::TracksController do
|
|||
|
||||
describe 'PATCH #to_accept' do
|
||||
before :each do
|
||||
patch :to_accept, conference_id: conference.short_title, id: self_organized_track.short_name
|
||||
patch :to_accept, params: { conference_id: conference.short_title, id: self_organized_track.short_name }
|
||||
self_organized_track.reload
|
||||
end
|
||||
|
||||
|
|
@ -364,7 +364,7 @@ describe Admin::TracksController do
|
|||
describe 'PATCH #accept' do
|
||||
shared_examples 'fails to accept' do
|
||||
before :each do
|
||||
patch :accept, conference_id: conference.short_title, id: self_organized_track.short_name
|
||||
patch :accept, params: { conference_id: conference.short_title, id: self_organized_track.short_name }
|
||||
end
|
||||
|
||||
it 'assigns the correct track' do
|
||||
|
|
@ -382,7 +382,7 @@ describe Admin::TracksController do
|
|||
|
||||
context 'has start_date, end_date and room' do
|
||||
before :each do
|
||||
patch :accept, conference_id: conference.short_title, id: self_organized_track.short_name
|
||||
patch :accept, params: { conference_id: conference.short_title, id: self_organized_track.short_name }
|
||||
self_organized_track.reload
|
||||
end
|
||||
|
||||
|
|
@ -472,7 +472,7 @@ describe Admin::TracksController do
|
|||
before :each do
|
||||
self_organized_track.state = 'accepted'
|
||||
self_organized_track.save!
|
||||
patch :confirm, conference_id: conference.short_title, id: self_organized_track.short_name
|
||||
patch :confirm, params: { conference_id: conference.short_title, id: self_organized_track.short_name }
|
||||
self_organized_track.reload
|
||||
end
|
||||
|
||||
|
|
@ -491,7 +491,7 @@ describe Admin::TracksController do
|
|||
|
||||
describe 'PATCH #to_reject' do
|
||||
before :each do
|
||||
patch :to_reject, conference_id: conference.short_title, id: self_organized_track.short_name
|
||||
patch :to_reject, params: { conference_id: conference.short_title, id: self_organized_track.short_name }
|
||||
self_organized_track.reload
|
||||
end
|
||||
|
||||
|
|
@ -510,7 +510,7 @@ describe Admin::TracksController do
|
|||
|
||||
describe 'PATCH #reject' do
|
||||
before :each do
|
||||
patch :reject, conference_id: conference.short_title, id: self_organized_track.short_name
|
||||
patch :reject, params: { conference_id: conference.short_title, id: self_organized_track.short_name }
|
||||
self_organized_track.reload
|
||||
end
|
||||
|
||||
|
|
@ -531,7 +531,7 @@ describe Admin::TracksController do
|
|||
before :each do
|
||||
self_organized_track.state = 'confirmed'
|
||||
self_organized_track.save!
|
||||
patch :cancel, conference_id: conference.short_title, id: self_organized_track.short_name
|
||||
patch :cancel, params: { conference_id: conference.short_title, id: self_organized_track.short_name }
|
||||
self_organized_track.reload
|
||||
end
|
||||
|
||||
|
|
|
|||
|
|
@ -23,12 +23,12 @@ describe Admin::UsersController do
|
|||
describe 'PATCH #toggle_confirmation' do
|
||||
it 'confirms user' do
|
||||
user_to_confirm = create(:user, email: 'unconfirmed_user@osem.io', confirmed_at: nil)
|
||||
patch :toggle_confirmation, id: user_to_confirm.id, user: { to_confirm: 'true' }
|
||||
patch :toggle_confirmation, params: { id: user_to_confirm.id, user: { to_confirm: 'true' } }
|
||||
user_to_confirm.reload
|
||||
expect(user_to_confirm.confirmed?).to eq true
|
||||
end
|
||||
it 'undo confirmation of user' do
|
||||
patch :toggle_confirmation, id: user.id, user: { to_confirm: 'false' }
|
||||
patch :toggle_confirmation, params: { id: user.id, user: { to_confirm: 'false' } }
|
||||
user.reload
|
||||
expect(user.confirmed?).to eq false
|
||||
end
|
||||
|
|
@ -36,7 +36,7 @@ describe Admin::UsersController do
|
|||
describe 'PATCH #update' do
|
||||
context 'valid attributes' do
|
||||
before :each do
|
||||
patch :update, id: user.id, user: { name: 'new name', email: 'new_email@osem.io' }
|
||||
patch :update, params: { id: user.id, user: { name: 'new name', email: 'new_email@osem.io' } }
|
||||
end
|
||||
|
||||
it 'locates requested @user' do
|
||||
|
|
@ -66,7 +66,7 @@ describe Admin::UsersController do
|
|||
describe 'POST #create' do
|
||||
context 'saves successfuly' do
|
||||
before do
|
||||
post :create, user: attributes_for(:user)
|
||||
post :create, params: { user: attributes_for(:user) }
|
||||
end
|
||||
|
||||
it 'redirects to admin users index path' do
|
||||
|
|
@ -85,7 +85,7 @@ describe Admin::UsersController do
|
|||
context 'save fails' do
|
||||
before do
|
||||
allow_any_instance_of(User).to receive(:save).and_return(false)
|
||||
post :create, user: attributes_for(:user)
|
||||
post :create, params: { user: attributes_for(:user) }
|
||||
end
|
||||
|
||||
it 'renders new template' do
|
||||
|
|
@ -98,7 +98,7 @@ describe Admin::UsersController do
|
|||
|
||||
it 'does not create new user' do
|
||||
expect do
|
||||
post :create, user: attributes_for(:user)
|
||||
post :create, params: { user: attributes_for(:user) }
|
||||
end.not_to change{ Event.count }
|
||||
end
|
||||
end
|
||||
|
|
|
|||
|
|
@ -18,7 +18,7 @@ describe Admin::VersionsController do
|
|||
|
||||
it 'reverts all changes for update actions' do
|
||||
conference.update_attributes(short_title: 'testtitle', description: 'Some random text')
|
||||
get :revert_object, id: PaperTrail::Version.last.id
|
||||
get :revert_object, params: { id: PaperTrail::Version.last.id }
|
||||
conference.reload
|
||||
expect(conference.short_title).to eq 'exampletitle'
|
||||
expect(conference.description).to eq 'Example Description'
|
||||
|
|
@ -27,14 +27,14 @@ describe Admin::VersionsController do
|
|||
it 'shows correct flash on trying to revert create event of a deleted object' do
|
||||
creation_version_id = conference.program.event_types.first.versions.first.id
|
||||
conference.program.event_types.first.destroy
|
||||
get :revert_object, id: creation_version_id
|
||||
get :revert_object, params: { id: creation_version_id }
|
||||
expect(flash[:error]).to match('The item is already in the state that you are trying to revert it back to')
|
||||
end
|
||||
|
||||
it 'reverting deletion of object creates it again' do
|
||||
conference.program.event_types.first.destroy
|
||||
event_types_count = conference.program.event_types.count
|
||||
get :revert_object, id: PaperTrail::Version.last.id
|
||||
get :revert_object, params: { id: PaperTrail::Version.last.id }
|
||||
conference.reload
|
||||
expect(PaperTrail::Version.last.event).to eq 'create'
|
||||
expect(conference.program.event_types.count).to eq(event_types_count + 1)
|
||||
|
|
@ -42,14 +42,14 @@ describe Admin::VersionsController do
|
|||
|
||||
it 'reverting creation of object deletes it ' do
|
||||
create(:lodging, conference: conference)
|
||||
get :revert_object, id: PaperTrail::Version.last.id
|
||||
get :revert_object, params: { id: PaperTrail::Version.last.id }
|
||||
expect(PaperTrail::Version.last.event).to eq 'destroy'
|
||||
expect(Lodging.count).to eq 0
|
||||
end
|
||||
|
||||
it 'reverting creation of conference is not permitted' do
|
||||
conference_count_before = Conference.count
|
||||
get :revert_object, id: conference.versions.first.id
|
||||
get :revert_object, params: { id: conference.versions.first.id }
|
||||
expect(flash[:alert]).to eq 'You are not authorized to access this page.'
|
||||
expect(Conference.count).to eq(conference_count_before)
|
||||
end
|
||||
|
|
@ -62,7 +62,7 @@ describe Admin::VersionsController do
|
|||
|
||||
it 'reverts specified change for update actions' do
|
||||
conference.update_attributes(short_title: 'testtitle', description: 'Some random text')
|
||||
get :revert_attribute, id: PaperTrail::Version.last.id, attribute: 'short_title'
|
||||
get :revert_attribute, params: { id: PaperTrail::Version.last.id, attribute: 'short_title' }
|
||||
conference.reload
|
||||
expect(conference.short_title).to eq 'exampletitle'
|
||||
expect(conference.description).to eq 'Some random text'
|
||||
|
|
@ -71,7 +71,7 @@ describe Admin::VersionsController do
|
|||
it 'shows correct flash on trying to revert to the current state' do
|
||||
conference.update_attributes(short_title: 'testtitle', description: 'Some random text')
|
||||
conference.update_attributes(short_title: 'exampletitle')
|
||||
get :revert_attribute, id: PaperTrail::Version.all[-2].id, attribute: 'short_title'
|
||||
get :revert_attribute, params: { id: PaperTrail::Version.all[-2].id, attribute: 'short_title' }
|
||||
expect(flash[:error]).to match('The item is already in the state that you are trying to revert it back to')
|
||||
expect(conference.short_title).to eq 'exampletitle'
|
||||
end
|
||||
|
|
@ -79,14 +79,14 @@ describe Admin::VersionsController do
|
|||
it 'fails on trying to revert deleted object' do
|
||||
conference.program.event_types.first.update_attributes(title: 'New Event Title')
|
||||
conference.program.event_types.first.destroy
|
||||
get :revert_attribute, id: PaperTrail::Version.all[-2].id, attribute: 'title'
|
||||
get :revert_attribute, params: { id: PaperTrail::Version.all[-2].id, attribute: 'title' }
|
||||
conference.reload
|
||||
expect(flash[:alert]).to eq 'You are not authorized to access this page.'
|
||||
end
|
||||
|
||||
it 'fails on trying to revert creation event' do
|
||||
create(:lodging, conference: conference)
|
||||
get :revert_attribute, id: PaperTrail::Version.last.id, attribute: 'name'
|
||||
get :revert_attribute, params: { id: PaperTrail::Version.last.id, attribute: 'name' }
|
||||
expect(flash[:alert]).to eq 'You are not authorized to access this page.'
|
||||
end
|
||||
|
||||
|
|
@ -94,7 +94,7 @@ describe Admin::VersionsController do
|
|||
conference.update_attributes(short_title: 'testtitle', description: 'Some random text')
|
||||
before_conference_title = conference.title
|
||||
# Note: even though title is a valid attribute of conference, it was not updated in the change we are trying to revert
|
||||
get :revert_attribute, id: PaperTrail::Version.last.id, attribute: 'title'
|
||||
get :revert_attribute, params: { id: PaperTrail::Version.last.id, attribute: 'title' }
|
||||
conference.reload
|
||||
expect(conference.short_title).to eq 'testtitle'
|
||||
expect(conference.description).to eq 'Some random text'
|
||||
|
|
@ -107,7 +107,7 @@ describe Admin::VersionsController do
|
|||
it 'raises error if user is not of any role' do
|
||||
user = create(:user)
|
||||
sign_in user
|
||||
get :index, conference_id: conference.short_title
|
||||
get :index, params: { conference_id: conference.short_title }
|
||||
expect(flash[:alert]).to match('You are not authorized to access this page.')
|
||||
end
|
||||
|
||||
|
|
@ -127,7 +127,7 @@ describe Admin::VersionsController do
|
|||
it 'when user has role cfp' do
|
||||
@user.roles = [role_cfp]
|
||||
sign_in @user
|
||||
get :index, conference_id: conference.short_title
|
||||
get :index, params: { conference_id: conference.short_title }
|
||||
|
||||
expect(assigns(:versions).include?(@version_cfp)).to eq true
|
||||
expect(assigns(:versions).include?(@version_organizer)).to eq false
|
||||
|
|
@ -136,7 +136,7 @@ describe Admin::VersionsController do
|
|||
it 'when user has role info_desk' do
|
||||
@user.roles = [role_info_desk]
|
||||
sign_in @user
|
||||
get :index, conference_id: conference.short_title
|
||||
get :index, params: { conference_id: conference.short_title }
|
||||
|
||||
expect(assigns(:versions).include?(@version_info_desk)).to eq true
|
||||
expect(assigns(:versions).include?(@version_organizer)).to eq false
|
||||
|
|
@ -146,7 +146,7 @@ describe Admin::VersionsController do
|
|||
it 'when user has role organizer' do
|
||||
@user.roles = [role_organizer]
|
||||
sign_in @user
|
||||
get :index, conference_id: conference.short_title
|
||||
get :index, params: { conference_id: conference.short_title }
|
||||
|
||||
expect(assigns(:versions).include?(@version_organizer)).to eq true
|
||||
expect(assigns(:versions).include?(@version_cfp)).to eq true
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue