Sha256: 6a88052cd40ee500b842c8ed6a1d126b21922c674d8dfd5d4edc94be5065b0a8

Contents?: true

Size: 1.06 KB

Versions: 5

Compression:

Stored size: 1.06 KB

Contents

# frozen_string_literal: true

require "rails_helper"

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

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

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

      it { is_expected.to permit(:index) }
      it { is_expected.to permit(:show) }
      it { is_expected.to permit(:new) }
      it { is_expected.to permit(:create) }
      it { is_expected.to permit(:edit) }
      it { is_expected.to permit(:update) }
      it { is_expected.to permit(:destroy) }

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

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

      it { is_expected.to permit(:index) }
      it { is_expected.to permit(:show) }
      it { is_expected.to permit(:new) }
      it { is_expected.to permit(:create) }
      it { is_expected.to permit(:edit) }
      it { is_expected.to permit(:update) }
      it { is_expected.to permit(:destroy) }

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

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
archangel-0.4.0 spec/unit/policies/archangel/entries_policy_spec.rb
archangel-0.3.0 spec/policies/archangel/entries_policy_spec.rb
archangel-0.0.8 spec/policies/archangel/entries_policy_spec.rb
archangel-0.0.7 spec/policies/archangel/entries_policy_spec.rb
archangel-0.0.6 spec/policies/archangel/entries_policy_spec.rb