spec/policies/archangel/asset_policy_spec.rb in archangel-0.0.5 vs spec/policies/archangel/asset_policy_spec.rb in archangel-0.0.6

- old
+ new

@@ -4,19 +4,36 @@ module Archangel RSpec.describe AssetPolicy, type: :policy do subject { described_class.new(user, record) } - let(:user) { create(:user) } let(:record) { create(:asset) } - it { should permit(:index) } - it { should permit(:show) } - it { should permit(:create) } - it { should permit(:new) } - it { should permit(:update) } - it { should permit(:edit) } - it { should permit(:destroy) } + context "with `admin` role" do + let(:user) { create(:user, :admin) } - it { should permit(:wysiwyg) } + 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(:wysiwyg) } + 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(:wysiwyg) } + end end end