spec/hotp_spec.rb in rotp-1.4.2 vs spec/hotp_spec.rb in rotp-1.4.3
- old
+ new
@@ -1,17 +1,20 @@
require 'spec_helper'
describe ROTP::HOTP do
- before(:all) { @now = Time.utc(2012,1,1).to_i / 30 }
+ before(:all) { @counter = 1234 }
subject { ROTP::HOTP.new('a' * 32) }
it "should generate a number given a time" do
- subject.at(@now).should == 160864
+ subject.at(@counter).should == 161024
end
+ it "should generate a number as a string" do
+ subject.at(@counter, true).should == "161024"
+ end
it "should verify a number" do
- subject.verify(160864, @now).should be_true
+ subject.verify(161024, @counter).should be_true
end
it "should verify a string" do
- subject.verify("160864", @now).should be_true
+ subject.verify("161024", @counter).should be_true
end
end