diff --git a/spec/models/ability_spec.rb b/spec/models/ability_spec.rb index 92218b84..417ed890 100644 --- a/spec/models/ability_spec.rb +++ b/spec/models/ability_spec.rb @@ -24,6 +24,7 @@ describe 'User' do let(:conference_public) { create(:full_conference, splashpage: create(:splashpage, public: true)) } 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_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(: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(:manage, TicketPurchase.new(user_id: user.id)) } @@ -135,6 +139,9 @@ describe 'User' do 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(:show, schedule_public) } + it{ should be_able_to(:show, schedule_not_public) } end 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_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_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, 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, 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, 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_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, 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, other_registration) }