From a3c4ee63aed244ea74587d1d3674f544c3918bef Mon Sep 17 00:00:00 2001 From: davidg73 <david.gunnarsson@univie.ac.at> Date: Tue, 13 May 2025 12:30:40 +0200 Subject: [PATCH] Set policies according to current reqs so applicants cannot do anything, apprentices can view, create and edit everything but not delete most objects, while editors can do everything and admins also manage users --- app/policies/actor_policy.rb | 10 +++--- app/policies/actor_type_policy.rb | 10 +++--- app/policies/analysis_method_policy.rb | 10 +++--- app/policies/archaeometry_analysis_policy.rb | 10 +++--- app/policies/colour_policy.rb | 10 +++--- app/policies/fabric_code_policy.rb | 10 +++--- app/policies/form_policy.rb | 10 +++--- app/policies/fragmentation_policy.rb | 10 +++--- app/policies/frequency_policy.rb | 10 +++--- app/policies/gazetteer_policy.rb | 14 ++++---- app/policies/hardness_policy.rb | 10 +++--- app/policies/image_color_policy.rb | 10 +++--- app/policies/image_size_policy.rb | 10 +++--- app/policies/literature_policy.rb | 10 +++--- app/policies/phase_policy.rb | 10 +++--- app/policies/sample_policy.rb | 10 +++--- app/policies/sorting_policy.rb | 10 +++--- app/policies/sphericity_policy.rb | 10 +++--- app/policies/surface_policy.rb | 10 +++--- app/policies/text_policy.rb | 10 +++--- app/policies/texture_policy.rb | 10 +++--- app/policies/type_policy.rb | 10 +++--- app/policies/user_policy.rb | 2 +- app/policies/vessel_form_type_policy.rb | 10 +++--- app/policies/voids_form_policy.rb | 10 +++--- app/policies/ware_policy.rb | 10 +++--- config/initializers/avo.rb | 12 +++---- spec/policies/actor_policy_spec.rb | 18 +++++------ spec/policies/actor_type_policy_spec.rb | 18 +++++------ spec/policies/analysis_method_policy_spec.rb | 24 +++++++------- .../archaeometry_analysis_policy_spec.rb | 26 +++++++-------- spec/policies/colour_policy_spec.rb | 24 +++++++------- spec/policies/fabric_code_policy_spec.rb | 24 +++++++------- spec/policies/form_policy_spec.rb | 24 +++++++------- spec/policies/fragmentation_policy_spec.rb | 24 +++++++------- spec/policies/frequency_policy_spec.rb | 24 +++++++------- spec/policies/gazetteer_policy_spec.rb | 32 +++++++++---------- spec/policies/hardness_policy_spec.rb | 24 +++++++------- spec/policies/image_color_policy_spec.rb | 24 +++++++------- spec/policies/image_size_policy_spec.rb | 18 +++++------ spec/policies/literature_policy_spec.rb | 18 +++++------ spec/policies/phase_policy_spec.rb | 24 +++++++------- spec/policies/sample_policy_spec.rb | 26 +++++++-------- spec/policies/sorting_policy_spec.rb | 24 +++++++------- spec/policies/sphericity_policy_spec.rb | 24 +++++++------- spec/policies/surface_policy_spec.rb | 24 +++++++------- spec/policies/text_policy_spec.rb | 18 +++++------ spec/policies/texture_policy_spec.rb | 24 +++++++------- spec/policies/type_policy_spec.rb | 24 +++++++------- spec/policies/vessel_form_type_policy_spec.rb | 24 +++++++------- spec/policies/voids_form_policy_spec.rb | 24 +++++++------- spec/policies/ware_policy_spec.rb | 24 +++++++------- 52 files changed, 425 insertions(+), 425 deletions(-) diff --git a/app/policies/actor_policy.rb b/app/policies/actor_policy.rb index fa10cd1..912d03b 100644 --- a/app/policies/actor_policy.rb +++ b/app/policies/actor_policy.rb @@ -2,23 +2,23 @@ class ActorPolicy < ApplicationPolicy alias_method :actor, :record def index? - user? && user.admin? + user? && user.apprentice? end def show? - user? && user.admin? + user? && user.apprentice? end def create? - user? && user.admin? + user? && user.apprentice? end def update? - user? && user.admin? + user? && user.apprentice? end def destroy? - user? && user.admin? + user? && user.editor? end class Scope < ApplicationPolicy::Scope diff --git a/app/policies/actor_type_policy.rb b/app/policies/actor_type_policy.rb index 7ae710e..83218fd 100644 --- a/app/policies/actor_type_policy.rb +++ b/app/policies/actor_type_policy.rb @@ -2,23 +2,23 @@ class ActorTypePolicy < ApplicationPolicy alias_method :actor_type, :record def index? - user? && user.admin? + user? && user.apprentice? end def show? - user? && user.admin? + user? && user.apprentice? end def create? - user? && user.admin? + user? && user.apprentice? end def update? - user? && user.admin? + user? && user.apprentice? end def destroy? - user? && user.admin? + user? && user.editor? end class Scope < ApplicationPolicy::Scope diff --git a/app/policies/analysis_method_policy.rb b/app/policies/analysis_method_policy.rb index 679ad25..9a62417 100644 --- a/app/policies/analysis_method_policy.rb +++ b/app/policies/analysis_method_policy.rb @@ -2,23 +2,23 @@ class AnalysisMethodPolicy < ApplicationPolicy alias_method :analysis_method, :record def index? - user? && user.admin? + user? && user.apprentice? end def show? - user? && user.admin? + user? && user.apprentice? end def create? - false + user? && user.apprentice? end def update? - false + user? && user.apprentice? end def destroy? - false + user? && user.editor? end class Scope < ApplicationPolicy::Scope diff --git a/app/policies/archaeometry_analysis_policy.rb b/app/policies/archaeometry_analysis_policy.rb index a78f33e..5356849 100644 --- a/app/policies/archaeometry_analysis_policy.rb +++ b/app/policies/archaeometry_analysis_policy.rb @@ -2,23 +2,23 @@ class ArchaeometryAnalysisPolicy < ApplicationPolicy alias_method :archaeometry_analysis, :record def index? - user? && user.admin? + user? && user.apprentice? end def show? - user? && user.admin? + user? && user.apprentice? end def create? - false + user? && user.apprentice? end def update? - false + user? && user.apprentice? end def destroy? - false + user? && user.apprentice? end class Scope < ApplicationPolicy::Scope diff --git a/app/policies/colour_policy.rb b/app/policies/colour_policy.rb index 2bf9170..1517afb 100644 --- a/app/policies/colour_policy.rb +++ b/app/policies/colour_policy.rb @@ -2,23 +2,23 @@ class ColourPolicy < ApplicationPolicy alias_method :colour, :record def index? - user? && user.admin? + user? && user.apprentice? end def show? - user? && user.admin? + user? && user.apprentice? end def create? - false + user? && user.apprentice? end def update? - false + user? && user.apprentice? end def destroy? - false + user? && user.editor? end class Scope < ApplicationPolicy::Scope diff --git a/app/policies/fabric_code_policy.rb b/app/policies/fabric_code_policy.rb index c071b00..c5a22c4 100644 --- a/app/policies/fabric_code_policy.rb +++ b/app/policies/fabric_code_policy.rb @@ -2,23 +2,23 @@ class FabricCodePolicy < ApplicationPolicy alias_method :fabric_code, :record def index? - user? && user.admin? + user? && user.apprentice? end def show? - user? && user.admin? + user? && user.apprentice? end def create? - false + user? && user.apprentice? end def update? - false + user? && user.apprentice? end def destroy? - false + user? && user.editor? end class Scope < ApplicationPolicy::Scope diff --git a/app/policies/form_policy.rb b/app/policies/form_policy.rb index 3a766dd..bcbeb7e 100644 --- a/app/policies/form_policy.rb +++ b/app/policies/form_policy.rb @@ -2,23 +2,23 @@ class FormPolicy < ApplicationPolicy alias_method :form, :record def index? - user? && user.admin? + user? && user.apprentice? end def show? - user? && user.admin? + user? && user.apprentice? end def create? - false + user? && user.apprentice? end def update? - false + user? && user.apprentice? end def destroy? - false + user? && user.editor? end class Scope < ApplicationPolicy::Scope diff --git a/app/policies/fragmentation_policy.rb b/app/policies/fragmentation_policy.rb index cdbb2c3..603966f 100644 --- a/app/policies/fragmentation_policy.rb +++ b/app/policies/fragmentation_policy.rb @@ -2,23 +2,23 @@ class FragmentationPolicy < ApplicationPolicy alias_method :fragmentation, :record def index? - user? && user.admin? + user? && user.apprentice? end def show? - user? && user.admin? + user? && user.apprentice? end def create? - false + user? && user.apprentice? end def update? - false + user? && user.apprentice? end def destroy? - false + user? && user.editor? end class Scope < ApplicationPolicy::Scope diff --git a/app/policies/frequency_policy.rb b/app/policies/frequency_policy.rb index e2ddabd..06d813c 100644 --- a/app/policies/frequency_policy.rb +++ b/app/policies/frequency_policy.rb @@ -2,23 +2,23 @@ class FrequencyPolicy < ApplicationPolicy alias_method :frequency, :record def index? - user? && user.admin? + user? && user.apprentice? end def show? - user? && user.admin? + user? && user.apprentice? end def create? - false + user? && user.apprentice? end def update? - false + user? && user.apprentice? end def destroy? - false + user? && user.editor? end class Scope < ApplicationPolicy::Scope diff --git a/app/policies/gazetteer_policy.rb b/app/policies/gazetteer_policy.rb index 8ec2520..83b49a9 100644 --- a/app/policies/gazetteer_policy.rb +++ b/app/policies/gazetteer_policy.rb @@ -2,31 +2,31 @@ class GazetteerPolicy < ApplicationPolicy alias_method :gazetteer, :record def index? - user? && user.admin? + user? && user.apprentice? end def show? - user? && user.admin? + user? && user.apprentice? end def create? - false + user? && user.apprentice? end def update? - false + user? && user.apprentice? end def destroy? - false + user? && user.editor? end def view_children? - user? && user.admin? + user? && user.apprentice? end def show_children? - user? && user.admin? + user? && user.apprentice? end class Scope < ApplicationPolicy::Scope diff --git a/app/policies/hardness_policy.rb b/app/policies/hardness_policy.rb index c68f8b9..e1ac2ce 100644 --- a/app/policies/hardness_policy.rb +++ b/app/policies/hardness_policy.rb @@ -2,23 +2,23 @@ class HardnessPolicy < ApplicationPolicy alias_method :hardness, :record def index? - user? && user.admin? + user? && user.apprentice? end def show? - user? && user.admin? + user? && user.apprentice? end def create? - false + user? && user.apprentice? end def update? - false + user? && user.apprentice? end def destroy? - false + user? && user.editor? end class Scope < ApplicationPolicy::Scope diff --git a/app/policies/image_color_policy.rb b/app/policies/image_color_policy.rb index 9daba6b..1b418c4 100644 --- a/app/policies/image_color_policy.rb +++ b/app/policies/image_color_policy.rb @@ -2,23 +2,23 @@ class ImageColorPolicy < ApplicationPolicy alias_method :image_color, :record def index? - user? && user.admin? + user? && user.apprentice? end def show? - user? && user.admin? + user? && user.apprentice? end def create? - false + user? && user.apprentice? end def update? - false + user? && user.apprentice? end def destroy? - false + user? && user.editor? end class Scope < ApplicationPolicy::Scope diff --git a/app/policies/image_size_policy.rb b/app/policies/image_size_policy.rb index 9399031..09922d0 100644 --- a/app/policies/image_size_policy.rb +++ b/app/policies/image_size_policy.rb @@ -2,23 +2,23 @@ class ImageSizePolicy < ApplicationPolicy alias_method :image_size, :record def index? - user? && user.admin? + user? && user.apprentice? end def show? - user? && user.admin? + user? && user.apprentice? end def create? - user? && user.admin? + user? && user.apprentice? end def update? - user? && user.admin? + user? && user.apprentice? end def destroy? - user? && user.admin? + user? && user.editor? end class Scope < ApplicationPolicy::Scope diff --git a/app/policies/literature_policy.rb b/app/policies/literature_policy.rb index ced8f7d..be28c0b 100644 --- a/app/policies/literature_policy.rb +++ b/app/policies/literature_policy.rb @@ -2,23 +2,23 @@ class LiteraturePolicy < ApplicationPolicy alias_method :literature, :record def index? - user? && user.admin? + user? && user.apprentice? end def show? - user? && user.admin? + user? && user.apprentice? end def create? - user? && user.admin? + user? && user.apprentice? end def update? - user? && user.admin? + user? && user.apprentice? end def destroy? - user? && user.admin? + user? && user.editor? end class Scope < ApplicationPolicy::Scope diff --git a/app/policies/phase_policy.rb b/app/policies/phase_policy.rb index 0688891..53d73d6 100644 --- a/app/policies/phase_policy.rb +++ b/app/policies/phase_policy.rb @@ -2,23 +2,23 @@ class PhasePolicy < ApplicationPolicy alias_method :phase, :record def index? - user? && user.admin? + user? && user.apprentice? end def show? - user? && user.admin? + user? && user.apprentice? end def create? - false + user? && user.apprentice? end def update? - false + user? && user.apprentice? end def destroy? - false + user? && user.editor? end class Scope < ApplicationPolicy::Scope diff --git a/app/policies/sample_policy.rb b/app/policies/sample_policy.rb index 7a17b6c..054c921 100644 --- a/app/policies/sample_policy.rb +++ b/app/policies/sample_policy.rb @@ -2,23 +2,23 @@ class SamplePolicy < ApplicationPolicy alias_method :sample, :record def index? - user? && user.admin? + user? && user.apprentice? end def show? - user? && user.admin? + user? && user.apprentice? end def create? - false + user? && user.apprentice? end def update? - false + user? && user.apprentice? end def destroy? - false + user? && user.apprentice? end class Scope < ApplicationPolicy::Scope diff --git a/app/policies/sorting_policy.rb b/app/policies/sorting_policy.rb index e33ed93..b678873 100644 --- a/app/policies/sorting_policy.rb +++ b/app/policies/sorting_policy.rb @@ -2,23 +2,23 @@ class SortingPolicy < ApplicationPolicy alias_method :sorting, :record def index? - user? && user.admin? + user? && user.apprentice? end def show? - user? && user.admin? + user? && user.apprentice? end def create? - false + user? && user.apprentice? end def update? - false + user? && user.apprentice? end def destroy? - false + user? && user.editor? end class Scope < ApplicationPolicy::Scope diff --git a/app/policies/sphericity_policy.rb b/app/policies/sphericity_policy.rb index e586975..592eeba 100644 --- a/app/policies/sphericity_policy.rb +++ b/app/policies/sphericity_policy.rb @@ -2,23 +2,23 @@ class SphericityPolicy < ApplicationPolicy alias_method :sphericity, :record def index? - user? && user.admin? + user? && user.apprentice? end def show? - user? && user.admin? + user? && user.apprentice? end def create? - false + user? && user.apprentice? end def update? - false + user? && user.apprentice? end def destroy? - false + user? && user.editor? end class Scope < ApplicationPolicy::Scope diff --git a/app/policies/surface_policy.rb b/app/policies/surface_policy.rb index af19325..7b37cf2 100644 --- a/app/policies/surface_policy.rb +++ b/app/policies/surface_policy.rb @@ -2,23 +2,23 @@ class SurfacePolicy < ApplicationPolicy alias_method :surface, :record def index? - user? && user.admin? + user? && user.apprentice? end def show? - user? && user.admin? + user? && user.apprentice? end def create? - false + user? && user.apprentice? end def update? - false + user? && user.apprentice? end def destroy? - false + user? && user.editor? end class Scope < ApplicationPolicy::Scope diff --git a/app/policies/text_policy.rb b/app/policies/text_policy.rb index ddddc26..12e55f9 100644 --- a/app/policies/text_policy.rb +++ b/app/policies/text_policy.rb @@ -2,23 +2,23 @@ class TextPolicy < ApplicationPolicy alias_method :text, :record def index? - user? && user.admin? + user? && user.apprentice? end def show? - user? && user.admin? + user? && user.apprentice? end def create? - user? && user.admin? + user? && user.apprentice? end def update? - user? && user.admin? + user? && user.apprentice? end def destroy? - user? && user.admin? + user? && user.editor? end class Scope < ApplicationPolicy::Scope diff --git a/app/policies/texture_policy.rb b/app/policies/texture_policy.rb index 68e3380..05413c3 100644 --- a/app/policies/texture_policy.rb +++ b/app/policies/texture_policy.rb @@ -2,23 +2,23 @@ class TexturePolicy < ApplicationPolicy alias_method :texture, :record def index? - user? && user.admin? + user? && user.apprentice? end def show? - user? && user.admin? + user? && user.apprentice? end def create? - false + user? && user.apprentice? end def update? - false + user? && user.apprentice? end def destroy? - false + user? && user.editor? end class Scope < ApplicationPolicy::Scope diff --git a/app/policies/type_policy.rb b/app/policies/type_policy.rb index 9944186..a7a33f4 100644 --- a/app/policies/type_policy.rb +++ b/app/policies/type_policy.rb @@ -2,23 +2,23 @@ class TypePolicy < ApplicationPolicy alias_method :type, :record def index? - user? && user.admin? + user? && user.apprentice? end def show? - user? && user.admin? + user? && user.apprentice? end def create? - false + user? && user.apprentice? end def update? - false + user? && user.apprentice? end def destroy? - false + user? && user.editor? end class Scope < ApplicationPolicy::Scope diff --git a/app/policies/user_policy.rb b/app/policies/user_policy.rb index 803ed2e..c94a5ea 100644 --- a/app/policies/user_policy.rb +++ b/app/policies/user_policy.rb @@ -14,7 +14,7 @@ class UserPolicy < ApplicationPolicy end def update? - false + user? && user.admin? end def destroy? diff --git a/app/policies/vessel_form_type_policy.rb b/app/policies/vessel_form_type_policy.rb index 3c2927d..a3656a6 100644 --- a/app/policies/vessel_form_type_policy.rb +++ b/app/policies/vessel_form_type_policy.rb @@ -2,23 +2,23 @@ class VesselFormTypePolicy < ApplicationPolicy alias_method :vessel_form_type, :record def index? - user? && user.admin? + user? && user.apprentice? end def show? - user? && user.admin? + user? && user.apprentice? end def create? - false + user? && user.apprentice? end def update? - false + user? && user.apprentice? end def destroy? - false + user? && user.editor? end class Scope < ApplicationPolicy::Scope diff --git a/app/policies/voids_form_policy.rb b/app/policies/voids_form_policy.rb index 95bbb84..fc091d2 100644 --- a/app/policies/voids_form_policy.rb +++ b/app/policies/voids_form_policy.rb @@ -2,23 +2,23 @@ class VoidsFormPolicy < ApplicationPolicy alias_method :voids_form, :record def index? - user? && user.admin? + user? && user.apprentice? end def show? - user? && user.admin? + user? && user.apprentice? end def create? - false + user? && user.apprentice? end def update? - false + user? && user.apprentice? end def destroy? - false + user? && user.editor? end class Scope < ApplicationPolicy::Scope diff --git a/app/policies/ware_policy.rb b/app/policies/ware_policy.rb index b6ac7eb..2cece86 100644 --- a/app/policies/ware_policy.rb +++ b/app/policies/ware_policy.rb @@ -2,23 +2,23 @@ class WarePolicy < ApplicationPolicy alias_method :ware, :record def index? - user? && user.admin? + user? && user.apprentice? end def show? - user? && user.admin? + user? && user.apprentice? end def create? - false + user? && user.apprentice? end def update? - false + user? && user.apprentice? end def destroy? - false + user? && user.editor? end class Scope < ApplicationPolicy::Scope diff --git a/config/initializers/avo.rb b/config/initializers/avo.rb index 0b7ebd7..5e05bf9 100644 --- a/config/initializers/avo.rb +++ b/config/initializers/avo.rb @@ -162,24 +162,24 @@ Avo.configure do |config| resource :archaeometry_analysis, visible: -> { authorize current_user, ArchaeometryAnalysis, "index?", raise_exception: false } end - section "Location Data" do # apprentice (no-delete) + section "Location Data" do resource :gazetteers, visible: -> { authorize current_user, Gazetteer, "index?", raise_exception: false } resource :phases, visible: -> { authorize current_user, Phase, "index?", raise_exception: false } resource :types, visible: -> { authorize current_user, Type, "index?", raise_exception: false } end - section "Object Data" do # apprentice (no-delete) + section "Object Data" do resource :analysis_methods, visible: -> { authorize current_user, AnalysisMethod, "index?", raise_exception: false } + resource :fabric_codes, visible: -> { authorize current_user, FabricCode, "index?", raise_exception: false } resource :forms, visible: -> { authorize current_user, Form, "index?", raise_exception: false } resource :fragmentations, visible: -> { authorize current_user, Fragmentation, "index?", raise_exception: false } - resource :fabric_codes, visible: -> { authorize current_user, FabricCode, "index?", raise_exception: false } resource :literature, visible: -> { authorize current_user, Literature, "index?", raise_exception: false } resource :vessel_form_types, visible: -> { authorize current_user, VesselFormType, "index?", raise_exception: false } resource :wares, visible: -> { authorize current_user, Ware, "index?", raise_exception: false } end # TODO: in a later step: all should get no-delete, no-edit - section "Fabric Description" do # apprentice (no-delete) + section "Fabric Description" do resource :colours, visible: -> { authorize current_user, Colour, "index?", raise_exception: false } resource :frequencies, visible: -> { authorize current_user, Frequency, "index?", raise_exception: false } resource :hardnesses, visible: -> { authorize current_user, Hardness, "index?", raise_exception: false } @@ -191,12 +191,12 @@ Avo.configure do |config| resource :voids_forms, visible: -> { authorize current_user, VoidsForm, "index?", raise_exception: false } end - section "Image Data" do # apprentice (no-delete) + section "Image Data" do resource :image_colors, visible: -> { authorize current_user, ImageColor, "index?", raise_exception: false } resource :image_sizes, visible: -> { authorize current_user, ImageSize, "index?", raise_exception: false } end - section "Actors" do # apprentice (no-delete) + section "Actors" do resource :actor_types, visible: -> { authorize current_user, ActorType, "index?", raise_exception: false } resource :actors, visible: -> { authorize current_user, Actor, "index?", raise_exception: false } end diff --git a/spec/policies/actor_policy_spec.rb b/spec/policies/actor_policy_spec.rb index 14ef479..5a10ef3 100644 --- a/spec/policies/actor_policy_spec.rb +++ b/spec/policies/actor_policy_spec.rb @@ -17,21 +17,21 @@ RSpec.describe ActorPolicy do context "for an apprentice" do let(:user) { FactoryBot.create(:user, :apprentice) } - it { is_expected.to forbid_action(:index) } - it { is_expected.to forbid_action(:show) } - it { is_expected.to forbid_new_and_create_actions } - it { is_expected.to forbid_edit_and_update_actions } + it { is_expected.to permit_action(:index) } + it { is_expected.to permit_action(:show) } + it { is_expected.to permit_new_and_create_actions } + it { is_expected.to permit_edit_and_update_actions } it { is_expected.to forbid_action(:destroy) } end context "for an editor" do let(:user) { FactoryBot.create(:user, :editor) } - it { is_expected.to forbid_action(:index) } - it { is_expected.to forbid_action(:show) } - it { is_expected.to forbid_new_and_create_actions } - it { is_expected.to forbid_edit_and_update_actions } - it { is_expected.to forbid_action(:destroy) } + it { is_expected.to permit_action(:index) } + it { is_expected.to permit_action(:show) } + it { is_expected.to permit_new_and_create_actions } + it { is_expected.to permit_edit_and_update_actions } + it { is_expected.to permit_action(:destroy) } end context "for an admin" do diff --git a/spec/policies/actor_type_policy_spec.rb b/spec/policies/actor_type_policy_spec.rb index f0cd1ca..1c87389 100644 --- a/spec/policies/actor_type_policy_spec.rb +++ b/spec/policies/actor_type_policy_spec.rb @@ -17,21 +17,21 @@ RSpec.describe ActorTypePolicy do context "for an apprentice" do let(:user) { FactoryBot.create(:user, :apprentice) } - it { is_expected.to forbid_action(:index) } - it { is_expected.to forbid_action(:show) } - it { is_expected.to forbid_new_and_create_actions } - it { is_expected.to forbid_edit_and_update_actions } + it { is_expected.to permit_action(:index) } + it { is_expected.to permit_action(:show) } + it { is_expected.to permit_new_and_create_actions } + it { is_expected.to permit_edit_and_update_actions } it { is_expected.to forbid_action(:destroy) } end context "for an editor" do let(:user) { FactoryBot.create(:user, :editor) } - it { is_expected.to forbid_action(:index) } - it { is_expected.to forbid_action(:show) } - it { is_expected.to forbid_new_and_create_actions } - it { is_expected.to forbid_edit_and_update_actions } - it { is_expected.to forbid_action(:destroy) } + it { is_expected.to permit_action(:index) } + it { is_expected.to permit_action(:show) } + it { is_expected.to permit_new_and_create_actions } + it { is_expected.to permit_edit_and_update_actions } + it { is_expected.to permit_action(:destroy) } end context "for an admin" do diff --git a/spec/policies/analysis_method_policy_spec.rb b/spec/policies/analysis_method_policy_spec.rb index 5266749..d6c2c6d 100644 --- a/spec/policies/analysis_method_policy_spec.rb +++ b/spec/policies/analysis_method_policy_spec.rb @@ -17,21 +17,21 @@ RSpec.describe AnalysisMethodPolicy do context "for an apprentice" do let(:user) { FactoryBot.create(:user, :apprentice) } - it { is_expected.to forbid_action(:index) } - it { is_expected.to forbid_action(:show) } - it { is_expected.to forbid_new_and_create_actions } - it { is_expected.to forbid_edit_and_update_actions } + it { is_expected.to permit_action(:index) } + it { is_expected.to permit_action(:show) } + it { is_expected.to permit_new_and_create_actions } + it { is_expected.to permit_edit_and_update_actions } it { is_expected.to forbid_action(:destroy) } end context "for an editor" do let(:user) { FactoryBot.create(:user, :editor) } - it { is_expected.to forbid_action(:index) } - it { is_expected.to forbid_action(:show) } - it { is_expected.to forbid_new_and_create_actions } - it { is_expected.to forbid_edit_and_update_actions } - it { is_expected.to forbid_action(:destroy) } + it { is_expected.to permit_action(:index) } + it { is_expected.to permit_action(:show) } + it { is_expected.to permit_new_and_create_actions } + it { is_expected.to permit_edit_and_update_actions } + it { is_expected.to permit_action(:destroy) } end context "for an admin" do @@ -39,9 +39,9 @@ RSpec.describe AnalysisMethodPolicy do it { is_expected.to permit_action(:index) } it { is_expected.to permit_action(:show) } - it { is_expected.to forbid_new_and_create_actions } - it { is_expected.to forbid_edit_and_update_actions } - it { is_expected.to forbid_action(:destroy) } + it { is_expected.to permit_new_and_create_actions } + it { is_expected.to permit_edit_and_update_actions } + it { is_expected.to permit_action(:destroy) } end describe "Scope" do diff --git a/spec/policies/archaeometry_analysis_policy_spec.rb b/spec/policies/archaeometry_analysis_policy_spec.rb index 8f98630..71f1772 100644 --- a/spec/policies/archaeometry_analysis_policy_spec.rb +++ b/spec/policies/archaeometry_analysis_policy_spec.rb @@ -17,21 +17,21 @@ RSpec.describe ArchaeometryAnalysisPolicy do context "for an apprentice" do let(:user) { FactoryBot.create(:user, :apprentice) } - it { is_expected.to forbid_action(:index) } - it { is_expected.to forbid_action(:show) } - it { is_expected.to forbid_new_and_create_actions } - it { is_expected.to forbid_edit_and_update_actions } - it { is_expected.to forbid_action(:destroy) } + it { is_expected.to permit_action(:index) } + it { is_expected.to permit_action(:show) } + it { is_expected.to permit_new_and_create_actions } + it { is_expected.to permit_edit_and_update_actions } + it { is_expected.to permit_action(:destroy) } end context "for an editor" do let(:user) { FactoryBot.create(:user, :editor) } - it { is_expected.to forbid_action(:index) } - it { is_expected.to forbid_action(:show) } - it { is_expected.to forbid_new_and_create_actions } - it { is_expected.to forbid_edit_and_update_actions } - it { is_expected.to forbid_action(:destroy) } + it { is_expected.to permit_action(:index) } + it { is_expected.to permit_action(:show) } + it { is_expected.to permit_new_and_create_actions } + it { is_expected.to permit_edit_and_update_actions } + it { is_expected.to permit_action(:destroy) } end context "for an admin" do @@ -39,9 +39,9 @@ RSpec.describe ArchaeometryAnalysisPolicy do it { is_expected.to permit_action(:index) } it { is_expected.to permit_action(:show) } - it { is_expected.to forbid_new_and_create_actions } - it { is_expected.to forbid_edit_and_update_actions } - it { is_expected.to forbid_action(:destroy) } + it { is_expected.to permit_new_and_create_actions } + it { is_expected.to permit_edit_and_update_actions } + it { is_expected.to permit_action(:destroy) } end describe "Scope" do diff --git a/spec/policies/colour_policy_spec.rb b/spec/policies/colour_policy_spec.rb index a7c7b67..6cbcadf 100644 --- a/spec/policies/colour_policy_spec.rb +++ b/spec/policies/colour_policy_spec.rb @@ -17,21 +17,21 @@ RSpec.describe ColourPolicy do context "for an apprentice" do let(:user) { FactoryBot.create(:user, :apprentice) } - it { is_expected.to forbid_action(:index) } - it { is_expected.to forbid_action(:show) } - it { is_expected.to forbid_new_and_create_actions } - it { is_expected.to forbid_edit_and_update_actions } + it { is_expected.to permit_action(:index) } + it { is_expected.to permit_action(:show) } + it { is_expected.to permit_new_and_create_actions } + it { is_expected.to permit_edit_and_update_actions } it { is_expected.to forbid_action(:destroy) } end context "for an editor" do let(:user) { FactoryBot.create(:user, :editor) } - it { is_expected.to forbid_action(:index) } - it { is_expected.to forbid_action(:show) } - it { is_expected.to forbid_new_and_create_actions } - it { is_expected.to forbid_edit_and_update_actions } - it { is_expected.to forbid_action(:destroy) } + it { is_expected.to permit_action(:index) } + it { is_expected.to permit_action(:show) } + it { is_expected.to permit_new_and_create_actions } + it { is_expected.to permit_edit_and_update_actions } + it { is_expected.to permit_action(:destroy) } end context "for an admin" do @@ -39,9 +39,9 @@ RSpec.describe ColourPolicy do it { is_expected.to permit_action(:index) } it { is_expected.to permit_action(:show) } - it { is_expected.to forbid_new_and_create_actions } - it { is_expected.to forbid_edit_and_update_actions } - it { is_expected.to forbid_action(:destroy) } + it { is_expected.to permit_new_and_create_actions } + it { is_expected.to permit_edit_and_update_actions } + it { is_expected.to permit_action(:destroy) } end describe "Scope" do diff --git a/spec/policies/fabric_code_policy_spec.rb b/spec/policies/fabric_code_policy_spec.rb index 8c52e27..47f9857 100644 --- a/spec/policies/fabric_code_policy_spec.rb +++ b/spec/policies/fabric_code_policy_spec.rb @@ -17,21 +17,21 @@ RSpec.describe FabricCodePolicy do context "for an apprentice" do let(:user) { FactoryBot.create(:user, :apprentice) } - it { is_expected.to forbid_action(:index) } - it { is_expected.to forbid_action(:show) } - it { is_expected.to forbid_new_and_create_actions } - it { is_expected.to forbid_edit_and_update_actions } + it { is_expected.to permit_action(:index) } + it { is_expected.to permit_action(:show) } + it { is_expected.to permit_new_and_create_actions } + it { is_expected.to permit_edit_and_update_actions } it { is_expected.to forbid_action(:destroy) } end context "for an editor" do let(:user) { FactoryBot.create(:user, :editor) } - it { is_expected.to forbid_action(:index) } - it { is_expected.to forbid_action(:show) } - it { is_expected.to forbid_new_and_create_actions } - it { is_expected.to forbid_edit_and_update_actions } - it { is_expected.to forbid_action(:destroy) } + it { is_expected.to permit_action(:index) } + it { is_expected.to permit_action(:show) } + it { is_expected.to permit_new_and_create_actions } + it { is_expected.to permit_edit_and_update_actions } + it { is_expected.to permit_action(:destroy) } end context "for an admin" do @@ -39,9 +39,9 @@ RSpec.describe FabricCodePolicy do it { is_expected.to permit_action(:index) } it { is_expected.to permit_action(:show) } - it { is_expected.to forbid_new_and_create_actions } - it { is_expected.to forbid_edit_and_update_actions } - it { is_expected.to forbid_action(:destroy) } + it { is_expected.to permit_new_and_create_actions } + it { is_expected.to permit_edit_and_update_actions } + it { is_expected.to permit_action(:destroy) } end describe "Scope" do diff --git a/spec/policies/form_policy_spec.rb b/spec/policies/form_policy_spec.rb index 2411b85..b1004b4 100644 --- a/spec/policies/form_policy_spec.rb +++ b/spec/policies/form_policy_spec.rb @@ -17,21 +17,21 @@ RSpec.describe FormPolicy do context "for an apprentice" do let(:user) { FactoryBot.create(:user, :apprentice) } - it { is_expected.to forbid_action(:index) } - it { is_expected.to forbid_action(:show) } - it { is_expected.to forbid_new_and_create_actions } - it { is_expected.to forbid_edit_and_update_actions } + it { is_expected.to permit_action(:index) } + it { is_expected.to permit_action(:show) } + it { is_expected.to permit_new_and_create_actions } + it { is_expected.to permit_edit_and_update_actions } it { is_expected.to forbid_action(:destroy) } end context "for an editor" do let(:user) { FactoryBot.create(:user, :editor) } - it { is_expected.to forbid_action(:index) } - it { is_expected.to forbid_action(:show) } - it { is_expected.to forbid_new_and_create_actions } - it { is_expected.to forbid_edit_and_update_actions } - it { is_expected.to forbid_action(:destroy) } + it { is_expected.to permit_action(:index) } + it { is_expected.to permit_action(:show) } + it { is_expected.to permit_new_and_create_actions } + it { is_expected.to permit_edit_and_update_actions } + it { is_expected.to permit_action(:destroy) } end context "for an admin" do @@ -39,9 +39,9 @@ RSpec.describe FormPolicy do it { is_expected.to permit_action(:index) } it { is_expected.to permit_action(:show) } - it { is_expected.to forbid_new_and_create_actions } - it { is_expected.to forbid_edit_and_update_actions } - it { is_expected.to forbid_action(:destroy) } + it { is_expected.to permit_new_and_create_actions } + it { is_expected.to permit_edit_and_update_actions } + it { is_expected.to permit_action(:destroy) } end describe "Scope" do diff --git a/spec/policies/fragmentation_policy_spec.rb b/spec/policies/fragmentation_policy_spec.rb index 738587e..1ed0573 100644 --- a/spec/policies/fragmentation_policy_spec.rb +++ b/spec/policies/fragmentation_policy_spec.rb @@ -17,21 +17,21 @@ RSpec.describe FragmentationPolicy do context "for an apprentice" do let(:user) { FactoryBot.create(:user, :apprentice) } - it { is_expected.to forbid_action(:index) } - it { is_expected.to forbid_action(:show) } - it { is_expected.to forbid_new_and_create_actions } - it { is_expected.to forbid_edit_and_update_actions } + it { is_expected.to permit_action(:index) } + it { is_expected.to permit_action(:show) } + it { is_expected.to permit_new_and_create_actions } + it { is_expected.to permit_edit_and_update_actions } it { is_expected.to forbid_action(:destroy) } end context "for an editor" do let(:user) { FactoryBot.create(:user, :editor) } - it { is_expected.to forbid_action(:index) } - it { is_expected.to forbid_action(:show) } - it { is_expected.to forbid_new_and_create_actions } - it { is_expected.to forbid_edit_and_update_actions } - it { is_expected.to forbid_action(:destroy) } + it { is_expected.to permit_action(:index) } + it { is_expected.to permit_action(:show) } + it { is_expected.to permit_new_and_create_actions } + it { is_expected.to permit_edit_and_update_actions } + it { is_expected.to permit_action(:destroy) } end context "for an admin" do @@ -39,9 +39,9 @@ RSpec.describe FragmentationPolicy do it { is_expected.to permit_action(:index) } it { is_expected.to permit_action(:show) } - it { is_expected.to forbid_new_and_create_actions } - it { is_expected.to forbid_edit_and_update_actions } - it { is_expected.to forbid_action(:destroy) } + it { is_expected.to permit_new_and_create_actions } + it { is_expected.to permit_edit_and_update_actions } + it { is_expected.to permit_action(:destroy) } end describe "Scope" do diff --git a/spec/policies/frequency_policy_spec.rb b/spec/policies/frequency_policy_spec.rb index 774d072..88f2df6 100644 --- a/spec/policies/frequency_policy_spec.rb +++ b/spec/policies/frequency_policy_spec.rb @@ -17,21 +17,21 @@ RSpec.describe FrequencyPolicy do context "for an apprentice" do let(:user) { FactoryBot.create(:user, :apprentice) } - it { is_expected.to forbid_action(:index) } - it { is_expected.to forbid_action(:show) } - it { is_expected.to forbid_new_and_create_actions } - it { is_expected.to forbid_edit_and_update_actions } + it { is_expected.to permit_action(:index) } + it { is_expected.to permit_action(:show) } + it { is_expected.to permit_new_and_create_actions } + it { is_expected.to permit_edit_and_update_actions } it { is_expected.to forbid_action(:destroy) } end context "for an editor" do let(:user) { FactoryBot.create(:user, :editor) } - it { is_expected.to forbid_action(:index) } - it { is_expected.to forbid_action(:show) } - it { is_expected.to forbid_new_and_create_actions } - it { is_expected.to forbid_edit_and_update_actions } - it { is_expected.to forbid_action(:destroy) } + it { is_expected.to permit_action(:index) } + it { is_expected.to permit_action(:show) } + it { is_expected.to permit_new_and_create_actions } + it { is_expected.to permit_edit_and_update_actions } + it { is_expected.to permit_action(:destroy) } end context "for an admin" do @@ -39,9 +39,9 @@ RSpec.describe FrequencyPolicy do it { is_expected.to permit_action(:index) } it { is_expected.to permit_action(:show) } - it { is_expected.to forbid_new_and_create_actions } - it { is_expected.to forbid_edit_and_update_actions } - it { is_expected.to forbid_action(:destroy) } + it { is_expected.to permit_new_and_create_actions } + it { is_expected.to permit_edit_and_update_actions } + it { is_expected.to permit_action(:destroy) } end describe "Scope" do diff --git a/spec/policies/gazetteer_policy_spec.rb b/spec/policies/gazetteer_policy_spec.rb index e3c63de..a68d68d 100644 --- a/spec/policies/gazetteer_policy_spec.rb +++ b/spec/policies/gazetteer_policy_spec.rb @@ -19,25 +19,25 @@ RSpec.describe GazetteerPolicy do context "for an apprentice" do let(:user) { FactoryBot.create(:user, :apprentice) } - it { is_expected.to forbid_action(:index) } - it { is_expected.to forbid_action(:show) } - it { is_expected.to forbid_new_and_create_actions } - it { is_expected.to forbid_edit_and_update_actions } + it { is_expected.to permit_action(:index) } + it { is_expected.to permit_action(:show) } + it { is_expected.to permit_new_and_create_actions } + it { is_expected.to permit_edit_and_update_actions } it { is_expected.to forbid_action(:destroy) } - it { is_expected.to forbid_action(:view_children) } - it { is_expected.to forbid_action(:show_children) } + it { is_expected.to permit_action(:view_children) } + it { is_expected.to permit_action(:show_children) } end context "for an editor" do let(:user) { FactoryBot.create(:user, :editor) } - it { is_expected.to forbid_action(:index) } - it { is_expected.to forbid_action(:show) } - it { is_expected.to forbid_new_and_create_actions } - it { is_expected.to forbid_edit_and_update_actions } - it { is_expected.to forbid_action(:destroy) } - it { is_expected.to forbid_action(:view_children) } - it { is_expected.to forbid_action(:show_children) } + it { is_expected.to permit_action(:index) } + it { is_expected.to permit_action(:show) } + it { is_expected.to permit_new_and_create_actions } + it { is_expected.to permit_edit_and_update_actions } + it { is_expected.to permit_action(:destroy) } + it { is_expected.to permit_action(:view_children) } + it { is_expected.to permit_action(:show_children) } end context "for an admin" do @@ -45,9 +45,9 @@ RSpec.describe GazetteerPolicy do it { is_expected.to permit_action(:index) } it { is_expected.to permit_action(:show) } - it { is_expected.to forbid_new_and_create_actions } - it { is_expected.to forbid_edit_and_update_actions } - it { is_expected.to forbid_action(:destroy) } + it { is_expected.to permit_new_and_create_actions } + it { is_expected.to permit_edit_and_update_actions } + it { is_expected.to permit_action(:destroy) } it { is_expected.to permit_action(:view_children) } it { is_expected.to permit_action(:show_children) } end diff --git a/spec/policies/hardness_policy_spec.rb b/spec/policies/hardness_policy_spec.rb index f0eb0d1..f21d3ed 100644 --- a/spec/policies/hardness_policy_spec.rb +++ b/spec/policies/hardness_policy_spec.rb @@ -17,21 +17,21 @@ RSpec.describe HardnessPolicy do context "for an apprentice" do let(:user) { FactoryBot.create(:user, :apprentice) } - it { is_expected.to forbid_action(:index) } - it { is_expected.to forbid_action(:show) } - it { is_expected.to forbid_new_and_create_actions } - it { is_expected.to forbid_edit_and_update_actions } + it { is_expected.to permit_action(:index) } + it { is_expected.to permit_action(:show) } + it { is_expected.to permit_new_and_create_actions } + it { is_expected.to permit_edit_and_update_actions } it { is_expected.to forbid_action(:destroy) } end context "for an editor" do let(:user) { FactoryBot.create(:user, :editor) } - it { is_expected.to forbid_action(:index) } - it { is_expected.to forbid_action(:show) } - it { is_expected.to forbid_new_and_create_actions } - it { is_expected.to forbid_edit_and_update_actions } - it { is_expected.to forbid_action(:destroy) } + it { is_expected.to permit_action(:index) } + it { is_expected.to permit_action(:show) } + it { is_expected.to permit_new_and_create_actions } + it { is_expected.to permit_edit_and_update_actions } + it { is_expected.to permit_action(:destroy) } end context "for an admin" do @@ -39,9 +39,9 @@ RSpec.describe HardnessPolicy do it { is_expected.to permit_action(:index) } it { is_expected.to permit_action(:show) } - it { is_expected.to forbid_new_and_create_actions } - it { is_expected.to forbid_edit_and_update_actions } - it { is_expected.to forbid_action(:destroy) } + it { is_expected.to permit_new_and_create_actions } + it { is_expected.to permit_edit_and_update_actions } + it { is_expected.to permit_action(:destroy) } end describe "Scope" do diff --git a/spec/policies/image_color_policy_spec.rb b/spec/policies/image_color_policy_spec.rb index 9c95c40..a1947a7 100644 --- a/spec/policies/image_color_policy_spec.rb +++ b/spec/policies/image_color_policy_spec.rb @@ -17,21 +17,21 @@ RSpec.describe ImageColorPolicy do context "for an apprentice" do let(:user) { FactoryBot.create(:user, :apprentice) } - it { is_expected.to forbid_action(:index) } - it { is_expected.to forbid_action(:show) } - it { is_expected.to forbid_new_and_create_actions } - it { is_expected.to forbid_edit_and_update_actions } + it { is_expected.to permit_action(:index) } + it { is_expected.to permit_action(:show) } + it { is_expected.to permit_new_and_create_actions } + it { is_expected.to permit_edit_and_update_actions } it { is_expected.to forbid_action(:destroy) } end context "for an editor" do let(:user) { FactoryBot.create(:user, :editor) } - it { is_expected.to forbid_action(:index) } - it { is_expected.to forbid_action(:show) } - it { is_expected.to forbid_new_and_create_actions } - it { is_expected.to forbid_edit_and_update_actions } - it { is_expected.to forbid_action(:destroy) } + it { is_expected.to permit_action(:index) } + it { is_expected.to permit_action(:show) } + it { is_expected.to permit_new_and_create_actions } + it { is_expected.to permit_edit_and_update_actions } + it { is_expected.to permit_action(:destroy) } end context "for an admin" do @@ -39,9 +39,9 @@ RSpec.describe ImageColorPolicy do it { is_expected.to permit_action(:index) } it { is_expected.to permit_action(:show) } - it { is_expected.to forbid_new_and_create_actions } - it { is_expected.to forbid_edit_and_update_actions } - it { is_expected.to forbid_action(:destroy) } + it { is_expected.to permit_new_and_create_actions } + it { is_expected.to permit_edit_and_update_actions } + it { is_expected.to permit_action(:destroy) } end describe "Scope" do diff --git a/spec/policies/image_size_policy_spec.rb b/spec/policies/image_size_policy_spec.rb index 24c3b7c..4a82422 100644 --- a/spec/policies/image_size_policy_spec.rb +++ b/spec/policies/image_size_policy_spec.rb @@ -17,21 +17,21 @@ RSpec.describe ImageSizePolicy do context "for an apprentice" do let(:user) { FactoryBot.create(:user, :apprentice) } - it { is_expected.to forbid_action(:index) } - it { is_expected.to forbid_action(:show) } - it { is_expected.to forbid_new_and_create_actions } - it { is_expected.to forbid_edit_and_update_actions } + it { is_expected.to permit_action(:index) } + it { is_expected.to permit_action(:show) } + it { is_expected.to permit_new_and_create_actions } + it { is_expected.to permit_edit_and_update_actions } it { is_expected.to forbid_action(:destroy) } end context "for an editor" do let(:user) { FactoryBot.create(:user, :editor) } - it { is_expected.to forbid_action(:index) } - it { is_expected.to forbid_action(:show) } - it { is_expected.to forbid_new_and_create_actions } - it { is_expected.to forbid_edit_and_update_actions } - it { is_expected.to forbid_action(:destroy) } + it { is_expected.to permit_action(:index) } + it { is_expected.to permit_action(:show) } + it { is_expected.to permit_new_and_create_actions } + it { is_expected.to permit_edit_and_update_actions } + it { is_expected.to permit_action(:destroy) } end context "for an admin" do diff --git a/spec/policies/literature_policy_spec.rb b/spec/policies/literature_policy_spec.rb index ea5b878..cf9f690 100644 --- a/spec/policies/literature_policy_spec.rb +++ b/spec/policies/literature_policy_spec.rb @@ -17,21 +17,21 @@ RSpec.describe LiteraturePolicy do context "for an apprentice" do let(:user) { FactoryBot.create(:user, :apprentice) } - it { is_expected.to forbid_action(:index) } - it { is_expected.to forbid_action(:show) } - it { is_expected.to forbid_new_and_create_actions } - it { is_expected.to forbid_edit_and_update_actions } + it { is_expected.to permit_action(:index) } + it { is_expected.to permit_action(:show) } + it { is_expected.to permit_new_and_create_actions } + it { is_expected.to permit_edit_and_update_actions } it { is_expected.to forbid_action(:destroy) } end context "for an editor" do let(:user) { FactoryBot.create(:user, :editor) } - it { is_expected.to forbid_action(:index) } - it { is_expected.to forbid_action(:show) } - it { is_expected.to forbid_new_and_create_actions } - it { is_expected.to forbid_edit_and_update_actions } - it { is_expected.to forbid_action(:destroy) } + it { is_expected.to permit_action(:index) } + it { is_expected.to permit_action(:show) } + it { is_expected.to permit_new_and_create_actions } + it { is_expected.to permit_edit_and_update_actions } + it { is_expected.to permit_action(:destroy) } end context "for an admin" do diff --git a/spec/policies/phase_policy_spec.rb b/spec/policies/phase_policy_spec.rb index 4added2..721a6ce 100644 --- a/spec/policies/phase_policy_spec.rb +++ b/spec/policies/phase_policy_spec.rb @@ -17,21 +17,21 @@ RSpec.describe PhasePolicy do context "for an apprentice" do let(:user) { FactoryBot.create(:user, :apprentice) } - it { is_expected.to forbid_action(:index) } - it { is_expected.to forbid_action(:show) } - it { is_expected.to forbid_new_and_create_actions } - it { is_expected.to forbid_edit_and_update_actions } + it { is_expected.to permit_action(:index) } + it { is_expected.to permit_action(:show) } + it { is_expected.to permit_new_and_create_actions } + it { is_expected.to permit_edit_and_update_actions } it { is_expected.to forbid_action(:destroy) } end context "for an editor" do let(:user) { FactoryBot.create(:user, :editor) } - it { is_expected.to forbid_action(:index) } - it { is_expected.to forbid_action(:show) } - it { is_expected.to forbid_new_and_create_actions } - it { is_expected.to forbid_edit_and_update_actions } - it { is_expected.to forbid_action(:destroy) } + it { is_expected.to permit_action(:index) } + it { is_expected.to permit_action(:show) } + it { is_expected.to permit_new_and_create_actions } + it { is_expected.to permit_edit_and_update_actions } + it { is_expected.to permit_action(:destroy) } end context "for an admin" do @@ -39,9 +39,9 @@ RSpec.describe PhasePolicy do it { is_expected.to permit_action(:index) } it { is_expected.to permit_action(:show) } - it { is_expected.to forbid_new_and_create_actions } - it { is_expected.to forbid_edit_and_update_actions } - it { is_expected.to forbid_action(:destroy) } + it { is_expected.to permit_new_and_create_actions } + it { is_expected.to permit_edit_and_update_actions } + it { is_expected.to permit_action(:destroy) } end describe "Scope" do diff --git a/spec/policies/sample_policy_spec.rb b/spec/policies/sample_policy_spec.rb index da1fda5..a473b45 100644 --- a/spec/policies/sample_policy_spec.rb +++ b/spec/policies/sample_policy_spec.rb @@ -17,21 +17,21 @@ RSpec.describe SamplePolicy do context "for an apprentice" do let(:user) { FactoryBot.create(:user, :apprentice) } - it { is_expected.to forbid_action(:index) } - it { is_expected.to forbid_action(:show) } - it { is_expected.to forbid_new_and_create_actions } - it { is_expected.to forbid_edit_and_update_actions } - it { is_expected.to forbid_action(:destroy) } + it { is_expected.to permit_action(:index) } + it { is_expected.to permit_action(:show) } + it { is_expected.to permit_new_and_create_actions } + it { is_expected.to permit_edit_and_update_actions } + it { is_expected.to permit_action(:destroy) } end context "for an editor" do let(:user) { FactoryBot.create(:user, :editor) } - it { is_expected.to forbid_action(:index) } - it { is_expected.to forbid_action(:show) } - it { is_expected.to forbid_new_and_create_actions } - it { is_expected.to forbid_edit_and_update_actions } - it { is_expected.to forbid_action(:destroy) } + it { is_expected.to permit_action(:index) } + it { is_expected.to permit_action(:show) } + it { is_expected.to permit_new_and_create_actions } + it { is_expected.to permit_edit_and_update_actions } + it { is_expected.to permit_action(:destroy) } end context "for an admin" do @@ -39,9 +39,9 @@ RSpec.describe SamplePolicy do it { is_expected.to permit_action(:index) } it { is_expected.to permit_action(:show) } - it { is_expected.to forbid_new_and_create_actions } - it { is_expected.to forbid_edit_and_update_actions } - it { is_expected.to forbid_action(:destroy) } + it { is_expected.to permit_new_and_create_actions } + it { is_expected.to permit_edit_and_update_actions } + it { is_expected.to permit_action(:destroy) } end describe "Scope" do diff --git a/spec/policies/sorting_policy_spec.rb b/spec/policies/sorting_policy_spec.rb index 341692e..d4f008e 100644 --- a/spec/policies/sorting_policy_spec.rb +++ b/spec/policies/sorting_policy_spec.rb @@ -17,21 +17,21 @@ RSpec.describe SortingPolicy do context "for an apprentice" do let(:user) { FactoryBot.create(:user, :apprentice) } - it { is_expected.to forbid_action(:index) } - it { is_expected.to forbid_action(:show) } - it { is_expected.to forbid_new_and_create_actions } - it { is_expected.to forbid_edit_and_update_actions } + it { is_expected.to permit_action(:index) } + it { is_expected.to permit_action(:show) } + it { is_expected.to permit_new_and_create_actions } + it { is_expected.to permit_edit_and_update_actions } it { is_expected.to forbid_action(:destroy) } end context "for an editor" do let(:user) { FactoryBot.create(:user, :editor) } - it { is_expected.to forbid_action(:index) } - it { is_expected.to forbid_action(:show) } - it { is_expected.to forbid_new_and_create_actions } - it { is_expected.to forbid_edit_and_update_actions } - it { is_expected.to forbid_action(:destroy) } + it { is_expected.to permit_action(:index) } + it { is_expected.to permit_action(:show) } + it { is_expected.to permit_new_and_create_actions } + it { is_expected.to permit_edit_and_update_actions } + it { is_expected.to permit_action(:destroy) } end context "for an admin" do @@ -39,9 +39,9 @@ RSpec.describe SortingPolicy do it { is_expected.to permit_action(:index) } it { is_expected.to permit_action(:show) } - it { is_expected.to forbid_new_and_create_actions } - it { is_expected.to forbid_edit_and_update_actions } - it { is_expected.to forbid_action(:destroy) } + it { is_expected.to permit_new_and_create_actions } + it { is_expected.to permit_edit_and_update_actions } + it { is_expected.to permit_action(:destroy) } end describe "Scope" do diff --git a/spec/policies/sphericity_policy_spec.rb b/spec/policies/sphericity_policy_spec.rb index f254f39..4f72298 100644 --- a/spec/policies/sphericity_policy_spec.rb +++ b/spec/policies/sphericity_policy_spec.rb @@ -17,21 +17,21 @@ RSpec.describe SphericityPolicy do context "for an apprentice" do let(:user) { FactoryBot.create(:user, :apprentice) } - it { is_expected.to forbid_action(:index) } - it { is_expected.to forbid_action(:show) } - it { is_expected.to forbid_new_and_create_actions } - it { is_expected.to forbid_edit_and_update_actions } + it { is_expected.to permit_action(:index) } + it { is_expected.to permit_action(:show) } + it { is_expected.to permit_new_and_create_actions } + it { is_expected.to permit_edit_and_update_actions } it { is_expected.to forbid_action(:destroy) } end context "for an editor" do let(:user) { FactoryBot.create(:user, :editor) } - it { is_expected.to forbid_action(:index) } - it { is_expected.to forbid_action(:show) } - it { is_expected.to forbid_new_and_create_actions } - it { is_expected.to forbid_edit_and_update_actions } - it { is_expected.to forbid_action(:destroy) } + it { is_expected.to permit_action(:index) } + it { is_expected.to permit_action(:show) } + it { is_expected.to permit_new_and_create_actions } + it { is_expected.to permit_edit_and_update_actions } + it { is_expected.to permit_action(:destroy) } end context "for an admin" do @@ -39,9 +39,9 @@ RSpec.describe SphericityPolicy do it { is_expected.to permit_action(:index) } it { is_expected.to permit_action(:show) } - it { is_expected.to forbid_new_and_create_actions } - it { is_expected.to forbid_edit_and_update_actions } - it { is_expected.to forbid_action(:destroy) } + it { is_expected.to permit_new_and_create_actions } + it { is_expected.to permit_edit_and_update_actions } + it { is_expected.to permit_action(:destroy) } end describe "Scope" do diff --git a/spec/policies/surface_policy_spec.rb b/spec/policies/surface_policy_spec.rb index 5df3fb6..e186cd7 100644 --- a/spec/policies/surface_policy_spec.rb +++ b/spec/policies/surface_policy_spec.rb @@ -17,21 +17,21 @@ RSpec.describe SurfacePolicy do context "for an apprentice" do let(:user) { FactoryBot.create(:user, :apprentice) } - it { is_expected.to forbid_action(:index) } - it { is_expected.to forbid_action(:show) } - it { is_expected.to forbid_new_and_create_actions } - it { is_expected.to forbid_edit_and_update_actions } + it { is_expected.to permit_action(:index) } + it { is_expected.to permit_action(:show) } + it { is_expected.to permit_new_and_create_actions } + it { is_expected.to permit_edit_and_update_actions } it { is_expected.to forbid_action(:destroy) } end context "for an editor" do let(:user) { FactoryBot.create(:user, :editor) } - it { is_expected.to forbid_action(:index) } - it { is_expected.to forbid_action(:show) } - it { is_expected.to forbid_new_and_create_actions } - it { is_expected.to forbid_edit_and_update_actions } - it { is_expected.to forbid_action(:destroy) } + it { is_expected.to permit_action(:index) } + it { is_expected.to permit_action(:show) } + it { is_expected.to permit_new_and_create_actions } + it { is_expected.to permit_edit_and_update_actions } + it { is_expected.to permit_action(:destroy) } end context "for an admin" do @@ -39,9 +39,9 @@ RSpec.describe SurfacePolicy do it { is_expected.to permit_action(:index) } it { is_expected.to permit_action(:show) } - it { is_expected.to forbid_new_and_create_actions } - it { is_expected.to forbid_edit_and_update_actions } - it { is_expected.to forbid_action(:destroy) } + it { is_expected.to permit_new_and_create_actions } + it { is_expected.to permit_edit_and_update_actions } + it { is_expected.to permit_action(:destroy) } end describe "Scope" do diff --git a/spec/policies/text_policy_spec.rb b/spec/policies/text_policy_spec.rb index a992ca6..3bb043f 100644 --- a/spec/policies/text_policy_spec.rb +++ b/spec/policies/text_policy_spec.rb @@ -17,21 +17,21 @@ RSpec.describe TextPolicy do context "for an apprentice" do let(:user) { FactoryBot.create(:user, :apprentice) } - it { is_expected.to forbid_action(:index) } - it { is_expected.to forbid_action(:show) } - it { is_expected.to forbid_new_and_create_actions } - it { is_expected.to forbid_edit_and_update_actions } + it { is_expected.to permit_action(:index) } + it { is_expected.to permit_action(:show) } + it { is_expected.to permit_new_and_create_actions } + it { is_expected.to permit_edit_and_update_actions } it { is_expected.to forbid_action(:destroy) } end context "for an editor" do let(:user) { FactoryBot.create(:user, :editor) } - it { is_expected.to forbid_action(:index) } - it { is_expected.to forbid_action(:show) } - it { is_expected.to forbid_new_and_create_actions } - it { is_expected.to forbid_edit_and_update_actions } - it { is_expected.to forbid_action(:destroy) } + it { is_expected.to permit_action(:index) } + it { is_expected.to permit_action(:show) } + it { is_expected.to permit_new_and_create_actions } + it { is_expected.to permit_edit_and_update_actions } + it { is_expected.to permit_action(:destroy) } end context "for an admin" do diff --git a/spec/policies/texture_policy_spec.rb b/spec/policies/texture_policy_spec.rb index ffdc8ea..0921093 100644 --- a/spec/policies/texture_policy_spec.rb +++ b/spec/policies/texture_policy_spec.rb @@ -17,21 +17,21 @@ RSpec.describe TexturePolicy do context "for an apprentice" do let(:user) { FactoryBot.create(:user, :apprentice) } - it { is_expected.to forbid_action(:index) } - it { is_expected.to forbid_action(:show) } - it { is_expected.to forbid_new_and_create_actions } - it { is_expected.to forbid_edit_and_update_actions } + it { is_expected.to permit_action(:index) } + it { is_expected.to permit_action(:show) } + it { is_expected.to permit_new_and_create_actions } + it { is_expected.to permit_edit_and_update_actions } it { is_expected.to forbid_action(:destroy) } end context "for an editor" do let(:user) { FactoryBot.create(:user, :editor) } - it { is_expected.to forbid_action(:index) } - it { is_expected.to forbid_action(:show) } - it { is_expected.to forbid_new_and_create_actions } - it { is_expected.to forbid_edit_and_update_actions } - it { is_expected.to forbid_action(:destroy) } + it { is_expected.to permit_action(:index) } + it { is_expected.to permit_action(:show) } + it { is_expected.to permit_new_and_create_actions } + it { is_expected.to permit_edit_and_update_actions } + it { is_expected.to permit_action(:destroy) } end context "for an admin" do @@ -39,9 +39,9 @@ RSpec.describe TexturePolicy do it { is_expected.to permit_action(:index) } it { is_expected.to permit_action(:show) } - it { is_expected.to forbid_new_and_create_actions } - it { is_expected.to forbid_edit_and_update_actions } - it { is_expected.to forbid_action(:destroy) } + it { is_expected.to permit_new_and_create_actions } + it { is_expected.to permit_edit_and_update_actions } + it { is_expected.to permit_action(:destroy) } end describe "Scope" do diff --git a/spec/policies/type_policy_spec.rb b/spec/policies/type_policy_spec.rb index 2c4f0b0..5934541 100644 --- a/spec/policies/type_policy_spec.rb +++ b/spec/policies/type_policy_spec.rb @@ -17,21 +17,21 @@ RSpec.describe TypePolicy do context "for an apprentice" do let(:user) { FactoryBot.create(:user, :apprentice) } - it { is_expected.to forbid_action(:index) } - it { is_expected.to forbid_action(:show) } - it { is_expected.to forbid_new_and_create_actions } - it { is_expected.to forbid_edit_and_update_actions } + it { is_expected.to permit_action(:index) } + it { is_expected.to permit_action(:show) } + it { is_expected.to permit_new_and_create_actions } + it { is_expected.to permit_edit_and_update_actions } it { is_expected.to forbid_action(:destroy) } end context "for an editor" do let(:user) { FactoryBot.create(:user, :editor) } - it { is_expected.to forbid_action(:index) } - it { is_expected.to forbid_action(:show) } - it { is_expected.to forbid_new_and_create_actions } - it { is_expected.to forbid_edit_and_update_actions } - it { is_expected.to forbid_action(:destroy) } + it { is_expected.to permit_action(:index) } + it { is_expected.to permit_action(:show) } + it { is_expected.to permit_new_and_create_actions } + it { is_expected.to permit_edit_and_update_actions } + it { is_expected.to permit_action(:destroy) } end context "for an admin" do @@ -39,9 +39,9 @@ RSpec.describe TypePolicy do it { is_expected.to permit_action(:index) } it { is_expected.to permit_action(:show) } - it { is_expected.to forbid_new_and_create_actions } - it { is_expected.to forbid_edit_and_update_actions } - it { is_expected.to forbid_action(:destroy) } + it { is_expected.to permit_new_and_create_actions } + it { is_expected.to permit_edit_and_update_actions } + it { is_expected.to permit_action(:destroy) } end describe "Scope" do diff --git a/spec/policies/vessel_form_type_policy_spec.rb b/spec/policies/vessel_form_type_policy_spec.rb index 710957a..d6881da 100644 --- a/spec/policies/vessel_form_type_policy_spec.rb +++ b/spec/policies/vessel_form_type_policy_spec.rb @@ -17,21 +17,21 @@ RSpec.describe VesselFormTypePolicy do context "for an apprentice" do let(:user) { FactoryBot.create(:user, :apprentice) } - it { is_expected.to forbid_action(:index) } - it { is_expected.to forbid_action(:show) } - it { is_expected.to forbid_new_and_create_actions } - it { is_expected.to forbid_edit_and_update_actions } + it { is_expected.to permit_action(:index) } + it { is_expected.to permit_action(:show) } + it { is_expected.to permit_new_and_create_actions } + it { is_expected.to permit_edit_and_update_actions } it { is_expected.to forbid_action(:destroy) } end context "for an editor" do let(:user) { FactoryBot.create(:user, :editor) } - it { is_expected.to forbid_action(:index) } - it { is_expected.to forbid_action(:show) } - it { is_expected.to forbid_new_and_create_actions } - it { is_expected.to forbid_edit_and_update_actions } - it { is_expected.to forbid_action(:destroy) } + it { is_expected.to permit_action(:index) } + it { is_expected.to permit_action(:show) } + it { is_expected.to permit_new_and_create_actions } + it { is_expected.to permit_edit_and_update_actions } + it { is_expected.to permit_action(:destroy) } end context "for an admin" do @@ -39,9 +39,9 @@ RSpec.describe VesselFormTypePolicy do it { is_expected.to permit_action(:index) } it { is_expected.to permit_action(:show) } - it { is_expected.to forbid_new_and_create_actions } - it { is_expected.to forbid_edit_and_update_actions } - it { is_expected.to forbid_action(:destroy) } + it { is_expected.to permit_new_and_create_actions } + it { is_expected.to permit_edit_and_update_actions } + it { is_expected.to permit_action(:destroy) } end describe "Scope" do diff --git a/spec/policies/voids_form_policy_spec.rb b/spec/policies/voids_form_policy_spec.rb index 6ebd21a..9dba889 100644 --- a/spec/policies/voids_form_policy_spec.rb +++ b/spec/policies/voids_form_policy_spec.rb @@ -17,21 +17,21 @@ RSpec.describe VoidsFormPolicy do context "for an apprentice" do let(:user) { FactoryBot.create(:user, :apprentice) } - it { is_expected.to forbid_action(:index) } - it { is_expected.to forbid_action(:show) } - it { is_expected.to forbid_new_and_create_actions } - it { is_expected.to forbid_edit_and_update_actions } + it { is_expected.to permit_action(:index) } + it { is_expected.to permit_action(:show) } + it { is_expected.to permit_new_and_create_actions } + it { is_expected.to permit_edit_and_update_actions } it { is_expected.to forbid_action(:destroy) } end context "for an editor" do let(:user) { FactoryBot.create(:user, :editor) } - it { is_expected.to forbid_action(:index) } - it { is_expected.to forbid_action(:show) } - it { is_expected.to forbid_new_and_create_actions } - it { is_expected.to forbid_edit_and_update_actions } - it { is_expected.to forbid_action(:destroy) } + it { is_expected.to permit_action(:index) } + it { is_expected.to permit_action(:show) } + it { is_expected.to permit_new_and_create_actions } + it { is_expected.to permit_edit_and_update_actions } + it { is_expected.to permit_action(:destroy) } end context "for an admin" do @@ -39,9 +39,9 @@ RSpec.describe VoidsFormPolicy do it { is_expected.to permit_action(:index) } it { is_expected.to permit_action(:show) } - it { is_expected.to forbid_new_and_create_actions } - it { is_expected.to forbid_edit_and_update_actions } - it { is_expected.to forbid_action(:destroy) } + it { is_expected.to permit_new_and_create_actions } + it { is_expected.to permit_edit_and_update_actions } + it { is_expected.to permit_action(:destroy) } end describe "Scope" do diff --git a/spec/policies/ware_policy_spec.rb b/spec/policies/ware_policy_spec.rb index 675c090..ac73757 100644 --- a/spec/policies/ware_policy_spec.rb +++ b/spec/policies/ware_policy_spec.rb @@ -17,21 +17,21 @@ RSpec.describe WarePolicy do context "for an apprentice" do let(:user) { FactoryBot.create(:user, :apprentice) } - it { is_expected.to forbid_action(:index) } - it { is_expected.to forbid_action(:show) } - it { is_expected.to forbid_new_and_create_actions } - it { is_expected.to forbid_edit_and_update_actions } + it { is_expected.to permit_action(:index) } + it { is_expected.to permit_action(:show) } + it { is_expected.to permit_new_and_create_actions } + it { is_expected.to permit_edit_and_update_actions } it { is_expected.to forbid_action(:destroy) } end context "for an editor" do let(:user) { FactoryBot.create(:user, :editor) } - it { is_expected.to forbid_action(:index) } - it { is_expected.to forbid_action(:show) } - it { is_expected.to forbid_new_and_create_actions } - it { is_expected.to forbid_edit_and_update_actions } - it { is_expected.to forbid_action(:destroy) } + it { is_expected.to permit_action(:index) } + it { is_expected.to permit_action(:show) } + it { is_expected.to permit_new_and_create_actions } + it { is_expected.to permit_edit_and_update_actions } + it { is_expected.to permit_action(:destroy) } end context "for an admin" do @@ -39,9 +39,9 @@ RSpec.describe WarePolicy do it { is_expected.to permit_action(:index) } it { is_expected.to permit_action(:show) } - it { is_expected.to forbid_new_and_create_actions } - it { is_expected.to forbid_edit_and_update_actions } - it { is_expected.to forbid_action(:destroy) } + it { is_expected.to permit_new_and_create_actions } + it { is_expected.to permit_edit_and_update_actions } + it { is_expected.to permit_action(:destroy) } end describe "Scope" do -- GitLab