spec/shared/authenticator.rb in rbnacl-2.0.0.pre vs spec/shared/authenticator.rb in rbnacl-2.0.0

- old
+ new

@@ -51,23 +51,22 @@ it "raises ArgumentError on a key which is too long" do expect { described_class.verify("\0"*33, tag, message) }.to raise_error(ArgumentError) end it "fails to validate an invalid authenticator" do - described_class.verify(key, tag, message+"\0").should be false + expect { described_class.verify(key, tag, message+"\0") }.to raise_error(RbNaCl::BadAuthenticatorError) end it "fails to validate a short authenticator" do - described_class.verify(key, tag[0,tag.bytesize - 2], message).should be false + expect { described_class.verify(key, tag[0,tag.bytesize - 2], message) }.to raise_error(RbNaCl::LengthError) end it "fails to validate a long authenticator" do - described_class.verify(key, tag+"\0", message).should be false + expect { described_class.verify(key, tag+"\0", message) }.to raise_error(RbNaCl::LengthError) end end - context "Instance methods" do let(:authenticator) { described_class.new(key) } context "#auth" do it "produces an authenticator" do @@ -79,18 +78,18 @@ it "verifies an authenticator" do authenticator.verify(tag, message).should be true end it "fails to validate an invalid authenticator" do - authenticator.verify(tag, message+"\0").should be false + expect { authenticator.verify(tag, message+"\0") }.to raise_error(RbNaCl::BadAuthenticatorError) end it "fails to validate a short authenticator" do - authenticator.verify(tag[0,tag.bytesize - 2], message).should be false + expect { authenticator.verify(tag[0,tag.bytesize - 2], message) }.to raise_error(RbNaCl::LengthError) end it "fails to validate a long authenticator" do - authenticator.verify(tag+"\0", message).should be false + expect { authenticator.verify(tag+"\0", message) }.to raise_error(RbNaCl::LengthError) end end end end