Rubocop autocorrections

This commit is contained in:
James Mason 2018-11-13 18:01:49 -08:00
parent 299738f58d
commit 43bef689fc
85 changed files with 622 additions and 578 deletions

View file

@ -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))

View file

@ -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 }

View file

@ -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

View file

@ -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

View file

@ -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

View file

@ -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

View file

@ -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

View file

@ -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