spec/token_spec.rb in fernet-2.0 vs spec/token_spec.rb in fernet-2.1

- old
+ new

@@ -11,45 +11,45 @@ bogus_hmac = "1" * 32 Fernet::Encryption.stub(hmac_digest: bogus_hmac) token = Fernet::Token.new(generated.to_s, secret: secret) - expect(token.valid?).to be_false + expect(token.valid?).to eq(false) expect(token.errors[:signature]).to include("does not match") end it 'is invalid if too old' do generated = Fernet::Token.generate(secret: secret, message: 'hello', now: Time.now - 61) token = Fernet::Token.new(generated.to_s, enforce_ttl: true, ttl: 60, secret: secret) - expect(token.valid?).to be_false + expect(token.valid?).to eq(false) expect(token.errors[:issued_timestamp]).to include("is too far in the past: token expired") end it 'is invalid with a large clock skew' do generated = Fernet::Token.generate(secret: secret, message: 'hello', now: Time.at(Time.now.to_i + 61)) token = Fernet::Token.new(generated.to_s, secret: secret) - expect(token.valid?).to be_false + expect(token.valid?).to eq(false) expect(token.errors[:issued_timestamp]).to include("is too far in the future") end it 'is invalid with bad base64' do token = Fernet::Token.new('bad', secret: secret) - expect(token.valid?).to be_false + expect(token.valid?).to eq(false) expect(token.errors[:token]).to include("invalid base64") end it 'is invalid with an unknown token version' do token = Fernet::Token.new(Base64.urlsafe_encode64("xxxxxx"), secret: secret) - expect(token.valid?).to be_false + expect(token.valid?).to eq(false) expect(token.errors[:version]).to include("is unknown") end end describe Fernet::Token, 'message' do