diff options
Diffstat (limited to 'spec')
| -rw-r--r-- | spec/lib/stif/permission_translator_spec.rb | 14 | ||||
| -rw-r--r-- | spec/policies/calendar_policy_spec.rb | 13 |
2 files changed, 22 insertions, 5 deletions
diff --git a/spec/lib/stif/permission_translator_spec.rb b/spec/lib/stif/permission_translator_spec.rb index ae1a2d1d5..355b0e336 100644 --- a/spec/lib/stif/permission_translator_spec.rb +++ b/spec/lib/stif/permission_translator_spec.rb @@ -42,4 +42,18 @@ RSpec.describe Stif::PermissionTranslator do ).to match_array(Support::Permissions.all_permissions) end end + + context "For the STIF organisation" do + let(:organisation){ build_stubbed :organisation, name: "STIF" } + it "adds the calendars.share permission" do + expect( described_class.translate([], organisation) ).to eq(%w{calendars.share}) + end + + context "with the case changed" do + let(:organisation){ build_stubbed :organisation, name: "StiF" } + it "adds the calendars.share permission" do + expect( described_class.translate([], organisation) ).to eq(%w{calendars.share}) + end + end + end end diff --git a/spec/policies/calendar_policy_spec.rb b/spec/policies/calendar_policy_spec.rb index 294be8198..5fd1eca47 100644 --- a/spec/policies/calendar_policy_spec.rb +++ b/spec/policies/calendar_policy_spec.rb @@ -5,18 +5,21 @@ RSpec.describe CalendarPolicy, type: :policy do permissions :create? do - it_behaves_like 'permitted policy', 'calendars.create', archived: true + it_behaves_like 'permitted policy', 'calendars.create' + end + permissions :share? do + it_behaves_like 'permitted policy and same organisation', 'calendars.share' end permissions :destroy? do - it_behaves_like 'permitted policy and same organisation', 'calendars.destroy', archived: true + it_behaves_like 'permitted policy and same organisation', 'calendars.destroy' end permissions :edit? do - it_behaves_like 'permitted policy and same organisation', 'calendars.update', archived: true + it_behaves_like 'permitted policy and same organisation', 'calendars.update' end permissions :new? do - it_behaves_like 'permitted policy', 'calendars.create', archived: true + it_behaves_like 'permitted policy', 'calendars.create' end permissions :update? do - it_behaves_like 'permitted policy and same organisation', 'calendars.update', archived: true + it_behaves_like 'permitted policy and same organisation', 'calendars.update' end end |
