Sha256: 6282d0176d489139c6db069fd944ec61fb735574ed71efb7743edf3de5c5b6de

Contents?: true

Size: 747 Bytes

Versions: 4

Compression:

Stored size: 747 Bytes

Contents

# frozen_string_literal: true

require "rails_helper"

module Archangel
  RSpec.describe SitePolicy, type: :policy do
    subject { described_class.new(user, record) }

    let(:record) { create(:site) }

    context "with `admin` role" do
      let(:user) { create(:user, :admin) }

      it { is_expected.to permit(:show) }
      it { is_expected.to permit(:update) }
      it { is_expected.to permit(:edit) }

      it { is_expected.to permit(:sample) }
    end

    context "with `editor` role" do
      let(:user) { create(:user, :editor) }

      it { is_expected.to permit(:show) }

      it { is_expected.to permit(:sample) }

      it { is_expected.to_not permit(:update) }
      it { is_expected.to_not permit(:edit) }
    end
  end
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
archangel-0.3.0 spec/policies/archangel/site_policy_spec.rb
archangel-0.0.8 spec/policies/archangel/site_policy_spec.rb
archangel-0.0.7 spec/policies/archangel/site_policy_spec.rb
archangel-0.0.6 spec/policies/archangel/site_policy_spec.rb