Sha256: 977fcb32158cdcf96bf402c69b4941007c16f310b233bf66834ec6eaf202ac7e

Contents?: true

Size: 1002 Bytes

Versions: 4

Compression:

Stored size: 1002 Bytes

Contents

# frozen_string_literal: true

require "rails_helper"

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

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

    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) }
    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) }
    end
  end
end

Version data entries

4 entries across 4 versions & 1 rubygems

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