spec/certmeister/policy/chain_any_spec.rb in certmeister-0.4.0 vs spec/certmeister/policy/chain_any_spec.rb in certmeister-0.4.1
- old
+ new
@@ -23,15 +23,21 @@
response = policy.authenticate({anything: 'something'})
expect(response).to be_authenticated
end
it "refuses a request that none of its chained policies refuses" do
- policy = Certmeister::Policy::ChainAll.new([ Certmeister::Policy::Blackhole.new, Certmeister::Policy::Blackhole.new])
+ policy = Certmeister::Policy::ChainAny.new([ Certmeister::Policy::Blackhole.new, Certmeister::Policy::Blackhole.new])
response = policy.authenticate({anything: 'something'})
expect(response).to_not be_authenticated
- expect(response.error).to eql "blackholed"
end
- it "uses the error message of the last encountered refusal in the chain"
+ it "uses the error message of the first encountered refusal in the chain" do
+ policy = Certmeister::Policy::ChainAny.new([
+ Certmeister::Policy::Domain.new(['unmatched.com']),
+ Certmeister::Policy::Blackhole.new,
+ ])
+ response = policy.authenticate({cn: 'wrongdomain.com'})
+ expect(response.error).to eql 'cn in unknown domain'
+ end
end