spec/certmeister/policy/ip_spec.rb in certmeister-0.2.0 vs spec/certmeister/policy/ip_spec.rb in certmeister-0.2.1
- old
+ new
@@ -1,14 +1,19 @@
require 'spec_helper'
require 'certmeister/policy/ip'
+require 'ipaddr'
describe Certmeister::Policy::IP do
subject { Certmeister::Policy::IP.new(['127.0.0.0/8', '192.168.0.0/23']) }
it "demands a request" do
expect { subject.authenticate }.to raise_error(ArgumentError)
+ end
+
+ it "explodes if initialized with things other than CIDR strings" do
+ expect { Certmeister::Policy::IP.new(['localhost']) }.to_not raise_error(IPAddr::Error)
end
it "refuses to authenticate a request with a missing ip" do
response = subject.authenticate(cn: 'localhost')
expect(response).to_not be_authenticated