Add model-test for access of schedule_public and not_public_schedule to different user roles
This commit is contained in:
parent
f2af6188a1
commit
bf4189132a
1 changed files with 19 additions and 0 deletions
|
|
@ -24,6 +24,7 @@ describe 'User' do
|
||||||
let(:conference_public) { create(:full_conference, splashpage: create(:splashpage, public: true)) }
|
let(:conference_public) { create(:full_conference, splashpage: create(:splashpage, public: true)) }
|
||||||
let!(:conference_public_cfp) { create(:cfp, program: conference_public.program) }
|
let!(:conference_public_cfp) { create(:cfp, program: conference_public.program) }
|
||||||
|
|
||||||
|
# Other schedule which is either public or not_public.
|
||||||
let(:schedule_public) { create(:schedule, program: create(:program, schedule_public: true))}
|
let(:schedule_public) { create(:schedule, program: create(:program, schedule_public: true))}
|
||||||
let(:schedule_not_public) { create(:schedule, program: create(:program, schedule_public: false))}
|
let(:schedule_not_public) { create(:schedule, program: create(:program, schedule_public: false))}
|
||||||
|
|
||||||
|
|
@ -101,6 +102,9 @@ describe 'User' do
|
||||||
it{ should_not be_able_to(:new, Registration.new(conference_id: conference_with_closed_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(:create, Registration.new(conference_id: conference_with_closed_registration.id))}
|
||||||
|
|
||||||
|
it{ should be_able_to(:show, schedule_public) }
|
||||||
|
it{ should_not be_able_to(:show, schedule_not_public) }
|
||||||
|
|
||||||
it{ should be_able_to(:index, Ticket) }
|
it{ should be_able_to(:index, Ticket) }
|
||||||
it{ should be_able_to(:manage, TicketPurchase.new(user_id: user.id)) }
|
it{ should be_able_to(:manage, TicketPurchase.new(user_id: user.id)) }
|
||||||
|
|
||||||
|
|
@ -135,6 +139,9 @@ describe 'User' do
|
||||||
it{ should be_able_to(:manage, :all) }
|
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_conference.program) }
|
||||||
it{ should_not be_able_to(:destroy, my_venue) }
|
it{ should_not be_able_to(:destroy, my_venue) }
|
||||||
|
|
||||||
|
it{ should be_able_to(:show, schedule_public) }
|
||||||
|
it{ should be_able_to(:show, schedule_not_public) }
|
||||||
end
|
end
|
||||||
|
|
||||||
shared_examples 'user with any role' do
|
shared_examples 'user with any role' do
|
||||||
|
|
@ -218,6 +225,9 @@ describe 'User' do
|
||||||
it{ should be_able_to(:manage, my_conference.tickets.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(:manage, conference_public.tickets.first) }
|
||||||
|
|
||||||
|
it{ should be_able_to(:show, schedule_public) }
|
||||||
|
it{ should_not be_able_to(:show, schedule_not_public) }
|
||||||
|
|
||||||
it{ should be_able_to(:manage, my_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, other_registration) }
|
||||||
|
|
||||||
|
|
@ -289,6 +299,9 @@ describe 'User' do
|
||||||
it{ should_not be_able_to(:manage, my_conference.tickets.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, conference_public.tickets.first) }
|
||||||
|
|
||||||
|
it{ should be_able_to(:show, schedule_public) }
|
||||||
|
it{ should_not be_able_to(:show, schedule_not_public) }
|
||||||
|
|
||||||
it{ should_not be_able_to(:manage, my_registration) }
|
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, other_registration) }
|
||||||
|
|
||||||
|
|
@ -356,6 +369,9 @@ describe 'User' do
|
||||||
it{ should_not be_able_to(:manage, my_conference.tickets.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, conference_public.tickets.first) }
|
||||||
|
|
||||||
|
it{ should be_able_to(:show, schedule_public) }
|
||||||
|
it{ should_not be_able_to(:show, schedule_not_public) }
|
||||||
|
|
||||||
it{ should be_able_to(:manage, my_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, other_registration) }
|
||||||
|
|
||||||
|
|
@ -423,6 +439,9 @@ describe 'User' do
|
||||||
it{ should_not be_able_to(:manage, my_conference.tickets.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, conference_public.tickets.first) }
|
||||||
|
|
||||||
|
it{ should be_able_to(:show, schedule_public) }
|
||||||
|
it{ should_not be_able_to(:show, schedule_not_public) }
|
||||||
|
|
||||||
it{ should_not be_able_to(:manage, 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, other_registration) }
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue