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
|
||||
|
|
|
|||
|
|
@ -1,3 +1,5 @@
|
|||
# frozen_string_literal: true
|
||||
|
||||
require 'spec_helper'
|
||||
require 'cancan/matchers'
|
||||
|
||||
|
|
@ -6,8 +8,8 @@ describe 'User with admin role' do
|
|||
let!(:admin) { create(:admin) }
|
||||
|
||||
# see https://github.com/CanCanCommunity/cancancan/wiki/Testing-Abilities
|
||||
subject(:ability){ AdminAbility.new(user) }
|
||||
let(:user){ nil }
|
||||
subject(:ability) { AdminAbility.new(user) }
|
||||
let(:user) { nil }
|
||||
|
||||
let!(:organization) { create(:organization) }
|
||||
let!(:my_conference) { create(:full_conference, organization: organization) }
|
||||
|
|
@ -52,29 +54,29 @@ describe 'User with admin role' do
|
|||
let(:room) { create(:room, venue: venue) }
|
||||
let!(:event) { create(:event_full, program: my_conference.program, room_id: room.id) }
|
||||
let(:user) { create(:admin) }
|
||||
it{ should be_able_to(:manage, :all) }
|
||||
it{ should_not be_able_to(:destroy, my_conference.program) }
|
||||
it{ should_not be_able_to(:destroy, my_venue) }
|
||||
it { should be_able_to(:manage, :all) }
|
||||
it { should_not be_able_to(:destroy, my_conference.program) }
|
||||
it { should_not be_able_to(:destroy, my_venue) }
|
||||
end
|
||||
|
||||
shared_examples 'user with any role' do
|
||||
let!(:other_organization) { create(:organization) }
|
||||
let!(:other_conference) { create(:conference, organization: other_organization) }
|
||||
|
||||
it{ should_not be_able_to(:update, Role.find_by(name: 'organization_admin', resource: other_organization)) }
|
||||
it{ should_not be_able_to(:edit, Role.find_by(name: 'organization_admin', resource: other_organization)) }
|
||||
it{ should be_able_to(:admins, organization) }
|
||||
it { should_not be_able_to(:update, Role.find_by(name: 'organization_admin', resource: other_organization)) }
|
||||
it { should_not be_able_to(:edit, Role.find_by(name: 'organization_admin', resource: other_organization)) }
|
||||
it { should be_able_to(:admins, organization) }
|
||||
|
||||
it{ should_not be_able_to(:new, User.new) }
|
||||
it{ should_not be_able_to(:create, User.new) }
|
||||
it{ should_not be_able_to(:manage, User) }
|
||||
it { should_not be_able_to(:new, User.new) }
|
||||
it { should_not be_able_to(:create, User.new) }
|
||||
it { should_not be_able_to(:manage, User) }
|
||||
|
||||
%w[organizer cfp info_desk volunteers_coordinator].each do |role|
|
||||
it{ should_not be_able_to(:toggle_user, Role.find_by(name: role, resource: other_conference)) }
|
||||
it{ should_not be_able_to(:update, Role.find_by(name: role, resource: other_conference)) }
|
||||
it{ should_not be_able_to(:edit, Role.find_by(name: role, resource: other_conference)) }
|
||||
it{ should be_able_to(:show, Role.find_by(name: role, resource: other_conference)) }
|
||||
it{ should be_able_to(:index, Role.find_by(name: role, resource: other_conference)) }
|
||||
it { should_not be_able_to(:toggle_user, Role.find_by(name: role, resource: other_conference)) }
|
||||
it { should_not be_able_to(:update, Role.find_by(name: role, resource: other_conference)) }
|
||||
it { should_not be_able_to(:edit, Role.find_by(name: role, resource: other_conference)) }
|
||||
it { should be_able_to(:show, Role.find_by(name: role, resource: other_conference)) }
|
||||
it { should be_able_to(:index, Role.find_by(name: role, resource: other_conference)) }
|
||||
end
|
||||
|
||||
context 'accesses track organizers' do
|
||||
|
|
@ -83,25 +85,25 @@ describe 'User with admin role' do
|
|||
@other_track_organizer_role = Role.where(name: 'track_organizer', resource: other_self_organized_track).first_or_create
|
||||
end
|
||||
|
||||
it{ should_not be_able_to(:toggle_user, @other_track_organizer_role) }
|
||||
it{ should_not be_able_to(:update, @other_track_organizer_role) }
|
||||
it{ should_not be_able_to(:edit, @other_track_organizer_role) }
|
||||
it{ should be_able_to(:show, @other_track_organizer_role) }
|
||||
it{ should be_able_to(:index, @other_track_organizer_role) }
|
||||
it { should_not be_able_to(:toggle_user, @other_track_organizer_role) }
|
||||
it { should_not be_able_to(:update, @other_track_organizer_role) }
|
||||
it { should_not be_able_to(:edit, @other_track_organizer_role) }
|
||||
it { should be_able_to(:show, @other_track_organizer_role) }
|
||||
it { should be_able_to(:index, @other_track_organizer_role) }
|
||||
end
|
||||
end
|
||||
|
||||
shared_examples 'user with non-organizer role' do |role_name|
|
||||
%w[organizer cfp info_desk volunteers_coordinator].each do |role|
|
||||
if role == role_name
|
||||
it{ should be_able_to(:toggle_user, Role.find_by(name: role, resource: my_conference)) }
|
||||
it { should be_able_to(:toggle_user, Role.find_by(name: role, resource: my_conference)) }
|
||||
else
|
||||
it{ should_not be_able_to(:toggle_user, Role.find_by(name: role, resource: my_conference)) }
|
||||
it { should_not be_able_to(:toggle_user, Role.find_by(name: role, resource: my_conference)) }
|
||||
end
|
||||
it{ should_not be_able_to(:update, Role.find_by(name: role, resource: my_conference)) }
|
||||
it{ should_not be_able_to(:edit, Role.find_by(name: role, resource: my_conference)) }
|
||||
it{ should be_able_to(:show, Role.find_by(name: role, resource: my_conference)) }
|
||||
it{ should be_able_to(:index, Role.find_by(name: role, resource: my_conference)) }
|
||||
it { should_not be_able_to(:update, Role.find_by(name: role, resource: my_conference)) }
|
||||
it { should_not be_able_to(:edit, Role.find_by(name: role, resource: my_conference)) }
|
||||
it { should be_able_to(:show, Role.find_by(name: role, resource: my_conference)) }
|
||||
it { should be_able_to(:index, Role.find_by(name: role, resource: my_conference)) }
|
||||
end
|
||||
|
||||
context 'accesses track organizers' do
|
||||
|
|
@ -110,14 +112,14 @@ describe 'User with admin role' do
|
|||
end
|
||||
|
||||
if role_name == 'track_organizer'
|
||||
it{ should be_able_to(:toggle_user, @track_organizer_role) }
|
||||
it { should be_able_to(:toggle_user, @track_organizer_role) }
|
||||
else
|
||||
it{ should_not be_able_to(:toggle_user, @track_organizer_role) }
|
||||
it { should_not be_able_to(:toggle_user, @track_organizer_role) }
|
||||
end
|
||||
it{ should_not be_able_to(:update, @track_organizer_role) }
|
||||
it{ should_not be_able_to(:edit, @track_organizer_role) }
|
||||
it{ should be_able_to(:show, @track_organizer_role) }
|
||||
it{ should be_able_to(:index, @track_organizer_role) }
|
||||
it { should_not be_able_to(:update, @track_organizer_role) }
|
||||
it { should_not be_able_to(:edit, @track_organizer_role) }
|
||||
it { should be_able_to(:show, @track_organizer_role) }
|
||||
it { should be_able_to(:index, @track_organizer_role) }
|
||||
end
|
||||
end
|
||||
|
||||
|
|
@ -127,18 +129,18 @@ describe 'User with admin role' do
|
|||
let(:other_organization) { create(:organization) }
|
||||
let(:other_conference) { create(:conference, organization: other_organization) }
|
||||
|
||||
it{ should be_able_to(:assign_org_admins, organization) }
|
||||
it{ should be_able_to(:unassign_org_admins, organization) }
|
||||
it{ should be_able_to(:manage, my_conference) }
|
||||
it{ should be_able_to(:read, organization) }
|
||||
it{ should be_able_to(:update, organization) }
|
||||
it{ should be_able_to(:destroy, organization) }
|
||||
it{ should be_able_to(:new, Conference.new) }
|
||||
it{ should be_able_to(:create, Conference.new(organization_id: organization.id)) }
|
||||
it{ should_not be_able_to(:manage, other_conference) }
|
||||
it{ should_not be_able_to(:create, Conference.new(organization_id: other_organization.id)) }
|
||||
it{ should_not be_able_to(:new, Organization.new) }
|
||||
it{ should_not be_able_to(:create, Organization.new) }
|
||||
it { should be_able_to(:assign_org_admins, organization) }
|
||||
it { should be_able_to(:unassign_org_admins, organization) }
|
||||
it { should be_able_to(:manage, my_conference) }
|
||||
it { should be_able_to(:read, organization) }
|
||||
it { should be_able_to(:update, organization) }
|
||||
it { should be_able_to(:destroy, organization) }
|
||||
it { should be_able_to(:new, Conference.new) }
|
||||
it { should be_able_to(:create, Conference.new(organization_id: organization.id)) }
|
||||
it { should_not be_able_to(:manage, other_conference) }
|
||||
it { should_not be_able_to(:create, Conference.new(organization_id: other_organization.id)) }
|
||||
it { should_not be_able_to(:new, Organization.new) }
|
||||
it { should_not be_able_to(:create, Organization.new) }
|
||||
|
||||
it_behaves_like 'user with any role'
|
||||
end
|
||||
|
|
@ -147,7 +149,7 @@ describe 'User with admin role' do
|
|||
let(:role) { Role.find_by(name: 'organizer', resource: my_conference) }
|
||||
let(:user) { create(:user, role_ids: [role.id]) }
|
||||
|
||||
it{ should_not be_able_to(:destroy, my_conference.program) }
|
||||
it { should_not be_able_to(:destroy, my_conference.program) }
|
||||
it 'when there is a room assigned to an event' do
|
||||
should_not be_able_to(:destroy, my_venue)
|
||||
end
|
||||
|
|
@ -159,74 +161,74 @@ describe 'User with admin role' do
|
|||
should be_able_to(:destroy, my_venue)
|
||||
end
|
||||
|
||||
it{ should_not be_able_to(:new, Organization.new) }
|
||||
it{ should_not be_able_to(:create, Organization.new) }
|
||||
it{ should_not be_able_to(:new, Conference.new) }
|
||||
it{ should_not be_able_to(:create, Conference.new) }
|
||||
it{ should be_able_to(:read, my_conference) }
|
||||
it{ should be_able_to(:update, my_conference) }
|
||||
it{ should be_able_to(:destroy, my_conference) }
|
||||
it{ should_not be_able_to(:manage, conference_public) }
|
||||
it{ should be_able_to(:manage, my_conference.splashpage) }
|
||||
it{ should_not be_able_to(:manage, conference_public.splashpage) }
|
||||
it{ should be_able_to(:manage, my_conference.contact) }
|
||||
it{ should_not be_able_to(:manage, conference_public.contact) }
|
||||
it{ should be_able_to(:manage, my_conference.email_settings) }
|
||||
it{ should_not be_able_to(:manage, conference_public.email_settings) }
|
||||
it{ should be_able_to(:manage, my_conference.campaigns.first) }
|
||||
it{ should_not be_able_to(:manage, conference_public.campaigns.first) }
|
||||
it{ should be_able_to(:manage, my_conference.targets.first) }
|
||||
it{ should_not be_able_to(:manage, conference_public.targets.first) }
|
||||
it{ should be_able_to(:manage, my_conference.commercials.first) }
|
||||
it{ should_not be_able_to(:manage, conference_public.commercials.first) }
|
||||
it{ should be_able_to(:manage, my_conference.registration_period) }
|
||||
it{ should_not be_able_to(:manage, conference_public.registration_period) }
|
||||
it{ should be_able_to(:manage, my_conference.questions.first) }
|
||||
it{ should_not be_able_to(:manage, conference_public.questions.first) }
|
||||
it{ should be_able_to(:manage, my_conference.program.cfp) }
|
||||
it{ should_not be_able_to(:manage, conference_public.program.cfp) }
|
||||
it{ should be_able_to(:manage, my_schedule) }
|
||||
it{ should_not be_able_to(:manage, other_schedule) }
|
||||
it{ should be_able_to(:manage, my_event_schedule) }
|
||||
it{ should_not be_able_to(:manage, other_event_schedule) }
|
||||
it{ should be_able_to(:manage, my_conference.venue) }
|
||||
it{ should_not be_able_to(:manage, conference_public.venue) }
|
||||
it{ should be_able_to(:manage, my_conference.lodgings.first) }
|
||||
it{ should_not be_able_to(:manage, conference_public.lodgings.first) }
|
||||
it{ should be_able_to(:manage, my_conference.sponsors.first) }
|
||||
it{ should_not be_able_to(:manage, conference_public.sponsors.first) }
|
||||
it{ should be_able_to(:manage, my_conference.sponsorship_levels.first) }
|
||||
it{ should_not be_able_to(:manage, conference_public.sponsorship_levels.first) }
|
||||
it{ should be_able_to(:manage, my_conference.tickets.first) }
|
||||
it{ should_not be_able_to(:manage, conference_public.tickets.first) }
|
||||
it { should_not be_able_to(:new, Organization.new) }
|
||||
it { should_not be_able_to(:create, Organization.new) }
|
||||
it { should_not be_able_to(:new, Conference.new) }
|
||||
it { should_not be_able_to(:create, Conference.new) }
|
||||
it { should be_able_to(:read, my_conference) }
|
||||
it { should be_able_to(:update, my_conference) }
|
||||
it { should be_able_to(:destroy, my_conference) }
|
||||
it { should_not be_able_to(:manage, conference_public) }
|
||||
it { should be_able_to(:manage, my_conference.splashpage) }
|
||||
it { should_not be_able_to(:manage, conference_public.splashpage) }
|
||||
it { should be_able_to(:manage, my_conference.contact) }
|
||||
it { should_not be_able_to(:manage, conference_public.contact) }
|
||||
it { should be_able_to(:manage, my_conference.email_settings) }
|
||||
it { should_not be_able_to(:manage, conference_public.email_settings) }
|
||||
it { should be_able_to(:manage, my_conference.campaigns.first) }
|
||||
it { should_not be_able_to(:manage, conference_public.campaigns.first) }
|
||||
it { should be_able_to(:manage, my_conference.targets.first) }
|
||||
it { should_not be_able_to(:manage, conference_public.targets.first) }
|
||||
it { should be_able_to(:manage, my_conference.commercials.first) }
|
||||
it { should_not be_able_to(:manage, conference_public.commercials.first) }
|
||||
it { should be_able_to(:manage, my_conference.registration_period) }
|
||||
it { should_not be_able_to(:manage, conference_public.registration_period) }
|
||||
it { should be_able_to(:manage, my_conference.questions.first) }
|
||||
it { should_not be_able_to(:manage, conference_public.questions.first) }
|
||||
it { should be_able_to(:manage, my_conference.program.cfp) }
|
||||
it { should_not be_able_to(:manage, conference_public.program.cfp) }
|
||||
it { should be_able_to(:manage, my_schedule) }
|
||||
it { should_not be_able_to(:manage, other_schedule) }
|
||||
it { should be_able_to(:manage, my_event_schedule) }
|
||||
it { should_not be_able_to(:manage, other_event_schedule) }
|
||||
it { should be_able_to(:manage, my_conference.venue) }
|
||||
it { should_not be_able_to(:manage, conference_public.venue) }
|
||||
it { should be_able_to(:manage, my_conference.lodgings.first) }
|
||||
it { should_not be_able_to(:manage, conference_public.lodgings.first) }
|
||||
it { should be_able_to(:manage, my_conference.sponsors.first) }
|
||||
it { should_not be_able_to(:manage, conference_public.sponsors.first) }
|
||||
it { should be_able_to(:manage, my_conference.sponsorship_levels.first) }
|
||||
it { should_not be_able_to(:manage, conference_public.sponsorship_levels.first) }
|
||||
it { should be_able_to(:manage, my_conference.tickets.first) }
|
||||
it { should_not be_able_to(:manage, conference_public.tickets.first) }
|
||||
|
||||
it{ should be_able_to(:manage, my_registration) }
|
||||
it{ should_not be_able_to(:manage, other_registration) }
|
||||
it { should be_able_to(:manage, my_registration) }
|
||||
it { should_not be_able_to(:manage, other_registration) }
|
||||
|
||||
it{ should be_able_to(:manage, my_event) }
|
||||
it{ should_not be_able_to(:manage, other_event) }
|
||||
it{ should be_able_to(:manage, my_event.event_type) }
|
||||
it{ should_not be_able_to(:manage, other_event.event_type) }
|
||||
it{ should be_able_to(:manage, my_event.track) }
|
||||
it{ should_not be_able_to(:manage, other_event.track) }
|
||||
it{ should be_able_to(:manage, my_event.difficulty_level) }
|
||||
it{ should_not be_able_to(:manage, other_event.difficulty_level) }
|
||||
it{ should be_able_to(:manage, my_event.commercials.first) }
|
||||
it{ should_not be_able_to(:manage, other_event.commercials.first) }
|
||||
it{ should be_able_to(:index, my_event.comment_threads.first) }
|
||||
it{ should_not be_able_to(:index, other_event.comment_threads.first) }
|
||||
it { should be_able_to(:manage, my_event) }
|
||||
it { should_not be_able_to(:manage, other_event) }
|
||||
it { should be_able_to(:manage, my_event.event_type) }
|
||||
it { should_not be_able_to(:manage, other_event.event_type) }
|
||||
it { should be_able_to(:manage, my_event.track) }
|
||||
it { should_not be_able_to(:manage, other_event.track) }
|
||||
it { should be_able_to(:manage, my_event.difficulty_level) }
|
||||
it { should_not be_able_to(:manage, other_event.difficulty_level) }
|
||||
it { should be_able_to(:manage, my_event.commercials.first) }
|
||||
it { should_not be_able_to(:manage, other_event.commercials.first) }
|
||||
it { should be_able_to(:index, my_event.comment_threads.first) }
|
||||
it { should_not be_able_to(:index, other_event.comment_threads.first) }
|
||||
|
||||
it{ should be_able_to(:manage, resource) }
|
||||
it { should be_able_to(:manage, resource) }
|
||||
|
||||
it{ should_not be_able_to(:assign_org_admins, organization) }
|
||||
it{ should_not be_able_to(:unassign_org_admins, organization) }
|
||||
it { should_not be_able_to(:assign_org_admins, organization) }
|
||||
it { should_not be_able_to(:unassign_org_admins, organization) }
|
||||
|
||||
%w[organizer cfp info_desk volunteers_coordinator].each do |role|
|
||||
it{ should be_able_to(:toggle_user, Role.find_by(name: role, resource: my_conference)) }
|
||||
it{ should be_able_to(:edit, Role.find_by(name: role, resource: my_conference)) }
|
||||
it{ should be_able_to(:update, Role.find_by(name: role, resource: my_conference)) }
|
||||
it{ should be_able_to(:show, Role.find_by(name: role, resource: my_conference)) }
|
||||
it{ should be_able_to(:index, Role.find_by(name: role, resource: my_conference)) }
|
||||
it { should be_able_to(:toggle_user, Role.find_by(name: role, resource: my_conference)) }
|
||||
it { should be_able_to(:edit, Role.find_by(name: role, resource: my_conference)) }
|
||||
it { should be_able_to(:update, Role.find_by(name: role, resource: my_conference)) }
|
||||
it { should be_able_to(:show, Role.find_by(name: role, resource: my_conference)) }
|
||||
it { should be_able_to(:index, Role.find_by(name: role, resource: my_conference)) }
|
||||
end
|
||||
|
||||
context 'can manage track organizers' do
|
||||
|
|
@ -234,11 +236,11 @@ describe 'User with admin role' do
|
|||
@track_organizer_role = Role.where(name: 'track_organizer', resource: my_self_organized_track).first_or_create
|
||||
end
|
||||
|
||||
it{ should be_able_to(:toggle_user, @track_organizer_role) }
|
||||
it{ should be_able_to(:edit, @track_organizer_role) }
|
||||
it{ should be_able_to(:update, @track_organizer_role) }
|
||||
it{ should be_able_to(:show, @track_organizer_role) }
|
||||
it{ should be_able_to(:index, @track_organizer_role) }
|
||||
it { should be_able_to(:toggle_user, @track_organizer_role) }
|
||||
it { should be_able_to(:edit, @track_organizer_role) }
|
||||
it { should be_able_to(:update, @track_organizer_role) }
|
||||
it { should be_able_to(:show, @track_organizer_role) }
|
||||
it { should be_able_to(:index, @track_organizer_role) }
|
||||
end
|
||||
|
||||
it_behaves_like 'user with any role'
|
||||
|
|
@ -248,66 +250,66 @@ describe 'User with admin role' do
|
|||
let(:role) { Role.find_by(name: 'cfp', resource: my_conference) }
|
||||
let(:user) { create(:user, role_ids: [role.id]) }
|
||||
|
||||
it{ should_not be_able_to(:new, Conference.new) }
|
||||
it{ should_not be_able_to(:create, Conference.new) }
|
||||
it{ should_not be_able_to(:manage, my_conference) }
|
||||
it{ should_not be_able_to(:manage, conference_public) }
|
||||
it{ should_not be_able_to(:manage, my_conference.splashpage) }
|
||||
it{ should_not be_able_to(:manage, conference_public.splashpage) }
|
||||
it{ should_not be_able_to(:manage, my_conference.contact) }
|
||||
it{ should_not be_able_to(:manage, conference_public.contact) }
|
||||
it{ should be_able_to(:manage, my_conference.email_settings) }
|
||||
it{ should_not be_able_to(:manage, conference_public.email_settings) }
|
||||
it{ should_not be_able_to(:manage, my_conference.campaigns.first) }
|
||||
it{ should_not be_able_to(:manage, conference_public.campaigns.first) }
|
||||
it{ should_not be_able_to(:manage, my_conference.targets.first) }
|
||||
it{ should_not be_able_to(:manage, conference_public.targets.first) }
|
||||
it{ should_not be_able_to(:manage, my_conference.commercials.first) }
|
||||
it{ should_not be_able_to(:manage, conference_public.commercials.first) }
|
||||
it{ should_not be_able_to(:manage, my_conference.registration_period) }
|
||||
it{ should_not be_able_to(:manage, conference_public.registration_period) }
|
||||
it{ should_not be_able_to(:manage, my_conference.questions.first) }
|
||||
it{ should_not be_able_to(:manage, conference_public.questions.first) }
|
||||
it{ should be_able_to(:manage, my_conference.program.cfp) }
|
||||
it{ should_not be_able_to(:manage, conference_public.program.cfp) }
|
||||
it{ should be_able_to(:manage, my_schedule) }
|
||||
it{ should_not be_able_to(:manage, other_schedule) }
|
||||
it{ should_not be_able_to(:manage, my_event_schedule) }
|
||||
it{ should_not be_able_to(:manage, other_event_schedule) }
|
||||
it{ should_not be_able_to(:manage, my_conference.venue) }
|
||||
it{ should be_able_to(:show, my_conference.venue) }
|
||||
it{ should_not be_able_to(:manage, conference_public.venue) }
|
||||
it{ should_not be_able_to(:manage, my_conference.lodgings.first) }
|
||||
it{ should_not be_able_to(:manage, conference_public.lodgings.first) }
|
||||
it{ should_not be_able_to(:manage, my_conference.sponsors.first) }
|
||||
it{ should_not be_able_to(:manage, conference_public.sponsors.first) }
|
||||
it{ should_not be_able_to(:manage, my_conference.sponsorship_levels.first) }
|
||||
it{ should_not be_able_to(:manage, conference_public.sponsorship_levels.first) }
|
||||
it{ should_not be_able_to(:manage, my_conference.tickets.first) }
|
||||
it{ should_not be_able_to(:manage, conference_public.tickets.first) }
|
||||
it { should_not be_able_to(:new, Conference.new) }
|
||||
it { should_not be_able_to(:create, Conference.new) }
|
||||
it { should_not be_able_to(:manage, my_conference) }
|
||||
it { should_not be_able_to(:manage, conference_public) }
|
||||
it { should_not be_able_to(:manage, my_conference.splashpage) }
|
||||
it { should_not be_able_to(:manage, conference_public.splashpage) }
|
||||
it { should_not be_able_to(:manage, my_conference.contact) }
|
||||
it { should_not be_able_to(:manage, conference_public.contact) }
|
||||
it { should be_able_to(:manage, my_conference.email_settings) }
|
||||
it { should_not be_able_to(:manage, conference_public.email_settings) }
|
||||
it { should_not be_able_to(:manage, my_conference.campaigns.first) }
|
||||
it { should_not be_able_to(:manage, conference_public.campaigns.first) }
|
||||
it { should_not be_able_to(:manage, my_conference.targets.first) }
|
||||
it { should_not be_able_to(:manage, conference_public.targets.first) }
|
||||
it { should_not be_able_to(:manage, my_conference.commercials.first) }
|
||||
it { should_not be_able_to(:manage, conference_public.commercials.first) }
|
||||
it { should_not be_able_to(:manage, my_conference.registration_period) }
|
||||
it { should_not be_able_to(:manage, conference_public.registration_period) }
|
||||
it { should_not be_able_to(:manage, my_conference.questions.first) }
|
||||
it { should_not be_able_to(:manage, conference_public.questions.first) }
|
||||
it { should be_able_to(:manage, my_conference.program.cfp) }
|
||||
it { should_not be_able_to(:manage, conference_public.program.cfp) }
|
||||
it { should be_able_to(:manage, my_schedule) }
|
||||
it { should_not be_able_to(:manage, other_schedule) }
|
||||
it { should_not be_able_to(:manage, my_event_schedule) }
|
||||
it { should_not be_able_to(:manage, other_event_schedule) }
|
||||
it { should_not be_able_to(:manage, my_conference.venue) }
|
||||
it { should be_able_to(:show, my_conference.venue) }
|
||||
it { should_not be_able_to(:manage, conference_public.venue) }
|
||||
it { should_not be_able_to(:manage, my_conference.lodgings.first) }
|
||||
it { should_not be_able_to(:manage, conference_public.lodgings.first) }
|
||||
it { should_not be_able_to(:manage, my_conference.sponsors.first) }
|
||||
it { should_not be_able_to(:manage, conference_public.sponsors.first) }
|
||||
it { should_not be_able_to(:manage, my_conference.sponsorship_levels.first) }
|
||||
it { should_not be_able_to(:manage, conference_public.sponsorship_levels.first) }
|
||||
it { should_not be_able_to(:manage, my_conference.tickets.first) }
|
||||
it { should_not be_able_to(:manage, conference_public.tickets.first) }
|
||||
|
||||
it{ should_not be_able_to(:manage, my_registration) }
|
||||
it{ should_not be_able_to(:manage, other_registration) }
|
||||
it { should_not be_able_to(:manage, my_registration) }
|
||||
it { should_not be_able_to(:manage, other_registration) }
|
||||
|
||||
it{ should be_able_to(:manage, my_event) }
|
||||
it{ should_not be_able_to(:manage, other_event) }
|
||||
it{ should be_able_to(:manage, my_event.event_type) }
|
||||
it{ should_not be_able_to(:manage, other_event.event_type) }
|
||||
it{ should be_able_to(:manage, my_event.track) }
|
||||
it{ should_not be_able_to(:manage, other_event.track) }
|
||||
it{ should be_able_to(:manage, my_event.difficulty_level) }
|
||||
it{ should_not be_able_to(:manage, other_event.difficulty_level) }
|
||||
it{ should be_able_to(:manage, my_event.commercials.first) }
|
||||
it{ should_not be_able_to(:manage, other_event.commercials.first) }
|
||||
it{ should be_able_to(:index, my_event.comment_threads.first) }
|
||||
it{ should_not be_able_to(:index, other_event.comment_threads.first) }
|
||||
it { should be_able_to(:manage, my_event) }
|
||||
it { should_not be_able_to(:manage, other_event) }
|
||||
it { should be_able_to(:manage, my_event.event_type) }
|
||||
it { should_not be_able_to(:manage, other_event.event_type) }
|
||||
it { should be_able_to(:manage, my_event.track) }
|
||||
it { should_not be_able_to(:manage, other_event.track) }
|
||||
it { should be_able_to(:manage, my_event.difficulty_level) }
|
||||
it { should_not be_able_to(:manage, other_event.difficulty_level) }
|
||||
it { should be_able_to(:manage, my_event.commercials.first) }
|
||||
it { should_not be_able_to(:manage, other_event.commercials.first) }
|
||||
it { should be_able_to(:index, my_event.comment_threads.first) }
|
||||
it { should_not be_able_to(:index, other_event.comment_threads.first) }
|
||||
|
||||
it{ should_not be_able_to(:manage, resource) }
|
||||
it{ should be_able_to(:index, resource) }
|
||||
it{ should be_able_to(:show, resource) }
|
||||
it{ should be_able_to(:update, resource) }
|
||||
it{ should_not be_able_to(:assign_org_admins, organization) }
|
||||
it{ should_not be_able_to(:unassign_org_admins, organization) }
|
||||
it { should_not be_able_to(:manage, resource) }
|
||||
it { should be_able_to(:index, resource) }
|
||||
it { should be_able_to(:show, resource) }
|
||||
it { should be_able_to(:update, resource) }
|
||||
it { should_not be_able_to(:assign_org_admins, organization) }
|
||||
it { should_not be_able_to(:unassign_org_admins, organization) }
|
||||
|
||||
it_behaves_like 'user with any role'
|
||||
it_behaves_like 'user with non-organizer role', 'cfp'
|
||||
|
|
@ -317,66 +319,66 @@ describe 'User with admin role' do
|
|||
let(:role) { Role.find_by(name: 'info_desk', resource: my_conference) }
|
||||
let(:user) { create(:user, role_ids: [role.id]) }
|
||||
|
||||
it{ should_not be_able_to(:new, Conference.new) }
|
||||
it{ should_not be_able_to(:create, Conference.new) }
|
||||
it{ should_not be_able_to(:manage, my_conference) }
|
||||
it{ should_not be_able_to(:manage, conference_public) }
|
||||
it{ should_not be_able_to(:manage, my_conference.splashpage) }
|
||||
it{ should_not be_able_to(:manage, conference_public.splashpage) }
|
||||
it{ should_not be_able_to(:manage, my_conference.contact) }
|
||||
it{ should_not be_able_to(:manage, conference_public.contact) }
|
||||
it{ should_not be_able_to(:manage, my_conference.email_settings) }
|
||||
it{ should_not be_able_to(:manage, conference_public.email_settings) }
|
||||
it{ should_not be_able_to(:manage, my_conference.campaigns.first) }
|
||||
it{ should_not be_able_to(:manage, conference_public.campaigns.first) }
|
||||
it{ should_not be_able_to(:manage, my_conference.targets.first) }
|
||||
it{ should_not be_able_to(:manage, conference_public.targets.first) }
|
||||
it{ should_not be_able_to(:manage, my_conference.commercials.first) }
|
||||
it{ should_not be_able_to(:manage, conference_public.commercials.first) }
|
||||
it{ should_not be_able_to(:manage, my_conference.registration_period) }
|
||||
it{ should_not be_able_to(:manage, conference_public.registration_period) }
|
||||
it{ should be_able_to(:manage, my_conference.questions.first) }
|
||||
it{ should_not be_able_to(:manage, conference_public.questions.first) }
|
||||
it{ should_not be_able_to(:manage, my_conference.program.cfp) }
|
||||
it{ should_not be_able_to(:manage, conference_public.program.cfp) }
|
||||
it{ should_not be_able_to(:manage, my_schedule) }
|
||||
it{ should_not be_able_to(:manage, other_schedule) }
|
||||
it{ should_not be_able_to(:manage, my_event_schedule) }
|
||||
it{ should_not be_able_to(:manage, other_event_schedule) }
|
||||
it{ should_not be_able_to(:manage, my_conference.venue) }
|
||||
it{ should_not be_able_to(:show, my_conference.venue) }
|
||||
it{ should_not be_able_to(:manage, conference_public.venue) }
|
||||
it{ should_not be_able_to(:manage, my_conference.lodgings.first) }
|
||||
it{ should_not be_able_to(:manage, conference_public.lodgings.first) }
|
||||
it{ should_not be_able_to(:manage, my_conference.sponsors.first) }
|
||||
it{ should_not be_able_to(:manage, conference_public.sponsors.first) }
|
||||
it{ should_not be_able_to(:manage, my_conference.sponsorship_levels.first) }
|
||||
it{ should_not be_able_to(:manage, conference_public.sponsorship_levels.first) }
|
||||
it{ should_not be_able_to(:manage, my_conference.tickets.first) }
|
||||
it{ should_not be_able_to(:manage, conference_public.tickets.first) }
|
||||
it { should_not be_able_to(:new, Conference.new) }
|
||||
it { should_not be_able_to(:create, Conference.new) }
|
||||
it { should_not be_able_to(:manage, my_conference) }
|
||||
it { should_not be_able_to(:manage, conference_public) }
|
||||
it { should_not be_able_to(:manage, my_conference.splashpage) }
|
||||
it { should_not be_able_to(:manage, conference_public.splashpage) }
|
||||
it { should_not be_able_to(:manage, my_conference.contact) }
|
||||
it { should_not be_able_to(:manage, conference_public.contact) }
|
||||
it { should_not be_able_to(:manage, my_conference.email_settings) }
|
||||
it { should_not be_able_to(:manage, conference_public.email_settings) }
|
||||
it { should_not be_able_to(:manage, my_conference.campaigns.first) }
|
||||
it { should_not be_able_to(:manage, conference_public.campaigns.first) }
|
||||
it { should_not be_able_to(:manage, my_conference.targets.first) }
|
||||
it { should_not be_able_to(:manage, conference_public.targets.first) }
|
||||
it { should_not be_able_to(:manage, my_conference.commercials.first) }
|
||||
it { should_not be_able_to(:manage, conference_public.commercials.first) }
|
||||
it { should_not be_able_to(:manage, my_conference.registration_period) }
|
||||
it { should_not be_able_to(:manage, conference_public.registration_period) }
|
||||
it { should be_able_to(:manage, my_conference.questions.first) }
|
||||
it { should_not be_able_to(:manage, conference_public.questions.first) }
|
||||
it { should_not be_able_to(:manage, my_conference.program.cfp) }
|
||||
it { should_not be_able_to(:manage, conference_public.program.cfp) }
|
||||
it { should_not be_able_to(:manage, my_schedule) }
|
||||
it { should_not be_able_to(:manage, other_schedule) }
|
||||
it { should_not be_able_to(:manage, my_event_schedule) }
|
||||
it { should_not be_able_to(:manage, other_event_schedule) }
|
||||
it { should_not be_able_to(:manage, my_conference.venue) }
|
||||
it { should_not be_able_to(:show, my_conference.venue) }
|
||||
it { should_not be_able_to(:manage, conference_public.venue) }
|
||||
it { should_not be_able_to(:manage, my_conference.lodgings.first) }
|
||||
it { should_not be_able_to(:manage, conference_public.lodgings.first) }
|
||||
it { should_not be_able_to(:manage, my_conference.sponsors.first) }
|
||||
it { should_not be_able_to(:manage, conference_public.sponsors.first) }
|
||||
it { should_not be_able_to(:manage, my_conference.sponsorship_levels.first) }
|
||||
it { should_not be_able_to(:manage, conference_public.sponsorship_levels.first) }
|
||||
it { should_not be_able_to(:manage, my_conference.tickets.first) }
|
||||
it { should_not be_able_to(:manage, conference_public.tickets.first) }
|
||||
|
||||
it{ should be_able_to(:manage, my_registration) }
|
||||
it{ should_not be_able_to(:manage, other_registration) }
|
||||
it { should be_able_to(:manage, my_registration) }
|
||||
it { should_not be_able_to(:manage, other_registration) }
|
||||
|
||||
it{ should_not be_able_to(:manage, my_event) }
|
||||
it{ should_not be_able_to(:manage, other_event) }
|
||||
it{ should_not be_able_to(:manage, my_event.event_type) }
|
||||
it{ should_not be_able_to(:manage, other_event.event_type) }
|
||||
it{ should_not be_able_to(:manage, my_event.track) }
|
||||
it{ should_not be_able_to(:manage, other_event.track) }
|
||||
it{ should_not be_able_to(:manage, my_event.difficulty_level) }
|
||||
it{ should_not be_able_to(:manage, other_event.difficulty_level) }
|
||||
it{ should_not be_able_to(:manage, my_event.commercials.first) }
|
||||
it{ should_not be_able_to(:manage, other_event.commercials.first) }
|
||||
it{ should_not be_able_to(:index, my_event.comment_threads.first) }
|
||||
it{ should_not be_able_to(:index, other_event.comment_threads.first) }
|
||||
it { should_not be_able_to(:manage, my_event) }
|
||||
it { should_not be_able_to(:manage, other_event) }
|
||||
it { should_not be_able_to(:manage, my_event.event_type) }
|
||||
it { should_not be_able_to(:manage, other_event.event_type) }
|
||||
it { should_not be_able_to(:manage, my_event.track) }
|
||||
it { should_not be_able_to(:manage, other_event.track) }
|
||||
it { should_not be_able_to(:manage, my_event.difficulty_level) }
|
||||
it { should_not be_able_to(:manage, other_event.difficulty_level) }
|
||||
it { should_not be_able_to(:manage, my_event.commercials.first) }
|
||||
it { should_not be_able_to(:manage, other_event.commercials.first) }
|
||||
it { should_not be_able_to(:index, my_event.comment_threads.first) }
|
||||
it { should_not be_able_to(:index, other_event.comment_threads.first) }
|
||||
|
||||
it{ should_not be_able_to(:manage, resource) }
|
||||
it{ should be_able_to(:index, resource) }
|
||||
it{ should be_able_to(:show, resource) }
|
||||
it{ should be_able_to(:update, resource) }
|
||||
it{ should_not be_able_to(:assign_org_admins, organization) }
|
||||
it{ should_not be_able_to(:unassign_org_admins, organization) }
|
||||
it { should_not be_able_to(:manage, resource) }
|
||||
it { should be_able_to(:index, resource) }
|
||||
it { should be_able_to(:show, resource) }
|
||||
it { should be_able_to(:update, resource) }
|
||||
it { should_not be_able_to(:assign_org_admins, organization) }
|
||||
it { should_not be_able_to(:unassign_org_admins, organization) }
|
||||
|
||||
it_behaves_like 'user with any role'
|
||||
it_behaves_like 'user with non-organizer role', 'info_desk'
|
||||
|
|
@ -386,66 +388,66 @@ describe 'User with admin role' do
|
|||
let(:role) { Role.find_by(name: 'volunteers_coordinator', resource: my_conference) }
|
||||
let(:user) { create(:user, role_ids: [role.id]) }
|
||||
|
||||
it{ should_not be_able_to(:new, Conference.new) }
|
||||
it{ should_not be_able_to(:create, Conference.new) }
|
||||
it{ should_not be_able_to(:manage, my_conference) }
|
||||
it{ should_not be_able_to(:manage, conference_public) }
|
||||
it{ should_not be_able_to(:manage, my_conference.splashpage) }
|
||||
it{ should_not be_able_to(:manage, conference_public.splashpage) }
|
||||
it{ should_not be_able_to(:manage, my_conference.contact) }
|
||||
it{ should_not be_able_to(:manage, conference_public.contact) }
|
||||
it{ should_not be_able_to(:manage, my_conference.email_settings) }
|
||||
it{ should_not be_able_to(:manage, conference_public.email_settings) }
|
||||
it{ should_not be_able_to(:manage, my_conference.campaigns.first) }
|
||||
it{ should_not be_able_to(:manage, conference_public.campaigns.first) }
|
||||
it{ should_not be_able_to(:manage, my_conference.targets.first) }
|
||||
it{ should_not be_able_to(:manage, conference_public.targets.first) }
|
||||
it{ should_not be_able_to(:manage, my_conference.commercials.first) }
|
||||
it{ should_not be_able_to(:manage, conference_public.commercials.first) }
|
||||
it{ should_not be_able_to(:manage, my_conference.registration_period) }
|
||||
it{ should_not be_able_to(:manage, conference_public.registration_period) }
|
||||
it{ should_not be_able_to(:manage, my_conference.questions.first) }
|
||||
it{ should_not be_able_to(:manage, conference_public.questions.first) }
|
||||
it{ should_not be_able_to(:manage, my_conference.program.cfp) }
|
||||
it{ should_not be_able_to(:manage, conference_public.program.cfp) }
|
||||
it{ should_not be_able_to(:manage, my_schedule) }
|
||||
it{ should_not be_able_to(:manage, other_schedule) }
|
||||
it{ should_not be_able_to(:manage, my_event_schedule) }
|
||||
it{ should_not be_able_to(:manage, other_event_schedule) }
|
||||
it{ should_not be_able_to(:manage, my_conference.venue) }
|
||||
it{ should_not be_able_to(:show, my_conference.venue) }
|
||||
it{ should_not be_able_to(:manage, conference_public.venue) }
|
||||
it{ should_not be_able_to(:manage, my_conference.lodgings.first) }
|
||||
it{ should_not be_able_to(:manage, conference_public.lodgings.first) }
|
||||
it{ should_not be_able_to(:manage, my_conference.sponsors.first) }
|
||||
it{ should_not be_able_to(:manage, conference_public.sponsors.first) }
|
||||
it{ should_not be_able_to(:manage, my_conference.sponsorship_levels.first) }
|
||||
it{ should_not be_able_to(:manage, conference_public.sponsorship_levels.first) }
|
||||
it{ should_not be_able_to(:manage, my_conference.tickets.first) }
|
||||
it{ should_not be_able_to(:manage, conference_public.tickets.first) }
|
||||
it { should_not be_able_to(:new, Conference.new) }
|
||||
it { should_not be_able_to(:create, Conference.new) }
|
||||
it { should_not be_able_to(:manage, my_conference) }
|
||||
it { should_not be_able_to(:manage, conference_public) }
|
||||
it { should_not be_able_to(:manage, my_conference.splashpage) }
|
||||
it { should_not be_able_to(:manage, conference_public.splashpage) }
|
||||
it { should_not be_able_to(:manage, my_conference.contact) }
|
||||
it { should_not be_able_to(:manage, conference_public.contact) }
|
||||
it { should_not be_able_to(:manage, my_conference.email_settings) }
|
||||
it { should_not be_able_to(:manage, conference_public.email_settings) }
|
||||
it { should_not be_able_to(:manage, my_conference.campaigns.first) }
|
||||
it { should_not be_able_to(:manage, conference_public.campaigns.first) }
|
||||
it { should_not be_able_to(:manage, my_conference.targets.first) }
|
||||
it { should_not be_able_to(:manage, conference_public.targets.first) }
|
||||
it { should_not be_able_to(:manage, my_conference.commercials.first) }
|
||||
it { should_not be_able_to(:manage, conference_public.commercials.first) }
|
||||
it { should_not be_able_to(:manage, my_conference.registration_period) }
|
||||
it { should_not be_able_to(:manage, conference_public.registration_period) }
|
||||
it { should_not be_able_to(:manage, my_conference.questions.first) }
|
||||
it { should_not be_able_to(:manage, conference_public.questions.first) }
|
||||
it { should_not be_able_to(:manage, my_conference.program.cfp) }
|
||||
it { should_not be_able_to(:manage, conference_public.program.cfp) }
|
||||
it { should_not be_able_to(:manage, my_schedule) }
|
||||
it { should_not be_able_to(:manage, other_schedule) }
|
||||
it { should_not be_able_to(:manage, my_event_schedule) }
|
||||
it { should_not be_able_to(:manage, other_event_schedule) }
|
||||
it { should_not be_able_to(:manage, my_conference.venue) }
|
||||
it { should_not be_able_to(:show, my_conference.venue) }
|
||||
it { should_not be_able_to(:manage, conference_public.venue) }
|
||||
it { should_not be_able_to(:manage, my_conference.lodgings.first) }
|
||||
it { should_not be_able_to(:manage, conference_public.lodgings.first) }
|
||||
it { should_not be_able_to(:manage, my_conference.sponsors.first) }
|
||||
it { should_not be_able_to(:manage, conference_public.sponsors.first) }
|
||||
it { should_not be_able_to(:manage, my_conference.sponsorship_levels.first) }
|
||||
it { should_not be_able_to(:manage, conference_public.sponsorship_levels.first) }
|
||||
it { should_not be_able_to(:manage, my_conference.tickets.first) }
|
||||
it { should_not be_able_to(:manage, conference_public.tickets.first) }
|
||||
|
||||
it{ should_not be_able_to(:manage, registration) }
|
||||
it{ should_not be_able_to(:manage, other_registration) }
|
||||
it { should_not be_able_to(:manage, registration) }
|
||||
it { should_not be_able_to(:manage, other_registration) }
|
||||
|
||||
it{ should_not be_able_to(:manage, my_event) }
|
||||
it{ should_not be_able_to(:manage, other_event) }
|
||||
it{ should_not be_able_to(:manage, my_event.event_type) }
|
||||
it{ should_not be_able_to(:manage, other_event.event_type) }
|
||||
it{ should_not be_able_to(:manage, my_event.track) }
|
||||
it{ should_not be_able_to(:manage, other_event.track) }
|
||||
it{ should_not be_able_to(:manage, my_event.difficulty_level) }
|
||||
it{ should_not be_able_to(:manage, other_event.difficulty_level) }
|
||||
it{ should_not be_able_to(:manage, my_event.commercials.first) }
|
||||
it{ should_not be_able_to(:manage, other_event.commercials.first) }
|
||||
it{ should_not be_able_to(:index, my_event.comment_threads.first) }
|
||||
it{ should_not be_able_to(:index, other_event.comment_threads.first) }
|
||||
it { should_not be_able_to(:manage, my_event) }
|
||||
it { should_not be_able_to(:manage, other_event) }
|
||||
it { should_not be_able_to(:manage, my_event.event_type) }
|
||||
it { should_not be_able_to(:manage, other_event.event_type) }
|
||||
it { should_not be_able_to(:manage, my_event.track) }
|
||||
it { should_not be_able_to(:manage, other_event.track) }
|
||||
it { should_not be_able_to(:manage, my_event.difficulty_level) }
|
||||
it { should_not be_able_to(:manage, other_event.difficulty_level) }
|
||||
it { should_not be_able_to(:manage, my_event.commercials.first) }
|
||||
it { should_not be_able_to(:manage, other_event.commercials.first) }
|
||||
it { should_not be_able_to(:index, my_event.comment_threads.first) }
|
||||
it { should_not be_able_to(:index, other_event.comment_threads.first) }
|
||||
|
||||
it{ should_not be_able_to(:manage, resource) }
|
||||
it{ should be_able_to(:index, resource) }
|
||||
it{ should be_able_to(:show, resource) }
|
||||
it{ should be_able_to(:update, resource) }
|
||||
it{ should_not be_able_to(:assign_org_admins, organization) }
|
||||
it{ should_not be_able_to(:unassign_org_admins, organization) }
|
||||
it { should_not be_able_to(:manage, resource) }
|
||||
it { should be_able_to(:index, resource) }
|
||||
it { should be_able_to(:show, resource) }
|
||||
it { should be_able_to(:update, resource) }
|
||||
it { should_not be_able_to(:assign_org_admins, organization) }
|
||||
it { should_not be_able_to(:unassign_org_admins, organization) }
|
||||
|
||||
it 'should be_able to :manage Vposition'
|
||||
it 'should be_able to :manage Vday'
|
||||
|
|
@ -455,7 +457,6 @@ describe 'User with admin role' do
|
|||
end
|
||||
|
||||
context 'when user has the role track_organizer' do
|
||||
|
||||
let(:role) { Role.where(name: 'track_organizer', resource: my_self_organized_track).first_or_create }
|
||||
let(:user) { create(:user, role_ids: [role.id]) }
|
||||
let(:new_track) { build(:track, program: my_conference.program) }
|
||||
|
|
@ -467,79 +468,79 @@ describe 'User with admin role' do
|
|||
let(:my_self_organized_track_schedule) { create(:schedule, program: my_conference.program, track: my_self_organized_track) }
|
||||
let(:my_self_organized_track_event_schedule) { create(:event_schedule, event: my_self_organized_track_event, schedule: my_self_organized_track_schedule, room: my_self_organized_track.room) }
|
||||
|
||||
it{ should_not be_able_to(:new, Conference.new) }
|
||||
it{ should_not be_able_to(:create, Conference.new) }
|
||||
it{ should_not be_able_to(:manage, my_conference) }
|
||||
it{ should_not be_able_to(:manage, conference_public) }
|
||||
it{ should_not be_able_to(:manage, my_conference.splashpage) }
|
||||
it{ should_not be_able_to(:manage, conference_public.splashpage) }
|
||||
it{ should_not be_able_to(:manage, my_conference.contact) }
|
||||
it{ should_not be_able_to(:manage, conference_public.contact) }
|
||||
it{ should_not be_able_to(:manage, my_conference.email_settings) }
|
||||
it{ should_not be_able_to(:manage, conference_public.email_settings) }
|
||||
it{ should_not be_able_to(:manage, my_conference.campaigns.first) }
|
||||
it{ should_not be_able_to(:manage, conference_public.campaigns.first) }
|
||||
it{ should_not be_able_to(:manage, my_conference.targets.first) }
|
||||
it{ should_not be_able_to(:manage, conference_public.targets.first) }
|
||||
it{ should_not be_able_to(:manage, my_conference.commercials.first) }
|
||||
it{ should_not be_able_to(:manage, conference_public.commercials.first) }
|
||||
it{ should_not be_able_to(:manage, my_conference.registration_period) }
|
||||
it{ should_not be_able_to(:manage, conference_public.registration_period) }
|
||||
it{ should_not be_able_to(:manage, my_conference.questions.first) }
|
||||
it{ should_not be_able_to(:manage, conference_public.questions.first) }
|
||||
it{ should_not be_able_to(:manage, my_conference.program.cfp) }
|
||||
it{ should_not be_able_to(:manage, conference_public.program.cfp) }
|
||||
it{ should_not be_able_to(:manage, my_schedule) }
|
||||
it{ should_not be_able_to(:manage, other_schedule) }
|
||||
it{ should_not be_able_to(:manage, my_event_schedule) }
|
||||
it{ should_not be_able_to(:manage, other_event_schedule) }
|
||||
it{ should_not be_able_to(:manage, my_conference.venue) }
|
||||
it{ should_not be_able_to(:show, my_conference.venue) }
|
||||
it{ should_not be_able_to(:manage, conference_public.venue) }
|
||||
it{ should_not be_able_to(:manage, my_conference.lodgings.first) }
|
||||
it{ should_not be_able_to(:manage, conference_public.lodgings.first) }
|
||||
it{ should_not be_able_to(:manage, my_conference.sponsors.first) }
|
||||
it{ should_not be_able_to(:manage, conference_public.sponsors.first) }
|
||||
it{ should_not be_able_to(:manage, my_conference.sponsorship_levels.first) }
|
||||
it{ should_not be_able_to(:manage, conference_public.sponsorship_levels.first) }
|
||||
it{ should_not be_able_to(:manage, my_conference.tickets.first) }
|
||||
it{ should_not be_able_to(:manage, conference_public.tickets.first) }
|
||||
it { should_not be_able_to(:new, Conference.new) }
|
||||
it { should_not be_able_to(:create, Conference.new) }
|
||||
it { should_not be_able_to(:manage, my_conference) }
|
||||
it { should_not be_able_to(:manage, conference_public) }
|
||||
it { should_not be_able_to(:manage, my_conference.splashpage) }
|
||||
it { should_not be_able_to(:manage, conference_public.splashpage) }
|
||||
it { should_not be_able_to(:manage, my_conference.contact) }
|
||||
it { should_not be_able_to(:manage, conference_public.contact) }
|
||||
it { should_not be_able_to(:manage, my_conference.email_settings) }
|
||||
it { should_not be_able_to(:manage, conference_public.email_settings) }
|
||||
it { should_not be_able_to(:manage, my_conference.campaigns.first) }
|
||||
it { should_not be_able_to(:manage, conference_public.campaigns.first) }
|
||||
it { should_not be_able_to(:manage, my_conference.targets.first) }
|
||||
it { should_not be_able_to(:manage, conference_public.targets.first) }
|
||||
it { should_not be_able_to(:manage, my_conference.commercials.first) }
|
||||
it { should_not be_able_to(:manage, conference_public.commercials.first) }
|
||||
it { should_not be_able_to(:manage, my_conference.registration_period) }
|
||||
it { should_not be_able_to(:manage, conference_public.registration_period) }
|
||||
it { should_not be_able_to(:manage, my_conference.questions.first) }
|
||||
it { should_not be_able_to(:manage, conference_public.questions.first) }
|
||||
it { should_not be_able_to(:manage, my_conference.program.cfp) }
|
||||
it { should_not be_able_to(:manage, conference_public.program.cfp) }
|
||||
it { should_not be_able_to(:manage, my_schedule) }
|
||||
it { should_not be_able_to(:manage, other_schedule) }
|
||||
it { should_not be_able_to(:manage, my_event_schedule) }
|
||||
it { should_not be_able_to(:manage, other_event_schedule) }
|
||||
it { should_not be_able_to(:manage, my_conference.venue) }
|
||||
it { should_not be_able_to(:show, my_conference.venue) }
|
||||
it { should_not be_able_to(:manage, conference_public.venue) }
|
||||
it { should_not be_able_to(:manage, my_conference.lodgings.first) }
|
||||
it { should_not be_able_to(:manage, conference_public.lodgings.first) }
|
||||
it { should_not be_able_to(:manage, my_conference.sponsors.first) }
|
||||
it { should_not be_able_to(:manage, conference_public.sponsors.first) }
|
||||
it { should_not be_able_to(:manage, my_conference.sponsorship_levels.first) }
|
||||
it { should_not be_able_to(:manage, conference_public.sponsorship_levels.first) }
|
||||
it { should_not be_able_to(:manage, my_conference.tickets.first) }
|
||||
it { should_not be_able_to(:manage, conference_public.tickets.first) }
|
||||
|
||||
it{ should_not be_able_to(:manage, registration) }
|
||||
it{ should_not be_able_to(:manage, other_registration) }
|
||||
it { should_not be_able_to(:manage, registration) }
|
||||
it { should_not be_able_to(:manage, other_registration) }
|
||||
|
||||
it{ should_not be_able_to(:manage, my_event) }
|
||||
it{ should_not be_able_to(:manage, other_event) }
|
||||
it{ should_not be_able_to(:manage, my_event.event_type) }
|
||||
it{ should_not be_able_to(:manage, other_event.event_type) }
|
||||
it{ should_not be_able_to(:manage, my_event.track) }
|
||||
it{ should_not be_able_to(:manage, other_event.track) }
|
||||
it{ should_not be_able_to(:manage, my_event.difficulty_level) }
|
||||
it{ should_not be_able_to(:manage, other_event.difficulty_level) }
|
||||
it{ should_not be_able_to(:manage, my_event.commercials.first) }
|
||||
it{ should_not be_able_to(:manage, other_event.commercials.first) }
|
||||
it{ should_not be_able_to(:index, my_event.comment_threads.first) }
|
||||
it{ should_not be_able_to(:index, other_event.comment_threads.first) }
|
||||
it { should_not be_able_to(:manage, my_event) }
|
||||
it { should_not be_able_to(:manage, other_event) }
|
||||
it { should_not be_able_to(:manage, my_event.event_type) }
|
||||
it { should_not be_able_to(:manage, other_event.event_type) }
|
||||
it { should_not be_able_to(:manage, my_event.track) }
|
||||
it { should_not be_able_to(:manage, other_event.track) }
|
||||
it { should_not be_able_to(:manage, my_event.difficulty_level) }
|
||||
it { should_not be_able_to(:manage, other_event.difficulty_level) }
|
||||
it { should_not be_able_to(:manage, my_event.commercials.first) }
|
||||
it { should_not be_able_to(:manage, other_event.commercials.first) }
|
||||
it { should_not be_able_to(:index, my_event.comment_threads.first) }
|
||||
it { should_not be_able_to(:index, other_event.comment_threads.first) }
|
||||
|
||||
it{ should_not be_able_to(:manage, resource) }
|
||||
it { should_not be_able_to(:manage, resource) }
|
||||
|
||||
it{ should be_able_to(:show, my_conference.program) }
|
||||
it{ should be_able_to(:update, new_track) }
|
||||
it{ should be_able_to(:manage, my_self_organized_track) }
|
||||
it{ should_not be_able_to(:edit, my_self_organized_track) }
|
||||
it{ should_not be_able_to(:update, my_self_organized_track) }
|
||||
it { should be_able_to(:show, my_conference.program) }
|
||||
it { should be_able_to(:update, new_track) }
|
||||
it { should be_able_to(:manage, my_self_organized_track) }
|
||||
it { should_not be_able_to(:edit, my_self_organized_track) }
|
||||
it { should_not be_able_to(:update, my_self_organized_track) }
|
||||
|
||||
it{ should_not be_able_to(:assign_org_admins, organization) }
|
||||
it{ should_not be_able_to(:unassign_org_admins, organization) }
|
||||
it { should_not be_able_to(:assign_org_admins, organization) }
|
||||
it { should_not be_able_to(:unassign_org_admins, organization) }
|
||||
|
||||
it{ should be_able_to(:update, new_event) }
|
||||
it{ should be_able_to(:manage, my_self_organized_track_event) }
|
||||
it{ should be_able_to(:manage, my_self_organized_track_event_commercial) }
|
||||
it { should be_able_to(:update, new_event) }
|
||||
it { should be_able_to(:manage, my_self_organized_track_event) }
|
||||
it { should be_able_to(:manage, my_self_organized_track_event_commercial) }
|
||||
|
||||
it{ should be_able_to(:update, new_schedule) }
|
||||
it{ should be_able_to(:new, new_track_schedule) }
|
||||
it{ should be_able_to(:manage, my_self_organized_track_schedule) }
|
||||
it{ should be_able_to(:manage, my_self_organized_track_event_schedule) }
|
||||
it { should be_able_to(:update, new_schedule) }
|
||||
it { should be_able_to(:new, new_track_schedule) }
|
||||
it { should be_able_to(:manage, my_self_organized_track_schedule) }
|
||||
it { should be_able_to(:manage, my_self_organized_track_event_schedule) }
|
||||
|
||||
it_behaves_like 'user with any role'
|
||||
it_behaves_like 'user with non-organizer role', 'track_organizer'
|
||||
|
|
|
|||
|
|
@ -1,3 +1,5 @@
|
|||
# frozen_string_literal: true
|
||||
|
||||
require 'spec_helper'
|
||||
|
||||
describe 'Booth' do
|
||||
|
|
@ -33,8 +35,8 @@ describe 'Booth' do
|
|||
end
|
||||
end
|
||||
|
||||
states = [:new, :withdrawn, :to_accept, :accepted, :to_reject, :rejected, :canceled, :confirmed]
|
||||
transitions = [:restart, :withdraw, :accept, :reject, :to_accept, :to_reject, :cancel]
|
||||
states = %i[new withdrawn to_accept accepted to_reject rejected canceled confirmed]
|
||||
transitions = %i[restart withdraw accept reject to_accept to_reject cancel]
|
||||
|
||||
states_transitions = { new: { restart: false, withdraw: true, accept: true, to_accept: true, to_reject: true, reject: true, cancel: false, confirm: false },
|
||||
withdrawn: { restart: true, withdraw: false, accept: false, to_accept: false, to_reject: false, reject: false, cancel: false, confirm: false },
|
||||
|
|
@ -51,5 +53,4 @@ describe 'Booth' do
|
|||
end
|
||||
end
|
||||
end
|
||||
|
||||
end
|
||||
|
|
|
|||
|
|
@ -1,3 +1,5 @@
|
|||
# frozen_string_literal: true
|
||||
|
||||
require 'spec_helper'
|
||||
require 'ahoy'
|
||||
|
||||
|
|
|
|||
|
|
@ -1,3 +1,5 @@
|
|||
# frozen_string_literal: true
|
||||
|
||||
require 'spec_helper'
|
||||
|
||||
describe Cfp do
|
||||
|
|
|
|||
|
|
@ -1,7 +1,8 @@
|
|||
# frozen_string_literal: true
|
||||
|
||||
require 'spec_helper'
|
||||
|
||||
describe Commercial do
|
||||
|
||||
describe '.find_since_last_login' do
|
||||
it 'returns none if last_sign_in_at is nil' do
|
||||
expect(Comment.find_since_last_login(create(:user))).to eq(Comment.none)
|
||||
|
|
|
|||
|
|
@ -1,7 +1,7 @@
|
|||
# frozen_string_literal: true
|
||||
|
||||
require 'spec_helper'
|
||||
|
||||
describe Commercial do
|
||||
|
||||
it { should validate_presence_of(:url) }
|
||||
|
||||
end
|
||||
|
|
|
|||
|
|
@ -1,19 +1,18 @@
|
|||
#!/bin/env ruby
|
||||
# encoding: utf-8
|
||||
# frozen_string_literal: true
|
||||
|
||||
require 'spec_helper'
|
||||
|
||||
describe Conference do
|
||||
|
||||
let(:subject) { create(:conference, start_date: Date.new(2014, 06, 30), end_date: Date.new(2014, 06, 30)) }
|
||||
let(:subject) { create(:conference, start_date: Date.new(2014, 0o6, 30), end_date: Date.new(2014, 0o6, 30)) }
|
||||
|
||||
describe '#write_event_distribution_to_db' do
|
||||
|
||||
it 'updates pending conferences' do
|
||||
create(:conference,
|
||||
start_date: Date.today - 2.weeks,
|
||||
end_date: Date.today - 1.weeks)
|
||||
end_date: Date.today - 1.week)
|
||||
|
||||
subject.start_date = Date.today + 1.weeks
|
||||
subject.start_date = Date.today + 1.week
|
||||
subject.end_date = Date.today + 2.weeks
|
||||
|
||||
result = {
|
||||
|
|
@ -25,7 +24,7 @@ describe Conference do
|
|||
withdrawn: 0,
|
||||
canceled: 0,
|
||||
rejected: 0
|
||||
},
|
||||
}
|
||||
}
|
||||
|
||||
Conference.write_event_distribution_to_db
|
||||
|
|
@ -36,7 +35,7 @@ describe Conference do
|
|||
it 'does not update past conferences' do
|
||||
old_conference = create(:conference,
|
||||
start_date: Date.today - 2.weeks,
|
||||
end_date: Date.today - 1.weeks)
|
||||
end_date: Date.today - 1.week)
|
||||
|
||||
Conference.write_event_distribution_to_db
|
||||
old_conference.reload
|
||||
|
|
@ -82,7 +81,7 @@ describe Conference do
|
|||
withdrawn: 1,
|
||||
canceled: 1,
|
||||
rejected: 1
|
||||
},
|
||||
}
|
||||
}
|
||||
|
||||
subject.reload
|
||||
|
|
@ -103,7 +102,7 @@ describe Conference do
|
|||
canceled: 0,
|
||||
rejected: 0
|
||||
},
|
||||
DateTime.now.end_of_week - 1.weeks =>
|
||||
DateTime.now.end_of_week - 1.week =>
|
||||
{
|
||||
confirmed: 3,
|
||||
unconfirmed: 4,
|
||||
|
|
@ -111,7 +110,7 @@ describe Conference do
|
|||
withdrawn: 0,
|
||||
canceled: 0,
|
||||
rejected: 0
|
||||
},
|
||||
}
|
||||
}
|
||||
subject.events_per_week = db_data
|
||||
subject.save
|
||||
|
|
@ -138,7 +137,7 @@ describe Conference do
|
|||
canceled: 0,
|
||||
rejected: 0
|
||||
},
|
||||
DateTime.now.end_of_week - 1.weeks =>
|
||||
DateTime.now.end_of_week - 1.week =>
|
||||
{
|
||||
confirmed: 3,
|
||||
unconfirmed: 4,
|
||||
|
|
@ -155,7 +154,7 @@ describe Conference do
|
|||
withdrawn: 0,
|
||||
canceled: 0,
|
||||
rejected: 0
|
||||
},
|
||||
}
|
||||
}
|
||||
|
||||
subject.reload
|
||||
|
|
@ -176,11 +175,11 @@ describe Conference do
|
|||
db_data = {
|
||||
Date.today.end_of_week - 2.weeks => {
|
||||
confirmed: 1,
|
||||
unconfirmed: 2,
|
||||
unconfirmed: 2
|
||||
},
|
||||
Date.today.end_of_week - 1.weeks => {
|
||||
Date.today.end_of_week - 1.week => {
|
||||
confirmed: 3,
|
||||
unconfirmed: 4,
|
||||
unconfirmed: 4
|
||||
}
|
||||
}
|
||||
subject.events_per_week = db_data
|
||||
|
|
@ -248,11 +247,11 @@ describe Conference do
|
|||
db_data = {
|
||||
Date.today.end_of_week - 3.weeks => {
|
||||
confirmed: 1,
|
||||
unconfirmed: 2,
|
||||
unconfirmed: 2
|
||||
},
|
||||
Date.today.end_of_week - 1.weeks => {
|
||||
Date.today.end_of_week - 1.week => {
|
||||
confirmed: 3,
|
||||
unconfirmed: 4,
|
||||
unconfirmed: 4
|
||||
}
|
||||
}
|
||||
subject.events_per_week = db_data
|
||||
|
|
@ -298,7 +297,6 @@ describe Conference do
|
|||
expect(subject.get_top_submitter.values).to eq([3, 1])
|
||||
expect(subject.get_top_submitter.keys).to eq([e2.submitter, e1.submitter])
|
||||
end
|
||||
|
||||
end
|
||||
|
||||
describe '#get_targets' do
|
||||
|
|
@ -391,7 +389,6 @@ describe Conference do
|
|||
|
||||
describe '#new_program_minutes' do
|
||||
it 'calculates correct values with events' do
|
||||
|
||||
create(:event, program: subject.program, event_type: @long, created_at: Time.now - 3.days)
|
||||
create(:event, program: subject.program, event_type: @long)
|
||||
create(:event, program: subject.program, event_type: @short, created_at: Time.now - 3.days)
|
||||
|
|
@ -418,7 +415,6 @@ describe Conference do
|
|||
end
|
||||
|
||||
describe '#difficulty_levels_distribution' do
|
||||
|
||||
it 'calculates correct for different difficulty levels' do
|
||||
create(:event, program: subject.program, difficulty_level: @easy)
|
||||
create(:event, program: subject.program, difficulty_level: @easy)
|
||||
|
|
@ -426,11 +422,11 @@ describe Conference do
|
|||
result = {}
|
||||
result['Hard'] = {
|
||||
'value' => 1,
|
||||
'color' => '#FFFFFF',
|
||||
'color' => '#FFFFFF'
|
||||
}
|
||||
result['Easy'] = {
|
||||
'value' => 2,
|
||||
'color' => '#000000',
|
||||
'color' => '#000000'
|
||||
}
|
||||
expect(subject.difficulty_levels_distribution).to eq(result)
|
||||
end
|
||||
|
|
@ -440,7 +436,7 @@ describe Conference do
|
|||
result = {}
|
||||
result['Easy'] = {
|
||||
'value' => 1,
|
||||
'color' => '#000000',
|
||||
'color' => '#000000'
|
||||
}
|
||||
expect(subject.difficulty_levels_distribution).to eq(result)
|
||||
end
|
||||
|
|
@ -495,7 +491,7 @@ describe Conference do
|
|||
result = {}
|
||||
result['Easy'] = {
|
||||
'value' => 1,
|
||||
'color' => '#000000',
|
||||
'color' => '#000000'
|
||||
}
|
||||
expect(subject.difficulty_levels_distribution(:confirmed)).to eq(result)
|
||||
end
|
||||
|
|
@ -522,11 +518,11 @@ describe Conference do
|
|||
result = {}
|
||||
result['Workshop'] = {
|
||||
'value' => 2,
|
||||
'color' => '#000000',
|
||||
'color' => '#000000'
|
||||
}
|
||||
result['Lecture'] = {
|
||||
'value' => 1,
|
||||
'color' => '#FFFFFF',
|
||||
'color' => '#FFFFFF'
|
||||
}
|
||||
expect(subject.event_type_distribution).to eq(result)
|
||||
end
|
||||
|
|
@ -536,7 +532,7 @@ describe Conference do
|
|||
result = {}
|
||||
result['Workshop'] = {
|
||||
'value' => 1,
|
||||
'color' => '#000000',
|
||||
'color' => '#000000'
|
||||
}
|
||||
expect(subject.event_type_distribution).to eq(result)
|
||||
end
|
||||
|
|
@ -591,7 +587,7 @@ describe Conference do
|
|||
result = {}
|
||||
result['Workshop'] = {
|
||||
'value' => 1,
|
||||
'color' => '#000000',
|
||||
'color' => '#000000'
|
||||
}
|
||||
expect(subject.event_type_distribution(:confirmed)).to eq(result)
|
||||
end
|
||||
|
|
@ -618,11 +614,11 @@ describe Conference do
|
|||
result = {}
|
||||
result['Track One'] = {
|
||||
'value' => 2,
|
||||
'color' => '#000000',
|
||||
'color' => '#000000'
|
||||
}
|
||||
result['Track Two'] = {
|
||||
'value' => 1,
|
||||
'color' => '#FFFFFF',
|
||||
'color' => '#FFFFFF'
|
||||
}
|
||||
expect(subject.tracks_distribution).to eq(result)
|
||||
end
|
||||
|
|
@ -632,7 +628,7 @@ describe Conference do
|
|||
result = {}
|
||||
result['Track One'] = {
|
||||
'value' => 1,
|
||||
'color' => '#000000',
|
||||
'color' => '#000000'
|
||||
}
|
||||
expect(subject.tracks_distribution).to eq(result)
|
||||
end
|
||||
|
|
@ -687,7 +683,7 @@ describe Conference do
|
|||
result = {}
|
||||
result['Track One'] = {
|
||||
'value' => 1,
|
||||
'color' => '#000000',
|
||||
'color' => '#000000'
|
||||
}
|
||||
expect(subject.tracks_distribution(:confirmed)).to eq(result)
|
||||
end
|
||||
|
|
@ -700,7 +696,6 @@ describe Conference do
|
|||
end
|
||||
|
||||
describe '#get_active_conferences' do
|
||||
|
||||
it 'returns pending conferences' do
|
||||
a = create(:conference,
|
||||
short_title: 'a', start_date: Time.now + 14.days,
|
||||
|
|
@ -738,13 +733,13 @@ describe Conference do
|
|||
|
||||
describe '#get_deactive_conferences' do
|
||||
it 'returns all conferences without the active conferences' do
|
||||
a = create(:conference, start_date: Time.now - 3.year, end_date: Time.now - 1080.days)
|
||||
b = create(:conference, start_date: Time.now - 2.year, end_date: Time.now - 720.days)
|
||||
a = create(:conference, start_date: Time.now - 3.years, end_date: Time.now - 1080.days)
|
||||
b = create(:conference, start_date: Time.now - 2.years, end_date: Time.now - 720.days)
|
||||
c = create(:conference, start_date: Time.now - 1.year, end_date: Time.now - 360.days)
|
||||
result = [a, b, c]
|
||||
|
||||
expect(Conference.get_conferences_without_active_for_dashboard([subject]))
|
||||
.to match_array(result)
|
||||
.to match_array(result)
|
||||
end
|
||||
|
||||
it 'returns all conferences if there are no active conferences' do
|
||||
|
|
@ -762,7 +757,7 @@ describe Conference do
|
|||
end
|
||||
|
||||
it 'return no conferences if there are only two conferences and no pending' do
|
||||
a = create(:conference, start_date: Time.now - 2.year, end_date: Time.now - 720.days)
|
||||
a = create(:conference, start_date: Time.now - 2.years, end_date: Time.now - 720.days)
|
||||
b = create(:conference, start_date: Time.now - 1.year, end_date: Time.now - 360.days)
|
||||
expect(Conference.get_conferences_without_active_for_dashboard([a, b])).to match_array([])
|
||||
end
|
||||
|
|
@ -801,11 +796,11 @@ describe Conference do
|
|||
end
|
||||
|
||||
describe '#event_distribution' do
|
||||
|
||||
before(:each) do
|
||||
@conference = create(
|
||||
:conference,
|
||||
email_settings: create(:email_settings))
|
||||
:conference,
|
||||
email_settings: create(:email_settings)
|
||||
)
|
||||
@conference.email_settings = create(:email_settings)
|
||||
|
||||
@options = {}
|
||||
|
|
@ -969,7 +964,6 @@ describe Conference do
|
|||
end
|
||||
|
||||
describe '#get_status' do
|
||||
|
||||
before(:each) do
|
||||
# Setup positive result hash
|
||||
@result = {}
|
||||
|
|
@ -983,7 +977,7 @@ describe Conference do
|
|||
@result['splashpage'] = true
|
||||
|
||||
# Setup negative result hash
|
||||
@result_false = Hash.new
|
||||
@result_false = {}
|
||||
@result.each { |key, value| @result_false[key] = !value }
|
||||
|
||||
@result['short_title'] = @result_false['short_title'] = subject.short_title
|
||||
|
|
@ -1037,7 +1031,7 @@ describe Conference do
|
|||
end
|
||||
|
||||
it 'calculates correct for conference with registration, cfp, venue' do
|
||||
expect(subject.end_date).to eq Date.new(2014, 06, 30)
|
||||
expect(subject.end_date).to eq Date.new(2014, 0o6, 30)
|
||||
subject.registration_period = create(:registration_period,
|
||||
start_date: subject.end_date - 14,
|
||||
end_date: subject.end_date, conference: subject)
|
||||
|
|
@ -1141,7 +1135,6 @@ describe Conference do
|
|||
end
|
||||
|
||||
describe '#registration_weeks' do
|
||||
|
||||
it 'calculates new year' do
|
||||
subject.registration_period = create(:registration_period,
|
||||
start_date: Date.new(2013, 12, 31),
|
||||
|
|
@ -1151,28 +1144,27 @@ describe Conference do
|
|||
|
||||
it 'is one if start and end are 6 days apart' do
|
||||
subject.registration_period = create(:registration_period,
|
||||
start_date: Date.new(2014, 05, 26),
|
||||
end_date: Date.new(2014, 05, 26) + 6, conference: subject)
|
||||
start_date: Date.new(2014, 0o5, 26),
|
||||
end_date: Date.new(2014, 0o5, 26) + 6, conference: subject)
|
||||
expect(subject.registration_weeks).to eq(1)
|
||||
end
|
||||
|
||||
it 'is one if start and end date are the same' do
|
||||
subject.registration_period = create(:registration_period,
|
||||
start_date: Date.new(2014, 05, 26),
|
||||
end_date: Date.new(2014, 05, 26), conference: subject)
|
||||
start_date: Date.new(2014, 0o5, 26),
|
||||
end_date: Date.new(2014, 0o5, 26), conference: subject)
|
||||
expect(subject.registration_weeks).to eq(1)
|
||||
end
|
||||
|
||||
it 'is two if start and end are 10 days apart' do
|
||||
subject.registration_period = create(:registration_period,
|
||||
start_date: Date.new(2014, 05, 17),
|
||||
end_date: Date.new(2014, 05, 15) + 10, conference: subject)
|
||||
start_date: Date.new(2014, 0o5, 17),
|
||||
end_date: Date.new(2014, 0o5, 15) + 10, conference: subject)
|
||||
expect(subject.registration_weeks).to eq(2)
|
||||
end
|
||||
end
|
||||
|
||||
describe '#cfp_weeks' do
|
||||
|
||||
it 'calculates new year' do
|
||||
cfp = create(:cfp, program: subject.program)
|
||||
cfp.start_date = Date.new(2013, 12, 30)
|
||||
|
|
@ -1183,228 +1175,224 @@ describe Conference do
|
|||
|
||||
it 'is one if start and end are 6 days apart' do
|
||||
cfp = create(:cfp, program: subject.program)
|
||||
cfp.start_date = Date.new(2014, 05, 26)
|
||||
cfp.end_date = Date.new(2014, 05, 26) + 6
|
||||
cfp.start_date = Date.new(2014, 0o5, 26)
|
||||
cfp.end_date = Date.new(2014, 0o5, 26) + 6
|
||||
cfp.save!
|
||||
expect(subject.cfp_weeks).to eq(1)
|
||||
end
|
||||
|
||||
it 'is one if start and end are the same date' do
|
||||
cfp = create(:cfp, program: subject.program)
|
||||
cfp.start_date = Date.new(2014, 05, 26)
|
||||
cfp.end_date = Date.new(2014, 05, 26)
|
||||
cfp.start_date = Date.new(2014, 0o5, 26)
|
||||
cfp.end_date = Date.new(2014, 0o5, 26)
|
||||
cfp.save!
|
||||
expect(subject.cfp_weeks).to eq(1)
|
||||
end
|
||||
|
||||
it 'is two if start and end are 10 days apart' do
|
||||
cfp = create(:cfp, program: subject.program)
|
||||
cfp.start_date = Date.new(2014, 05, 26)
|
||||
cfp.end_date = Date.new(2014, 05, 26) + 10
|
||||
cfp.start_date = Date.new(2014, 0o5, 26)
|
||||
cfp.end_date = Date.new(2014, 0o5, 26) + 10
|
||||
cfp.save!
|
||||
expect(subject.cfp_weeks).to eq(2)
|
||||
end
|
||||
end
|
||||
|
||||
describe '#get_submissions_per_week' do
|
||||
|
||||
it 'does calculate correct if cfp start date is altered' do
|
||||
cfp = create(:cfp, program: subject.program)
|
||||
cfp.start_date = Date.new(2014, 05, 26)
|
||||
cfp.end_date = Date.new(2014, 05, 26) + 21
|
||||
cfp.start_date = Date.new(2014, 0o5, 26)
|
||||
cfp.end_date = Date.new(2014, 0o5, 26) + 21
|
||||
cfp.save!
|
||||
subject.program.events += [create(:event, created_at: Date.new(2014, 05, 26) - 7)]
|
||||
subject.program.events += [create(:event, created_at: Date.new(2014, 0o5, 26) - 7)]
|
||||
expect(subject.get_submissions_per_week).to eq([1, 1, 1, 1, 1])
|
||||
end
|
||||
|
||||
it 'does calculate correct if cfp end date is altered' do
|
||||
cfp = create(:cfp, program: subject.program)
|
||||
cfp.start_date = Date.new(2014, 05, 26)
|
||||
cfp.end_date = Date.new(2014, 05, 26) + 21
|
||||
cfp.start_date = Date.new(2014, 0o5, 26)
|
||||
cfp.end_date = Date.new(2014, 0o5, 26) + 21
|
||||
cfp.save!
|
||||
subject.program.events += [create(:event, created_at: Date.new(2014, 05, 26) + 28)]
|
||||
subject.program.events += [create(:event, created_at: Date.new(2014, 0o5, 26) + 28)]
|
||||
expect(subject.get_submissions_per_week).to eq([0, 0, 0, 0, 1])
|
||||
end
|
||||
|
||||
it 'pads with zeros if there are no submissions' do
|
||||
cfp = create(:cfp, program: subject.program)
|
||||
cfp.start_date = Date.new(2014, 05, 26)
|
||||
cfp.end_date = Date.new(2014, 05, 26) + 21
|
||||
cfp.start_date = Date.new(2014, 0o5, 26)
|
||||
cfp.end_date = Date.new(2014, 0o5, 26) + 21
|
||||
cfp.save!
|
||||
expect(subject.get_submissions_per_week).to eq([0, 0, 0, 0])
|
||||
end
|
||||
|
||||
it 'summarized correct if there are no submissions in one week' do
|
||||
cfp = create(:cfp, program: subject.program)
|
||||
cfp.start_date = Date.new(2014, 05, 26)
|
||||
cfp.end_date = Date.new(2014, 05, 26) + 28
|
||||
cfp.start_date = Date.new(2014, 0o5, 26)
|
||||
cfp.end_date = Date.new(2014, 0o5, 26) + 28
|
||||
cfp.save!
|
||||
subject.program.events += [create(:event, created_at: Date.new(2014, 05, 26) + 7)]
|
||||
subject.program.events += [create(:event, created_at: Date.new(2014, 05, 26) + 14)]
|
||||
subject.program.events += [create(:event, created_at: Date.new(2014, 05, 26) + 28)]
|
||||
subject.program.events += [create(:event, created_at: Date.new(2014, 0o5, 26) + 7)]
|
||||
subject.program.events += [create(:event, created_at: Date.new(2014, 0o5, 26) + 14)]
|
||||
subject.program.events += [create(:event, created_at: Date.new(2014, 0o5, 26) + 28)]
|
||||
expect(subject.get_submissions_per_week).to eq([0, 1, 2, 2, 3])
|
||||
end
|
||||
|
||||
it 'summarized correct if there are submissions every week except the first' do
|
||||
cfp = create(:cfp, program: subject.program)
|
||||
cfp.start_date = Date.new(2014, 05, 26)
|
||||
cfp.end_date = Date.new(2014, 05, 26) + 21
|
||||
cfp.start_date = Date.new(2014, 0o5, 26)
|
||||
cfp.end_date = Date.new(2014, 0o5, 26) + 21
|
||||
cfp.save!
|
||||
subject.program.events += [create(:event, created_at: Date.new(2014, 05, 26) + 7)]
|
||||
subject.program.events += [create(:event, created_at: Date.new(2014, 05, 26) + 14)]
|
||||
subject.program.events += [create(:event, created_at: Date.new(2014, 0o5, 26) + 7)]
|
||||
subject.program.events += [create(:event, created_at: Date.new(2014, 0o5, 26) + 14)]
|
||||
expect(subject.get_submissions_per_week).to eq([0, 1, 2, 2])
|
||||
end
|
||||
|
||||
it 'summarized correct if there are submissions every week' do
|
||||
cfp = create(:cfp, program: subject.program)
|
||||
cfp.start_date = Date.new(2014, 05, 26)
|
||||
cfp.end_date = Date.new(2014, 05, 26) + 21
|
||||
cfp.start_date = Date.new(2014, 0o5, 26)
|
||||
cfp.end_date = Date.new(2014, 0o5, 26) + 21
|
||||
cfp.save!
|
||||
subject.program.events += [create(:event, created_at: Date.new(2014, 05, 26))]
|
||||
subject.program.events += [create(:event, created_at: Date.new(2014, 05, 26) + 7)]
|
||||
subject.program.events += [create(:event, created_at: Date.new(2014, 05, 26) + 14)]
|
||||
subject.program.events += [create(:event, created_at: Date.new(2014, 0o5, 26))]
|
||||
subject.program.events += [create(:event, created_at: Date.new(2014, 0o5, 26) + 7)]
|
||||
subject.program.events += [create(:event, created_at: Date.new(2014, 0o5, 26) + 14)]
|
||||
expect(subject.get_submissions_per_week).to eq([1, 2, 3, 3])
|
||||
end
|
||||
|
||||
it 'pads left' do
|
||||
cfp = create(:cfp, program: subject.program)
|
||||
cfp.start_date = Date.new(2014, 05, 26)
|
||||
cfp.end_date = Date.new(2014, 05, 26) + 21
|
||||
cfp.start_date = Date.new(2014, 0o5, 26)
|
||||
cfp.end_date = Date.new(2014, 0o5, 26) + 21
|
||||
cfp.save!
|
||||
subject.program.events += [create(:event, created_at: Date.new(2014, 05, 26) + 21)]
|
||||
subject.program.events += [create(:event, created_at: Date.new(2014, 0o5, 26) + 21)]
|
||||
expect(subject.get_submissions_per_week).to eq([0, 0, 0, 1])
|
||||
end
|
||||
|
||||
it 'pads middle' do
|
||||
cfp = create(:cfp, program: subject.program)
|
||||
cfp.start_date = Date.new(2014, 05, 26)
|
||||
cfp.end_date = Date.new(2014, 05, 26) + 21
|
||||
cfp.start_date = Date.new(2014, 0o5, 26)
|
||||
cfp.end_date = Date.new(2014, 0o5, 26) + 21
|
||||
cfp.save!
|
||||
subject.program.events += [create(:event, created_at: Date.new(2014, 05, 26))]
|
||||
subject.program.events += [create(:event, created_at: Date.new(2014, 05, 26) + 21)]
|
||||
subject.program.events += [create(:event, created_at: Date.new(2014, 0o5, 26))]
|
||||
subject.program.events += [create(:event, created_at: Date.new(2014, 0o5, 26) + 21)]
|
||||
expect(subject.get_submissions_per_week).to eq([1, 1, 1, 2])
|
||||
end
|
||||
|
||||
it 'pads right' do
|
||||
cfp = create(:cfp, program: subject.program)
|
||||
cfp.start_date = Date.new(2014, 05, 26)
|
||||
cfp.end_date = Date.new(2014, 05, 26) + 21
|
||||
cfp.start_date = Date.new(2014, 0o5, 26)
|
||||
cfp.end_date = Date.new(2014, 0o5, 26) + 21
|
||||
cfp.save!
|
||||
subject.program.events += [create(:event, created_at: Date.new(2014, 05, 26))]
|
||||
subject.program.events += [create(:event, created_at: Date.new(2014, 0o5, 26))]
|
||||
expect(subject.get_submissions_per_week).to eq([1, 1, 1, 1])
|
||||
end
|
||||
end
|
||||
|
||||
describe '#get_registrations_per_week' do
|
||||
|
||||
it 'pads with zeros if there are no registrations' do
|
||||
subject.registration_period = create(:registration_period,
|
||||
start_date: Date.new(2014, 05, 26),
|
||||
end_date: Date.new(2014, 05, 26) + 21, conference: subject)
|
||||
start_date: Date.new(2014, 0o5, 26),
|
||||
end_date: Date.new(2014, 0o5, 26) + 21, conference: subject)
|
||||
|
||||
expect(subject.get_registrations_per_week).to eq([0, 0, 0, 0])
|
||||
end
|
||||
|
||||
it 'summarized correct if there are no registrations in one week' do
|
||||
subject.registration_period = create(:registration_period,
|
||||
start_date: Date.new(2014, 05, 26),
|
||||
end_date: Date.new(2014, 05, 26) + 28, conference: subject)
|
||||
start_date: Date.new(2014, 0o5, 26),
|
||||
end_date: Date.new(2014, 0o5, 26) + 28, conference: subject)
|
||||
|
||||
create(:registration, conference: subject,
|
||||
created_at: Date.new(2014, 05, 26) + 7)
|
||||
created_at: Date.new(2014, 0o5, 26) + 7)
|
||||
create(:registration, conference: subject,
|
||||
created_at: Date.new(2014, 05, 26) + 14)
|
||||
created_at: Date.new(2014, 0o5, 26) + 14)
|
||||
create(:registration, conference: subject,
|
||||
created_at: Date.new(2014, 05, 26) + 28)
|
||||
created_at: Date.new(2014, 0o5, 26) + 28)
|
||||
|
||||
expect(subject.get_registrations_per_week).to eq([0, 1, 2, 2, 3])
|
||||
end
|
||||
|
||||
it 'returns [1] if there is one registration on the first day' do
|
||||
subject.registration_period = create(:registration_period,
|
||||
start_date: Date.new(2014, 05, 26),
|
||||
end_date: Date.new(2014, 05, 26) + 7, conference: subject)
|
||||
start_date: Date.new(2014, 0o5, 26),
|
||||
end_date: Date.new(2014, 0o5, 26) + 7, conference: subject)
|
||||
|
||||
create(:registration, conference: subject,
|
||||
created_at: Date.new(2014, 05, 26))
|
||||
created_at: Date.new(2014, 0o5, 26))
|
||||
expect(subject.get_registrations_per_week).to eq([1, 1])
|
||||
end
|
||||
|
||||
it 'summarized correct if there are registrations every week' do
|
||||
subject.registration_period = create(:registration_period,
|
||||
start_date: Date.new(2014, 05, 26),
|
||||
end_date: Date.new(2014, 05, 26) + 21, conference: subject)
|
||||
start_date: Date.new(2014, 0o5, 26),
|
||||
end_date: Date.new(2014, 0o5, 26) + 21, conference: subject)
|
||||
|
||||
create(:registration, conference: subject, created_at: Date.new(2014, 05, 26))
|
||||
create(:registration, conference: subject, created_at: Date.new(2014, 0o5, 26))
|
||||
create(:registration, conference: subject,
|
||||
created_at: Date.new(2014, 05, 26) + 7)
|
||||
created_at: Date.new(2014, 0o5, 26) + 7)
|
||||
create(:registration, conference: subject,
|
||||
created_at: Date.new(2014, 05, 26) + 14)
|
||||
created_at: Date.new(2014, 0o5, 26) + 14)
|
||||
|
||||
expect(subject.get_registrations_per_week).to eq([1, 2, 3, 3])
|
||||
end
|
||||
|
||||
it 'summarized correct if there are registrations every week except the first' do
|
||||
subject.registration_period = create(:registration_period,
|
||||
start_date: Date.new(2014, 05, 26),
|
||||
end_date: Date.new(2014, 05, 26) + 28, conference: subject)
|
||||
start_date: Date.new(2014, 0o5, 26),
|
||||
end_date: Date.new(2014, 0o5, 26) + 28, conference: subject)
|
||||
|
||||
create(:registration, conference: subject,
|
||||
created_at: Date.new(2014, 05, 26) + 7)
|
||||
created_at: Date.new(2014, 0o5, 26) + 7)
|
||||
create(:registration, conference: subject,
|
||||
created_at: Date.new(2014, 05, 26) + 14)
|
||||
created_at: Date.new(2014, 0o5, 26) + 14)
|
||||
create(:registration, conference: subject,
|
||||
created_at: Date.new(2014, 05, 26) + 28)
|
||||
created_at: Date.new(2014, 0o5, 26) + 28)
|
||||
|
||||
expect(subject.get_registrations_per_week).to eq([0, 1, 2, 2, 3])
|
||||
end
|
||||
|
||||
it 'pads left' do
|
||||
subject.registration_period = create(:registration_period,
|
||||
start_date: Date.new(2014, 05, 26),
|
||||
end_date: Date.new(2014, 05, 26) + 35, conference: subject)
|
||||
start_date: Date.new(2014, 0o5, 26),
|
||||
end_date: Date.new(2014, 0o5, 26) + 35, conference: subject)
|
||||
|
||||
create(:registration, conference: subject,
|
||||
created_at: Date.new(2014, 05, 26) + 21)
|
||||
created_at: Date.new(2014, 0o5, 26) + 21)
|
||||
create(:registration, conference: subject,
|
||||
created_at: Date.new(2014, 05, 26) + 28)
|
||||
created_at: Date.new(2014, 0o5, 26) + 28)
|
||||
create(:registration, conference: subject,
|
||||
created_at: Date.new(2014, 05, 26) + 35)
|
||||
created_at: Date.new(2014, 0o5, 26) + 35)
|
||||
|
||||
expect(subject.get_registrations_per_week).to eq([0, 0, 0, 1, 2, 3])
|
||||
end
|
||||
|
||||
it 'pads middle' do
|
||||
subject.registration_period = create(:registration_period,
|
||||
start_date: Date.new(2014, 05, 26),
|
||||
end_date: Date.new(2014, 05, 26) + 35, conference: subject)
|
||||
start_date: Date.new(2014, 0o5, 26),
|
||||
end_date: Date.new(2014, 0o5, 26) + 35, conference: subject)
|
||||
|
||||
create(:registration, conference: subject,
|
||||
created_at: Date.new(2014, 05, 26))
|
||||
created_at: Date.new(2014, 0o5, 26))
|
||||
create(:registration, conference: subject,
|
||||
created_at: Date.new(2014, 05, 26) + 35)
|
||||
created_at: Date.new(2014, 0o5, 26) + 35)
|
||||
|
||||
expect(subject.get_registrations_per_week).to eq([1, 1, 1, 1, 1, 2])
|
||||
end
|
||||
|
||||
it 'pads right' do
|
||||
subject.registration_period = create(:registration_period,
|
||||
start_date: Date.new(2014, 05, 26),
|
||||
end_date: Date.new(2014, 05, 26) + 35, conference: subject)
|
||||
start_date: Date.new(2014, 0o5, 26),
|
||||
end_date: Date.new(2014, 0o5, 26) + 35, conference: subject)
|
||||
|
||||
create(:registration, conference: subject,
|
||||
created_at: Date.new(2014, 05, 26))
|
||||
created_at: Date.new(2014, 0o5, 26))
|
||||
create(:registration, conference: subject,
|
||||
created_at: Date.new(2014, 05, 26) + 7)
|
||||
created_at: Date.new(2014, 0o5, 26) + 7)
|
||||
|
||||
expect(subject.get_registrations_per_week).to eq([1, 2, 2, 2, 2, 2])
|
||||
end
|
||||
end
|
||||
|
||||
describe '#pending?' do
|
||||
|
||||
context 'is pending' do
|
||||
|
||||
it '#pending? is true' do
|
||||
subject.start_date = Date.today + 10
|
||||
expect(subject.pending?).to be true
|
||||
|
|
@ -1412,7 +1400,6 @@ describe Conference do
|
|||
end
|
||||
|
||||
context 'is not pending' do
|
||||
|
||||
it '#pending? is false' do
|
||||
subject.start_date = Date.today - 10
|
||||
expect(subject.pending?).to be false
|
||||
|
|
@ -1421,16 +1408,13 @@ describe Conference do
|
|||
end
|
||||
|
||||
describe '#registration_open?' do
|
||||
|
||||
context 'closed registration' do
|
||||
|
||||
it '#registration_open? is false' do
|
||||
expect(subject.registration_open?).to be false
|
||||
end
|
||||
end
|
||||
|
||||
context 'open registration' do
|
||||
|
||||
before do
|
||||
subject.end_date = Date.today + 7
|
||||
enrollment = create(:registration_period,
|
||||
|
|
@ -1446,17 +1430,13 @@ describe Conference do
|
|||
end
|
||||
|
||||
describe '#cfp_open?' do
|
||||
|
||||
context 'closed cfp' do
|
||||
|
||||
it '#cfp_open? is false' do
|
||||
expect(subject.program.cfp_open?).to be false
|
||||
end
|
||||
|
||||
end
|
||||
|
||||
context 'open cfp' do
|
||||
|
||||
before do
|
||||
create(:cfp, program: subject.program)
|
||||
end
|
||||
|
|
@ -1468,7 +1448,6 @@ describe Conference do
|
|||
end
|
||||
|
||||
describe '#user_registered?' do
|
||||
|
||||
# It is necessary to use bang version of let to build roles before user
|
||||
let!(:conference) { create(:conference) }
|
||||
let!(:organizer_role) { Role.find_by(name: 'organizer', resource: conference) }
|
||||
|
|
@ -1478,13 +1457,13 @@ describe Conference do
|
|||
|
||||
context 'user not registered' do
|
||||
it '#user_registered? is false' do
|
||||
expect(subject.user_registered? user).to be false
|
||||
expect(subject.user_registered?(user)).to be false
|
||||
end
|
||||
end
|
||||
|
||||
context 'user is nil' do
|
||||
it '#user_registered? is false' do
|
||||
expect(subject.user_registered? user).to be false
|
||||
expect(subject.user_registered?(user)).to be false
|
||||
end
|
||||
end
|
||||
|
||||
|
|
@ -1496,7 +1475,7 @@ describe Conference do
|
|||
end
|
||||
|
||||
it '#user_registered? is true' do
|
||||
expect(subject.user_registered? user).to be true
|
||||
expect(subject.user_registered?(user)).to be true
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
@ -1544,7 +1523,6 @@ describe Conference do
|
|||
end
|
||||
|
||||
describe 'validations' do
|
||||
|
||||
it 'has a valid factory' do
|
||||
expect(build(:conference)).to be_valid
|
||||
end
|
||||
|
|
@ -1598,14 +1576,12 @@ describe Conference do
|
|||
end
|
||||
|
||||
describe 'valid_date_range?' do
|
||||
|
||||
it 'is not valid if start date is greater than end date' do
|
||||
expect(subject.start_date).to be <= subject.end_date
|
||||
end
|
||||
end
|
||||
|
||||
describe 'valid_times_range?' do
|
||||
|
||||
it 'is not valid if start hour is lower than 0' do
|
||||
expect(subject.start_hour).to be >= 0
|
||||
end
|
||||
|
|
@ -1620,7 +1596,6 @@ describe Conference do
|
|||
end
|
||||
|
||||
describe 'before create callbacks' do
|
||||
|
||||
it 'has an email setting after creation' do
|
||||
expect(subject.email_settings).not_to be_nil
|
||||
end
|
||||
|
|
@ -1651,13 +1626,13 @@ describe Conference do
|
|||
it 'delete event schedules that are not in hour ranges, when conference start hour is updated' do
|
||||
scheduled_event_before_conference
|
||||
conference.start_hour = conference.start_hour + 1
|
||||
expect{ conference.save }.to change{ EventSchedule.count }.from(2).to(1)
|
||||
expect { conference.save }.to change { EventSchedule.count }.from(2).to(1)
|
||||
end
|
||||
|
||||
it 'delete event schedules that are not in hour ranges, when conference end hour is updated' do
|
||||
scheduled_event_after_conference
|
||||
conference.end_hour = conference.end_hour - 2
|
||||
expect{ conference.save }.to change{ EventSchedule.count }.from(2).to(1)
|
||||
expect { conference.save }.to change { EventSchedule.count }.from(2).to(1)
|
||||
end
|
||||
end
|
||||
|
||||
|
|
@ -1669,28 +1644,28 @@ describe Conference do
|
|||
|
||||
it 'for change in conference' do
|
||||
subject.title = 'changed'
|
||||
expect{ subject.save }.to change { subject.revision }.by(1)
|
||||
expect { subject.save }.to change { subject.revision }.by(1)
|
||||
end
|
||||
|
||||
it 'for change in event' do
|
||||
event.title = 'changed'
|
||||
expect{ event.save }.to change { subject.revision }.by(1)
|
||||
expect { event.save }.to change { subject.revision }.by(1)
|
||||
end
|
||||
|
||||
it 'for change in track' do
|
||||
track.name = 'changed'
|
||||
expect{ track.save }.to change { subject.revision }.by(1)
|
||||
expect { track.save }.to change { subject.revision }.by(1)
|
||||
end
|
||||
|
||||
it 'for change in room' do
|
||||
room.name = 'changed'
|
||||
expect{ room.save }.to change { subject.revision }.by(1)
|
||||
expect { room.save }.to change { subject.revision }.by(1)
|
||||
end
|
||||
end
|
||||
|
||||
describe '.upcoming' do
|
||||
let!(:upcoming_conference) { create(:conference) }
|
||||
let!(:past_conference) { create(:conference, start_date: Date.current - 1.days, end_date: Date.current - 1.days) }
|
||||
let!(:past_conference) { create(:conference, start_date: Date.current - 1.day, end_date: Date.current - 1.day) }
|
||||
subject { Conference.upcoming }
|
||||
|
||||
it { is_expected.to eq [upcoming_conference] }
|
||||
|
|
@ -1698,8 +1673,8 @@ describe Conference do
|
|||
|
||||
describe '.past' do
|
||||
let!(:upcoming_conference) { create(:conference) }
|
||||
let!(:past_conference1) { create(:conference, start_date: Date.current - 1.days, end_date: Date.current - 1.days) }
|
||||
let!(:past_conference2) { create(:conference, start_date: Date.current - 2.days, end_date: Date.current - 1.days) }
|
||||
let!(:past_conference1) { create(:conference, start_date: Date.current - 1.day, end_date: Date.current - 1.day) }
|
||||
let!(:past_conference2) { create(:conference, start_date: Date.current - 2.days, end_date: Date.current - 1.day) }
|
||||
subject { Conference.past }
|
||||
|
||||
it { is_expected.to eq [past_conference1, past_conference2] }
|
||||
|
|
|
|||
|
|
@ -1,7 +1,9 @@
|
|||
# frozen_string_literal: true
|
||||
|
||||
require 'spec_helper'
|
||||
|
||||
describe EmailSettings do
|
||||
let(:conference) { create(:conference, short_title: 'goto', start_date: Date.new(2014, 05, 01), end_date: Date.new(2014, 05, 06)) }
|
||||
let(:conference) { create(:conference, short_title: 'goto', start_date: Date.new(2014, 0o5, 0o1), end_date: Date.new(2014, 0o5, 0o6)) }
|
||||
let(:user) { create(:user, username: 'johnd', email: 'john@doe.com', name: 'John Doe') }
|
||||
let(:event) { create(:event, program: conference.program, title: 'Talk about talks', submitter: user) }
|
||||
let(:expected_hash) do
|
||||
|
|
@ -9,8 +11,8 @@ describe EmailSettings do
|
|||
'email' => 'john@doe.com',
|
||||
'name' => 'John Doe',
|
||||
'conference' => conference.title,
|
||||
'conference_start_date' => Date.new(2014, 05, 01),
|
||||
'conference_end_date' => Date.new(2014, 05, 06),
|
||||
'conference_start_date' => Date.new(2014, 0o5, 0o1),
|
||||
'conference_end_date' => Date.new(2014, 0o5, 0o6),
|
||||
'registrationlink' => 'http://localhost:3000/conferences/goto/register',
|
||||
'conference_splash_link' => 'http://localhost:3000/conferences/goto',
|
||||
'schedule_link' => 'http://localhost:3000/conferences/goto/schedule',
|
||||
|
|
@ -34,7 +36,7 @@ describe EmailSettings do
|
|||
|
||||
context 'user does not have name' do
|
||||
before do
|
||||
user.update_attributes(name: nil)
|
||||
user.update(name: nil)
|
||||
username_hash = { 'name' => 'johnd' }
|
||||
expected_hash.merge!(username_hash)
|
||||
end
|
||||
|
|
@ -47,10 +49,10 @@ describe EmailSettings do
|
|||
context 'conference has cfp' do
|
||||
before do
|
||||
create(:cfp,
|
||||
start_date: Date.new(2014, 04, 29),
|
||||
end_date: Date.new(2014, 05, 06),
|
||||
start_date: Date.new(2014, 0o4, 29),
|
||||
end_date: Date.new(2014, 0o5, 0o6),
|
||||
program: conference.program)
|
||||
cfp_dates_hash = { 'cfp_start_date' => Date.new(2014, 04, 29), 'cfp_end_date' => Date.new(2014, 05, 06) }
|
||||
cfp_dates_hash = { 'cfp_start_date' => Date.new(2014, 0o4, 29), 'cfp_end_date' => Date.new(2014, 0o5, 0o6) }
|
||||
expected_hash.merge!(cfp_dates_hash)
|
||||
end
|
||||
|
||||
|
|
@ -61,7 +63,7 @@ describe EmailSettings do
|
|||
|
||||
context 'conference has venue' do
|
||||
before do
|
||||
conference.update_attributes(venue: create(:venue))
|
||||
conference.update(venue: create(:venue))
|
||||
venue_hash = { 'venue' => conference.venue.name, 'venue_address' => conference.venue.address }
|
||||
expected_hash.merge!(venue_hash)
|
||||
end
|
||||
|
|
@ -73,10 +75,10 @@ describe EmailSettings do
|
|||
|
||||
context 'conference has registration period' do
|
||||
before do
|
||||
conference.update_attributes(registration_period: create(:registration_period,
|
||||
start_date: Date.new(2014, 05, 03),
|
||||
end_date: Date.new(2014, 05, 05)))
|
||||
registration_period_hash = { 'registration_start_date' => Date.new(2014, 05, 03), 'registration_end_date' => Date.new(2014, 05, 05) }
|
||||
conference.update(registration_period: create(:registration_period,
|
||||
start_date: Date.new(2014, 0o5, 0o3),
|
||||
end_date: Date.new(2014, 0o5, 0o5)))
|
||||
registration_period_hash = { 'registration_start_date' => Date.new(2014, 0o5, 0o3), 'registration_end_date' => Date.new(2014, 0o5, 0o5) }
|
||||
expected_hash.merge!(registration_period_hash)
|
||||
end
|
||||
|
||||
|
|
|
|||
|
|
@ -1,3 +1,5 @@
|
|||
# frozen_string_literal: true
|
||||
|
||||
require 'spec_helper'
|
||||
|
||||
describe EventSchedule do
|
||||
|
|
|
|||
|
|
@ -1,3 +1,5 @@
|
|||
# frozen_string_literal: true
|
||||
|
||||
require 'spec_helper'
|
||||
|
||||
describe Event do
|
||||
|
|
@ -295,7 +297,7 @@ describe Event do
|
|||
it 'counts words in abstract' do
|
||||
event = build(:event)
|
||||
expect(event.abstract_word_count).to eq(event.abstract.to_s.split.size)
|
||||
event.update_attributes!(abstract: 'abstract.')
|
||||
event.update!(abstract: 'abstract.')
|
||||
expect(event.abstract_word_count).to eq(1)
|
||||
end
|
||||
|
||||
|
|
@ -315,16 +317,15 @@ describe Event do
|
|||
end
|
||||
end
|
||||
|
||||
states = [:new, :withdrawn, :unconfirmed, :confirmed, :canceled, :rejected]
|
||||
transitions = [:restart, :withdraw, :accept, :confirm, :cancel, :reject]
|
||||
states = %i[new withdrawn unconfirmed confirmed canceled rejected]
|
||||
transitions = %i[restart withdraw accept confirm cancel reject]
|
||||
|
||||
states_transitions = { new: { restart: false, withdraw: true, accept: true, confirm: false, cancel: false, reject: true},
|
||||
withdrawn: { restart: true, withdraw: false, accept: false, confirm: false, cancel: false, reject: false},
|
||||
unconfirmed: { restart: false, withdraw: true, accept: false, confirm: true, cancel: true, reject: false},
|
||||
confirmed: { restart: false, withdraw: true, accept: false, confirm: false, cancel: true, reject: false},
|
||||
canceled: { restart: true, withdraw: false, accept: false, confirm: false, cancel: false, reject: false},
|
||||
rejected: { restart: true, withdraw: false, accept: false, confirm: false, cancel: false, reject: false}
|
||||
}
|
||||
states_transitions = { new: { restart: false, withdraw: true, accept: true, confirm: false, cancel: false, reject: true },
|
||||
withdrawn: { restart: true, withdraw: false, accept: false, confirm: false, cancel: false, reject: false },
|
||||
unconfirmed: { restart: false, withdraw: true, accept: false, confirm: true, cancel: true, reject: false },
|
||||
confirmed: { restart: false, withdraw: true, accept: false, confirm: false, cancel: true, reject: false },
|
||||
canceled: { restart: true, withdraw: false, accept: false, confirm: false, cancel: false, reject: false },
|
||||
rejected: { restart: true, withdraw: false, accept: false, confirm: false, cancel: false, reject: false } }
|
||||
|
||||
states.each do |state|
|
||||
transitions.each do |transition|
|
||||
|
|
|
|||
|
|
@ -1,3 +1,5 @@
|
|||
# frozen_string_literal: true
|
||||
|
||||
require 'spec_helper'
|
||||
|
||||
describe EventType do
|
||||
|
|
|
|||
|
|
@ -1,3 +1,5 @@
|
|||
# frozen_string_literal: true
|
||||
|
||||
require 'spec_helper'
|
||||
|
||||
describe Openid do
|
||||
|
|
|
|||
|
|
@ -1,3 +1,5 @@
|
|||
# frozen_string_literal: true
|
||||
|
||||
require 'spec_helper'
|
||||
|
||||
describe Organization do
|
||||
|
|
|
|||
|
|
@ -1,8 +1,9 @@
|
|||
# frozen_string_literal: true
|
||||
|
||||
require 'spec_helper'
|
||||
require 'stripe_mock'
|
||||
|
||||
describe Payment do
|
||||
|
||||
context 'new payment' do
|
||||
let(:payment) { create(:payment) }
|
||||
it 'sets status to "unpaid" by default' do
|
||||
|
|
@ -38,7 +39,7 @@ describe Payment do
|
|||
let!(:user) { create(:user) }
|
||||
let!(:conference) { create(:conference) }
|
||||
let!(:ticket_1) { create(:ticket, price: 10, price_currency: 'USD', conference: conference) }
|
||||
let!(:tickets) { {ticket_1.id.to_s => '2'} }
|
||||
let!(:tickets) { { ticket_1.id.to_s => '2' } }
|
||||
let(:stripe_helper) { StripeMock.create_test_helper }
|
||||
|
||||
before { StripeMock.start }
|
||||
|
|
@ -90,42 +91,42 @@ describe Payment do
|
|||
context 'when the connection to Stripe drops' do
|
||||
it 'raises exception' do
|
||||
StripeMock.prepare_error(Stripe::APIConnectionError.new)
|
||||
expect{ payment.purchase }.not_to raise_error
|
||||
expect { payment.purchase }.not_to raise_error
|
||||
end
|
||||
end
|
||||
|
||||
context 'when there is a Stripe API Error' do
|
||||
it 'raises exception' do
|
||||
StripeMock.prepare_error(Stripe::APIError.new)
|
||||
expect{ payment.purchase }.not_to raise_error
|
||||
expect { payment.purchase }.not_to raise_error
|
||||
end
|
||||
end
|
||||
|
||||
context 'when there is authentication error' do
|
||||
it 'raises exception' do
|
||||
StripeMock.prepare_error(Stripe::AuthenticationError.new)
|
||||
expect{ payment.purchase }.not_to raise_error
|
||||
expect { payment.purchase }.not_to raise_error
|
||||
end
|
||||
end
|
||||
|
||||
context 'when there is a card error' do
|
||||
it 'raises exception' do
|
||||
StripeMock.prepare_card_error(:card_declined)
|
||||
expect{ payment.purchase }.not_to raise_error
|
||||
expect { payment.purchase }.not_to raise_error
|
||||
end
|
||||
end
|
||||
|
||||
context 'when the request to Stripe is invalid' do
|
||||
it 'raises exception' do
|
||||
StripeMock.prepare_error(Stripe::InvalidRequestError.new('Your request is invalid.', code: 402))
|
||||
expect{ payment.purchase }.not_to raise_error
|
||||
expect { payment.purchase }.not_to raise_error
|
||||
end
|
||||
end
|
||||
|
||||
context 'when Stripe rate limit exceeds' do
|
||||
it 'raises exception' do
|
||||
StripeMock.prepare_error(Stripe::RateLimitError.new)
|
||||
expect{ payment.purchase }.not_to raise_error
|
||||
expect { payment.purchase }.not_to raise_error
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
|
|||
|
|
@ -1,7 +1,8 @@
|
|||
# frozen_string_literal: true
|
||||
|
||||
require 'spec_helper'
|
||||
|
||||
describe PhysicalTicket do
|
||||
|
||||
describe 'association' do
|
||||
it { is_expected.to belong_to :ticket_purchase }
|
||||
end
|
||||
|
|
|
|||
|
|
@ -1,3 +1,5 @@
|
|||
# frozen_string_literal: true
|
||||
|
||||
require 'spec_helper'
|
||||
|
||||
describe Program do
|
||||
|
|
@ -198,8 +200,8 @@ describe Program do
|
|||
program.schedule_interval = 5
|
||||
program.save!
|
||||
|
||||
program.event_types.first.update_attributes length: 5
|
||||
program.event_types.last.update_attributes length: 25
|
||||
program.event_types.first.update length: 5
|
||||
program.event_types.last.update length: 25
|
||||
create(:event_type, program: program, length: 30)
|
||||
|
||||
program.schedule_interval = 10
|
||||
|
|
@ -237,13 +239,12 @@ describe Program do
|
|||
describe '#languages_list' do
|
||||
it 'returns the list of readable languages' do
|
||||
program.languages = 'en,de,fr,ru,zh'
|
||||
expect(program.languages_list).to eq %w(English German French Russian Chinese)
|
||||
expect(program.languages_list).to eq %w[English German French Russian Chinese]
|
||||
end
|
||||
end
|
||||
|
||||
describe '#any_event_for_this_date?' do
|
||||
|
||||
let(:event){ create(:event, program: program) }
|
||||
let(:event) { create(:event, program: program) }
|
||||
|
||||
context 'when no schedule is selected for the conference' do
|
||||
let(:schedule) { create(:schedule, program: program) }
|
||||
|
|
|
|||
|
|
@ -1,3 +1,5 @@
|
|||
# frozen_string_literal: true
|
||||
|
||||
require 'spec_helper'
|
||||
|
||||
describe RegistrationPeriod do
|
||||
|
|
|
|||
|
|
@ -1,3 +1,5 @@
|
|||
# frozen_string_literal: true
|
||||
|
||||
require 'spec_helper'
|
||||
|
||||
describe 'Registration' do
|
||||
|
|
@ -61,7 +63,7 @@ describe 'Registration' do
|
|||
end
|
||||
|
||||
describe '#week' do
|
||||
before { subject.created_at = Date.new(2014, 06, 30) }
|
||||
before { subject.created_at = Date.new(2014, 0o6, 30) }
|
||||
|
||||
it 'returns week number of created_at' do
|
||||
expect(subject.week).to eq(26)
|
||||
|
|
|
|||
|
|
@ -1,3 +1,5 @@
|
|||
# frozen_string_literal: true
|
||||
|
||||
require 'spec_helper'
|
||||
|
||||
describe Resource do
|
||||
|
|
|
|||
|
|
@ -1,3 +1,5 @@
|
|||
# frozen_string_literal: true
|
||||
|
||||
require 'spec_helper'
|
||||
|
||||
describe Role do
|
||||
|
|
|
|||
|
|
@ -1,3 +1,5 @@
|
|||
# frozen_string_literal: true
|
||||
|
||||
require 'spec_helper'
|
||||
|
||||
describe Room do
|
||||
|
|
|
|||
|
|
@ -1,7 +1,8 @@
|
|||
# frozen_string_literal: true
|
||||
|
||||
require 'spec_helper'
|
||||
|
||||
describe Schedule do
|
||||
|
||||
describe 'association' do
|
||||
it { should belong_to(:program) }
|
||||
it { should belong_to(:track) }
|
||||
|
|
|
|||
|
|
@ -1,3 +1,5 @@
|
|||
# frozen_string_literal: true
|
||||
|
||||
require 'spec_helper'
|
||||
|
||||
describe Sponsor do
|
||||
|
|
|
|||
|
|
@ -1,8 +1,9 @@
|
|||
# frozen_string_literal: true
|
||||
|
||||
require 'spec_helper'
|
||||
|
||||
describe SponsorshipLevel do
|
||||
describe 'validation' do
|
||||
|
||||
it 'has a valid factory' do
|
||||
expect(build(:sponsorship_level)).to be_valid
|
||||
end
|
||||
|
|
|
|||
|
|
@ -1,3 +1,5 @@
|
|||
# frozen_string_literal: true
|
||||
|
||||
require 'spec_helper'
|
||||
|
||||
describe Target do
|
||||
|
|
|
|||
|
|
@ -1,7 +1,8 @@
|
|||
# frozen_string_literal: true
|
||||
|
||||
require 'spec_helper'
|
||||
|
||||
describe TicketPurchase do
|
||||
|
||||
describe 'validations' do
|
||||
it 'has a valid factory' do
|
||||
expect(build(:ticket_purchase)).to be_valid
|
||||
|
|
|
|||
|
|
@ -1,3 +1,5 @@
|
|||
# frozen_string_literal: true
|
||||
|
||||
require 'spec_helper'
|
||||
|
||||
describe TicketScanning do
|
||||
|
|
|
|||
|
|
@ -1,3 +1,5 @@
|
|||
# frozen_string_literal: true
|
||||
|
||||
require 'spec_helper'
|
||||
|
||||
describe Ticket do
|
||||
|
|
@ -6,7 +8,6 @@ describe Ticket do
|
|||
let(:user) { create(:user) }
|
||||
|
||||
describe 'validation' do
|
||||
|
||||
it 'has a valid factory' do
|
||||
expect(build(:ticket)).to be_valid
|
||||
end
|
||||
|
|
@ -80,14 +81,13 @@ describe Ticket do
|
|||
let!(:ticket_purchase) { create(:ticket_purchase, user: user, ticket: ticket) }
|
||||
|
||||
context 'user has not paid' do
|
||||
|
||||
it 'returns true' do
|
||||
expect(ticket.unpaid?(user)).to eq(true)
|
||||
end
|
||||
end
|
||||
|
||||
context 'user has paid' do
|
||||
before { ticket_purchase.update_attributes(paid: true) }
|
||||
before { ticket_purchase.update(paid: true) }
|
||||
|
||||
it 'returns false' do
|
||||
expect(ticket.unpaid?(user)).to eq(false)
|
||||
|
|
@ -123,7 +123,7 @@ describe Ticket do
|
|||
|
||||
context 'user has paid' do
|
||||
let!(:ticket_purchase) { create(:ticket_purchase, user: user, ticket: ticket, quantity: 20) }
|
||||
before { ticket_purchase.update_attributes(paid: true) }
|
||||
before { ticket_purchase.update(paid: true) }
|
||||
|
||||
it 'returns the correct value if the user has bought and paid for this ticket' do
|
||||
expect(ticket.quantity_bought_by(user, paid: true)).to eq(20)
|
||||
|
|
@ -138,7 +138,7 @@ describe Ticket do
|
|||
user: user,
|
||||
ticket: ticket,
|
||||
quantity: 20)
|
||||
expect(ticket.total_price(user, paid: false)).to eq(Money.new(100000, 'USD'))
|
||||
expect(ticket.total_price(user, paid: false)).to eq(Money.new(100_000, 'USD'))
|
||||
end
|
||||
|
||||
it 'returns zero if the user has not bought this ticket' do
|
||||
|
|
@ -148,10 +148,10 @@ describe Ticket do
|
|||
|
||||
context 'user has paid' do
|
||||
let!(:ticket_purchase) { create(:ticket_purchase, user: user, ticket: ticket, quantity: 20) }
|
||||
before { ticket_purchase.update_attributes(paid: true) }
|
||||
before { ticket_purchase.update(paid: true) }
|
||||
|
||||
it 'returns the correct value if the user has bought this ticket' do
|
||||
expect(ticket.total_price(user, paid: true)).to eq(Money.new(100000, 'USD'))
|
||||
expect(ticket.total_price(user, paid: true)).to eq(Money.new(100_000, 'USD'))
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
@ -172,7 +172,7 @@ describe Ticket do
|
|||
end
|
||||
|
||||
it 'returns the correct total price' do
|
||||
expect(Ticket.total_price(conference, user, paid: false)).to eq(Money.new(100000, 'USD'))
|
||||
expect(Ticket.total_price(conference, user, paid: false)).to eq(Money.new(100_000, 'USD'))
|
||||
end
|
||||
end
|
||||
|
||||
|
|
@ -183,7 +183,7 @@ describe Ticket do
|
|||
end
|
||||
|
||||
it 'returns the correct total price' do
|
||||
total_price = Money.new(200000, 'USD')
|
||||
total_price = Money.new(200_000, 'USD')
|
||||
expect(Ticket.total_price(conference, user, paid: false)).to eq(total_price)
|
||||
end
|
||||
end
|
||||
|
|
@ -206,7 +206,7 @@ describe Ticket do
|
|||
|
||||
it 'should allow currency update' do
|
||||
free_ticket = Ticket.first
|
||||
expect { free_ticket.update_attributes(price_currency: 'INR') }.to change { free_ticket.reload.price_currency }.from('USD').to('INR')
|
||||
expect { free_ticket.update(price_currency: 'INR') }.to change { free_ticket.reload.price_currency }.from('USD').to('INR')
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
|
|||
|
|
@ -1,3 +1,5 @@
|
|||
# frozen_string_literal: true
|
||||
|
||||
require 'spec_helper'
|
||||
|
||||
describe Track do
|
||||
|
|
@ -321,8 +323,8 @@ describe Track do
|
|||
end
|
||||
end
|
||||
|
||||
states = [:new, :to_accept, :accepted, :confirmed, :to_reject, :rejected, :canceled, :withdrawn]
|
||||
transitions = [:restart, :to_accept, :accept, :confirm, :to_reject, :reject, :cancel, :withdraw]
|
||||
states = %i[new to_accept accepted confirmed to_reject rejected canceled withdrawn]
|
||||
transitions = %i[restart to_accept accept confirm to_reject reject cancel withdraw]
|
||||
|
||||
states_transitions = { new: { restart: false, to_accept: true, accept: true, confirm: false, to_reject: true, reject: true, cancel: false, withdraw: true },
|
||||
to_accept: { restart: false, to_accept: false, accept: true, confirm: false, to_reject: true, reject: false, cancel: true, withdraw: true },
|
||||
|
|
|
|||
|
|
@ -1,7 +1,8 @@
|
|||
# frozen_string_literal: true
|
||||
|
||||
require 'spec_helper'
|
||||
|
||||
describe User do
|
||||
|
||||
let(:user_admin) { create(:admin) }
|
||||
let(:conference) { create(:conference, short_title: 'oSC16', title: 'openSUSE Conference 2016') }
|
||||
let(:conference2) { create(:conference, short_title: 'oSC15', title: 'openSUSE Conference 2015') }
|
||||
|
|
@ -103,7 +104,7 @@ describe User do
|
|||
describe '#attended_event?' do
|
||||
context 'user has attended to the event' do
|
||||
before do
|
||||
events_registration.update_attributes(attended: true)
|
||||
events_registration.update(attended: true)
|
||||
end
|
||||
|
||||
it 'returns true' do
|
||||
|
|
@ -186,7 +187,7 @@ describe User do
|
|||
end
|
||||
|
||||
describe '.for_ichain_username' do
|
||||
before { user.update_attributes(current_sign_in_at: Date.new(2014, 12, 12)) }
|
||||
before { user.update(current_sign_in_at: Date.new(2014, 12, 12)) }
|
||||
|
||||
context 'user exists' do
|
||||
it 'updates last_sign_in_at of user' do
|
||||
|
|
@ -205,10 +206,10 @@ describe User do
|
|||
end
|
||||
|
||||
context 'user is disabled' do
|
||||
before { user.update_attributes(is_disabled: true) }
|
||||
before { user.update(is_disabled: true) }
|
||||
|
||||
it 'User.for_ichain_username raises exception if user is disabled' do
|
||||
expect{ User.for_ichain_username(user.username, email: user.email) }
|
||||
expect { User.for_ichain_username(user.username, email: user.email) }
|
||||
.to raise_error(UserDisabled)
|
||||
end
|
||||
end
|
||||
|
|
@ -217,14 +218,14 @@ describe User do
|
|||
describe '.find_for_database_authentication' do
|
||||
context 'login with username' do
|
||||
it 'can find user by jumbled username' do
|
||||
scrambled_username = user.username.chars.map{|c| rand > 0.5 ? c.capitalize : c}.join
|
||||
scrambled_username = user.username.chars.map { |c| rand > 0.5 ? c.capitalize : c }.join
|
||||
expect(User.find_for_database_authentication(login: scrambled_username)).to eq(user)
|
||||
end
|
||||
end
|
||||
|
||||
context 'login with email' do
|
||||
it 'can find user by jumbled email' do
|
||||
scrambled_email = user.email.chars.map{|c| rand > 0.5 ? c.capitalize : c}.join
|
||||
scrambled_email = user.email.chars.map { |c| rand > 0.5 ? c.capitalize : c }.join
|
||||
expect(User.find_for_database_authentication(login: scrambled_email)).to eq(user)
|
||||
end
|
||||
end
|
||||
|
|
@ -242,8 +243,7 @@ describe User do
|
|||
credentials: {
|
||||
token: 'mock_token',
|
||||
secret: 'mock_secret'
|
||||
}
|
||||
)
|
||||
})
|
||||
end
|
||||
|
||||
context 'user is not signed in' do
|
||||
|
|
@ -277,7 +277,7 @@ describe User do
|
|||
let(:conf2_organizer_role) { Role.find_by(name: 'organizer', resource: conference2) }
|
||||
|
||||
before do
|
||||
user.update_attributes(role_ids: [organizer_role.id, cfp_role.id, conf2_organizer_role.id])
|
||||
user.update(role_ids: [organizer_role.id, cfp_role.id, conf2_organizer_role.id])
|
||||
end
|
||||
|
||||
it 'returns hash of role and conference' do
|
||||
|
|
@ -336,7 +336,7 @@ describe User do
|
|||
end
|
||||
|
||||
context 'unconfirmed user' do
|
||||
before { user.update_attributes(confirmed_at: nil) }
|
||||
before { user.update(confirmed_at: nil) }
|
||||
|
||||
it 'returns false' do
|
||||
expect(user.confirmed?).to eq false
|
||||
|
|
@ -450,7 +450,7 @@ describe User do
|
|||
|
||||
describe '.omniauth_providers' do
|
||||
it 'contains providers' do
|
||||
expect(User.omniauth_providers).to eq [:suse, :google, :facebook, :github]
|
||||
expect(User.omniauth_providers).to eq %i[suse google facebook github]
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue