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 | 3 |
2 files changed, 17 insertions, 0 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..8b1facc71 100644 --- a/spec/policies/calendar_policy_spec.rb +++ b/spec/policies/calendar_policy_spec.rb @@ -7,6 +7,9 @@ RSpec.describe CalendarPolicy, type: :policy do permissions :create? do it_behaves_like 'permitted policy', 'calendars.create', archived: true end + permissions :share? do + it_behaves_like 'permitted policy and same organisation', 'calendars.share', archived: true + end permissions :destroy? do it_behaves_like 'permitted policy and same organisation', 'calendars.destroy', archived: true end |
