spec/policy_spec.rb in access-granted-1.3.0 vs spec/policy_spec.rb in access-granted-1.3.1
- old
+ new
@@ -134,10 +134,14 @@
end
end
end
it "raises AccessDenied if action is not allowed" do
- expect { klass.new(@member).authorize!(:create, Integer) }.to raise_error AccessGranted::AccessDenied
+ expect { klass.new(@member).authorize!(:create, Integer) }.to raise_error do |err|
+ expect(err).to be_a(AccessGranted::AccessDenied)
+ expect(err.action).to eq(:create)
+ expect(err.subject).to eq(Integer)
+ end
end
it "returns the subject if allowed" do
expect(klass.new(@member).authorize!(:create, String)).to equal String
end