Rebuild rubocop TODOs after auto-correcting
This commit is contained in:
parent
31c50255e9
commit
84dbb52d11
580 changed files with 3689 additions and 3133 deletions
|
|
@ -1,3 +1,5 @@
|
|||
# frozen_string_literal: true
|
||||
|
||||
require 'spec_helper'
|
||||
require 'cancan/matchers'
|
||||
|
||||
|
|
@ -6,8 +8,8 @@ describe 'User' do
|
|||
let!(:admin) { create(:admin) }
|
||||
|
||||
# see https://github.com/CanCanCommunity/cancancan/wiki/Testing-Abilities
|
||||
subject(:ability){ Ability.new(user) }
|
||||
let(:user){ nil }
|
||||
subject(:ability) { Ability.new(user) }
|
||||
let(:user) { nil }
|
||||
|
||||
let!(:organization) { create(:organization) }
|
||||
let!(:my_conference) { create(:full_conference, organization: organization) }
|
||||
|
|
@ -34,41 +36,41 @@ describe 'User' do
|
|||
|
||||
# Test abilities for not signed in users
|
||||
context 'when user is not signed in' do
|
||||
it{ should be_able_to(:index, Organization)}
|
||||
it{ should be_able_to(:index, Conference)}
|
||||
it { should be_able_to(:index, Organization) }
|
||||
it { should be_able_to(:index, Conference) }
|
||||
|
||||
it{ should be_able_to(:show, conference_public)}
|
||||
it{ should_not be_able_to(:show, conference_not_public)}
|
||||
it { should be_able_to(:show, conference_public) }
|
||||
it { should_not be_able_to(:show, conference_not_public) }
|
||||
|
||||
it do
|
||||
conference_public.program.schedule_public = true
|
||||
conference_public.program.save
|
||||
should be_able_to(:schedule, conference_public)
|
||||
end
|
||||
it{ should_not be_able_to(:schedule, conference_not_public)}
|
||||
it { should_not be_able_to(:schedule, conference_not_public) }
|
||||
|
||||
it{ should be_able_to(:show, event_confirmed)}
|
||||
it{ should_not be_able_to(:show, event_unconfirmed)}
|
||||
it { should be_able_to(:show, event_confirmed) }
|
||||
it { should_not be_able_to(:show, event_unconfirmed) }
|
||||
|
||||
it{ should be_able_to(:show, commercial_event_confirmed)}
|
||||
it{ should_not be_able_to(:show, commercial_event_unconfirmed)}
|
||||
it { should be_able_to(:show, commercial_event_confirmed) }
|
||||
it { should_not be_able_to(:show, commercial_event_unconfirmed) }
|
||||
|
||||
it{ should be_able_to(:show, User)}
|
||||
it{ should be_able_to(:create, User)}
|
||||
it { should be_able_to(:show, User) }
|
||||
it { should be_able_to(:create, User) }
|
||||
|
||||
it{ should be_able_to(:show, Registration.new)}
|
||||
it{ should be_able_to(:create, Registration.new(conference_id: conference_with_open_registration.id))}
|
||||
it{ should be_able_to(:new, Registration.new(conference_id: conference_with_open_registration.id))}
|
||||
it{ should_not be_able_to(:new, Registration.new(conference_id: conference_with_closed_registration.id))}
|
||||
it{ should_not be_able_to(:create, Registration.new(conference_id: conference_with_closed_registration.id))}
|
||||
it{ should_not be_able_to(:manage, registration)}
|
||||
it { should be_able_to(:show, Registration.new) }
|
||||
it { should be_able_to(:create, Registration.new(conference_id: conference_with_open_registration.id)) }
|
||||
it { should be_able_to(:new, Registration.new(conference_id: conference_with_open_registration.id)) }
|
||||
it { should_not be_able_to(:new, Registration.new(conference_id: conference_with_closed_registration.id)) }
|
||||
it { should_not be_able_to(:create, Registration.new(conference_id: conference_with_closed_registration.id)) }
|
||||
it { should_not be_able_to(:manage, registration) }
|
||||
|
||||
it{ should be_able_to(:new, Event.new(program: program_with_cfp)) }
|
||||
it{ should_not be_able_to(:new, Event.new(program: program_without_cfp)) }
|
||||
it{ should_not be_able_to(:create, Event.new(program: program_without_cfp))}
|
||||
it{ should be_able_to(:show, Event.new)}
|
||||
it { should be_able_to(:new, Event.new(program: program_with_cfp)) }
|
||||
it { should_not be_able_to(:new, Event.new(program: program_without_cfp)) }
|
||||
it { should_not be_able_to(:create, Event.new(program: program_without_cfp)) }
|
||||
it { should be_able_to(:show, Event.new) }
|
||||
|
||||
it{ should_not be_able_to(:manage, :any)}
|
||||
it { should_not be_able_to(:manage, :any) }
|
||||
end
|
||||
|
||||
# Test abilities for signed in users (without any role)
|
||||
|
|
@ -88,9 +90,9 @@ describe 'User' do
|
|||
let(:confirmed_user_self_organized_track) { create(:track, :self_organized, submitter: user, state: 'confirmed') }
|
||||
let(:other_self_organized_track) { create(:track, :self_organized) }
|
||||
|
||||
it{ should be_able_to(:manage, user) }
|
||||
it{ should be_able_to(:manage, registration_public) }
|
||||
it{ should be_able_to(:manage, registration_not_public) }
|
||||
it { should be_able_to(:manage, user) }
|
||||
it { should be_able_to(:manage, registration_public) }
|
||||
it { should be_able_to(:manage, registration_not_public) }
|
||||
|
||||
# Test for user can register or not
|
||||
context 'when user is not a speaker with event confirmed' do
|
||||
|
|
@ -101,13 +103,13 @@ describe 'User' do
|
|||
create(:registration_period, conference: conference, start_date: Date.current - 6.days, end_date: Date.current - 6.days)
|
||||
end
|
||||
|
||||
it{ should_not be_able_to(:new, Registration.new(conference: conference)) }
|
||||
it{ should_not be_able_to(:create, Registration.new(conference: conference)) }
|
||||
it { should_not be_able_to(:new, Registration.new(conference: conference)) }
|
||||
it { should_not be_able_to(:create, Registration.new(conference: conference)) }
|
||||
end
|
||||
|
||||
context 'when the registration period is not set' do
|
||||
it{ should_not be_able_to(:new, Registration.new(conference: conference)) }
|
||||
it{ should_not be_able_to(:create, Registration.new(conference: conference)) }
|
||||
it { should_not be_able_to(:new, Registration.new(conference: conference)) }
|
||||
it { should_not be_able_to(:create, Registration.new(conference: conference)) }
|
||||
end
|
||||
|
||||
context 'when user has already registered' do
|
||||
|
|
@ -115,8 +117,8 @@ describe 'User' do
|
|||
create(:registration, conference: conference, user: user)
|
||||
end
|
||||
|
||||
it{ should_not be_able_to(:new, Registration.new(conference: conference)) }
|
||||
it{ should_not be_able_to(:create, Registration.new(conference: conference)) }
|
||||
it { should_not be_able_to(:new, Registration.new(conference: conference)) }
|
||||
it { should_not be_able_to(:create, Registration.new(conference: conference)) }
|
||||
end
|
||||
|
||||
context 'when registrations are open' do
|
||||
|
|
@ -124,16 +126,16 @@ describe 'User' do
|
|||
create(:registration_period, conference: conference)
|
||||
end
|
||||
|
||||
it{ should be_able_to(:new, Registration.new(conference: conference)) }
|
||||
it{ should be_able_to(:create, Registration.new(conference: conference)) }
|
||||
it { should be_able_to(:new, Registration.new(conference: conference)) }
|
||||
it { should be_able_to(:create, Registration.new(conference: conference)) }
|
||||
|
||||
context 'when user has not registered with no registration_limit_exceeded' do
|
||||
before :each do
|
||||
conference.registration_limit = 1
|
||||
end
|
||||
|
||||
it{ should be_able_to(:new, Registration.new(conference: conference)) }
|
||||
it{ should be_able_to(:create, Registration.new(conference: conference)) }
|
||||
it { should be_able_to(:new, Registration.new(conference: conference)) }
|
||||
it { should be_able_to(:create, Registration.new(conference: conference)) }
|
||||
end
|
||||
|
||||
context 'when user has not registered with registration_limit_exceeded' do
|
||||
|
|
@ -142,8 +144,8 @@ describe 'User' do
|
|||
create(:registration, conference: conference, user: user2)
|
||||
end
|
||||
|
||||
it{ should_not be_able_to(:new, Registration.new(conference: conference)) }
|
||||
it{ should_not be_able_to(:create, Registration.new(conference: conference)) }
|
||||
it { should_not be_able_to(:new, Registration.new(conference: conference)) }
|
||||
it { should_not be_able_to(:create, Registration.new(conference: conference)) }
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
@ -157,8 +159,8 @@ describe 'User' do
|
|||
end
|
||||
|
||||
context 'when registration period is not set' do
|
||||
it{ should_not be_able_to(:new, Registration.new(conference: conference_with_speaker_confirmed)) }
|
||||
it{ should_not be_able_to(:create, Registration.new(conference: conference_with_speaker_confirmed)) }
|
||||
it { should_not be_able_to(:new, Registration.new(conference: conference_with_speaker_confirmed)) }
|
||||
it { should_not be_able_to(:create, Registration.new(conference: conference_with_speaker_confirmed)) }
|
||||
end
|
||||
|
||||
context 'when speaker has already registered' do
|
||||
|
|
@ -166,8 +168,8 @@ describe 'User' do
|
|||
create(:registration, conference: conference_with_speaker_confirmed, user: user)
|
||||
end
|
||||
|
||||
it{ should_not be_able_to(:new, Registration.new(conference: conference_with_speaker_confirmed)) }
|
||||
it{ should_not be_able_to(:create, Registration.new(conference: conference_with_speaker_confirmed)) }
|
||||
it { should_not be_able_to(:new, Registration.new(conference: conference_with_speaker_confirmed)) }
|
||||
it { should_not be_able_to(:create, Registration.new(conference: conference_with_speaker_confirmed)) }
|
||||
end
|
||||
|
||||
context 'when registration period is set' do
|
||||
|
|
@ -177,8 +179,8 @@ describe 'User' do
|
|||
|
||||
context 'when registrations are open' do
|
||||
context 'when speaker has not registered' do
|
||||
it{ should be_able_to(:new, Registration.new(conference: conference_with_speaker_confirmed)) }
|
||||
it{ should be_able_to(:create, Registration.new(conference: conference_with_speaker_confirmed)) }
|
||||
it { should be_able_to(:new, Registration.new(conference: conference_with_speaker_confirmed)) }
|
||||
it { should be_able_to(:create, Registration.new(conference: conference_with_speaker_confirmed)) }
|
||||
end
|
||||
|
||||
context 'when registration_limit_exceeded' do
|
||||
|
|
@ -187,8 +189,8 @@ describe 'User' do
|
|||
create(:registration, conference: conference_with_speaker_confirmed, user: user2)
|
||||
end
|
||||
|
||||
it{ should be_able_to(:new, Registration.new(conference: conference_with_speaker_confirmed)) }
|
||||
it{ should be_able_to(:create, Registration.new(conference: conference_with_speaker_confirmed)) }
|
||||
it { should be_able_to(:new, Registration.new(conference: conference_with_speaker_confirmed)) }
|
||||
it { should be_able_to(:create, Registration.new(conference: conference_with_speaker_confirmed)) }
|
||||
end
|
||||
end
|
||||
|
||||
|
|
@ -198,8 +200,8 @@ describe 'User' do
|
|||
end
|
||||
|
||||
context 'when speaker has not registered' do
|
||||
it{ should be_able_to(:new, Registration.new(conference: conference_with_speaker_confirmed)) }
|
||||
it{ should be_able_to(:create, Registration.new(conference: conference_with_speaker_confirmed)) }
|
||||
it { should be_able_to(:new, Registration.new(conference: conference_with_speaker_confirmed)) }
|
||||
it { should be_able_to(:create, Registration.new(conference: conference_with_speaker_confirmed)) }
|
||||
end
|
||||
|
||||
context 'with registration_limit_exceeded' do
|
||||
|
|
@ -208,61 +210,61 @@ describe 'User' do
|
|||
create(:registration, conference: conference_with_speaker_confirmed, user: user2)
|
||||
end
|
||||
|
||||
it{ should be_able_to(:new, Registration.new(conference: conference_with_speaker_confirmed)) }
|
||||
it{ should be_able_to(:create, Registration.new(conference: conference_with_speaker_confirmed)) }
|
||||
it { should be_able_to(:new, Registration.new(conference: conference_with_speaker_confirmed)) }
|
||||
it { should be_able_to(:create, Registration.new(conference: conference_with_speaker_confirmed)) }
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
it{ should be_able_to(:index, Ticket) }
|
||||
it{ should be_able_to(:manage, TicketPurchase.new(user_id: user.id)) }
|
||||
it { should be_able_to(:index, Ticket) }
|
||||
it { should be_able_to(:manage, TicketPurchase.new(user_id: user.id)) }
|
||||
|
||||
it{ should be_able_to(:new, Payment.new(user_id: user.id)) }
|
||||
it{ should be_able_to(:create, Payment.new(user_id: user.id)) }
|
||||
it { should be_able_to(:new, Payment.new(user_id: user.id)) }
|
||||
it { should be_able_to(:create, Payment.new(user_id: user.id)) }
|
||||
|
||||
it{ should be_able_to(:create, Subscription.new(user_id: user.id)) }
|
||||
it{ should be_able_to(:destroy, subscription) }
|
||||
it { should be_able_to(:create, Subscription.new(user_id: user.id)) }
|
||||
it { should be_able_to(:destroy, subscription) }
|
||||
|
||||
it{ should be_able_to(:update, user_event_with_cfp) }
|
||||
it{ should be_able_to(:show, user_event_with_cfp) }
|
||||
it{ should_not be_able_to(:new, Event.new(program: program_without_cfp)) }
|
||||
it{ should_not be_able_to(:create, Event.new(program: program_without_cfp)) }
|
||||
it { should be_able_to(:update, user_event_with_cfp) }
|
||||
it { should be_able_to(:show, user_event_with_cfp) }
|
||||
it { should_not be_able_to(:new, Event.new(program: program_without_cfp)) }
|
||||
it { should_not be_able_to(:create, Event.new(program: program_without_cfp)) }
|
||||
# TODO: At moment it's not possible to manually add someone else as event_user
|
||||
# This needs some more work once we allow user to add event_user
|
||||
it 'should_not be_able to :new, Event.new(program: program_with_cfp, event_users: [event_user2])'
|
||||
it 'should_not be_able to :create, Event.new(program: program_with_cfp, event_users: [event_user2])'
|
||||
|
||||
it{ should_not be_able_to(:manage, event_unconfirmed) }
|
||||
it { should_not be_able_to(:manage, event_unconfirmed) }
|
||||
|
||||
it{ should be_able_to(:create, user_event_with_cfp.commercials.new) }
|
||||
it{ should be_able_to(:manage, user_commercial) }
|
||||
it{ should_not be_able_to(:manage, commercial_event_unconfirmed) }
|
||||
it { should be_able_to(:create, user_event_with_cfp.commercials.new) }
|
||||
it { should be_able_to(:manage, user_commercial) }
|
||||
it { should_not be_able_to(:manage, commercial_event_unconfirmed) }
|
||||
|
||||
it{ should be_able_to(:new, Track.new(program: program_with_call_for_tracks)) }
|
||||
it{ should be_able_to(:create, Track.new(program: program_with_call_for_tracks)) }
|
||||
it{ should_not be_able_to(:new, Track.new(program: program_without_cfp)) }
|
||||
it{ should_not be_able_to(:create, Track.new(program: program_without_cfp)) }
|
||||
it { should be_able_to(:new, Track.new(program: program_with_call_for_tracks)) }
|
||||
it { should be_able_to(:create, Track.new(program: program_with_call_for_tracks)) }
|
||||
it { should_not be_able_to(:new, Track.new(program: program_without_cfp)) }
|
||||
it { should_not be_able_to(:create, Track.new(program: program_without_cfp)) }
|
||||
|
||||
it{ should be_able_to(:index, user_self_organized_track) }
|
||||
it{ should be_able_to(:show, user_self_organized_track) }
|
||||
it{ should be_able_to(:restart, user_self_organized_track) }
|
||||
it{ should be_able_to(:confirm, user_self_organized_track) }
|
||||
it{ should be_able_to(:withdraw, user_self_organized_track) }
|
||||
it{ should_not be_able_to(:index, other_self_organized_track) }
|
||||
it{ should_not be_able_to(:show, other_self_organized_track) }
|
||||
it{ should_not be_able_to(:restart, other_self_organized_track) }
|
||||
it{ should_not be_able_to(:confirm, other_self_organized_track) }
|
||||
it{ should_not be_able_to(:withdraw, other_self_organized_track) }
|
||||
it { should be_able_to(:index, user_self_organized_track) }
|
||||
it { should be_able_to(:show, user_self_organized_track) }
|
||||
it { should be_able_to(:restart, user_self_organized_track) }
|
||||
it { should be_able_to(:confirm, user_self_organized_track) }
|
||||
it { should be_able_to(:withdraw, user_self_organized_track) }
|
||||
it { should_not be_able_to(:index, other_self_organized_track) }
|
||||
it { should_not be_able_to(:show, other_self_organized_track) }
|
||||
it { should_not be_able_to(:restart, other_self_organized_track) }
|
||||
it { should_not be_able_to(:confirm, other_self_organized_track) }
|
||||
it { should_not be_able_to(:withdraw, other_self_organized_track) }
|
||||
|
||||
it{ should be_able_to(:edit, user_self_organized_track) }
|
||||
it{ should be_able_to(:update, user_self_organized_track) }
|
||||
it{ should_not be_able_to(:edit, accepted_user_self_organized_track) }
|
||||
it{ should_not be_able_to(:update, accepted_user_self_organized_track) }
|
||||
it{ should_not be_able_to(:edit, confirmed_user_self_organized_track) }
|
||||
it{ should_not be_able_to(:update, confirmed_user_self_organized_track) }
|
||||
it{ should_not be_able_to(:edit, other_self_organized_track) }
|
||||
it{ should_not be_able_to(:update, other_self_organized_track) }
|
||||
it { should be_able_to(:edit, user_self_organized_track) }
|
||||
it { should be_able_to(:update, user_self_organized_track) }
|
||||
it { should_not be_able_to(:edit, accepted_user_self_organized_track) }
|
||||
it { should_not be_able_to(:update, accepted_user_self_organized_track) }
|
||||
it { should_not be_able_to(:edit, confirmed_user_self_organized_track) }
|
||||
it { should_not be_able_to(:update, confirmed_user_self_organized_track) }
|
||||
it { should_not be_able_to(:edit, other_self_organized_track) }
|
||||
it { should_not be_able_to(:update, other_self_organized_track) }
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue