Sha256: 6aafb39b05dd021533d277c0587049b804fa538e8f3b063a7bf87bf7131adcd9

Contents?: true

Size: 998 Bytes

Versions: 1

Compression:

Stored size: 998 Bytes

Contents

# frozen_string_literal: true

require "rails_helper"

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

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

    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

1 entries across 1 versions & 1 rubygems

Version Path
archangel-0.4.0 spec/unit/policies/archangel/design_policy_spec.rb