Sha256: 9cac70525bf1e7ce12aacbe63a77868029e68c825d63d5591d4eca14f207ab4f

Contents?: true

Size: 998 Bytes

Versions: 5

Compression:

Stored size: 998 Bytes

Contents

# frozen_string_literal: true

require "rails_helper"

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

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

    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

5 entries across 5 versions & 1 rubygems

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