spec/certmeister/policy/chain_all_spec.rb in certmeister-0.4.0 vs spec/certmeister/policy/chain_all_spec.rb in certmeister-0.4.1
- old
+ new
@@ -30,11 +30,19 @@
policies = [refuse_last, refuse_first]
policies.each do |policy|
response = policy.authenticate({anything: 'something'})
expect(response).to_not be_authenticated
- expect(response.error).to eql "blackholed"
end
+ end
+
+ it "uses the error message of the first encountered refusal in the chain" do
+ policy = Certmeister::Policy::ChainAll.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