Sha256: c6e459242ca88588f43b9672a05d227f9ba04ddcb8320ce22df5323a7560e081

Contents?: true

Size: 575 Bytes

Versions: 1

Compression:

Stored size: 575 Bytes

Contents

require "tempfile"

module TFA
  describe TotpCommand do
    subject { TotpCommand.new(storage) }
    let(:secret) { ::ROTP::Base32.random_base32 }
    let(:storage) { PStore.new(Tempfile.new('test').path) }

    before :each do
      storage.transaction do
        storage['development'] = secret
      end
    end

    describe "#run" do
      it "returns a time based one time password for the authentication secret given" do
        correct_code = ::ROTP::TOTP.new(secret).now
        expect(subject.run(["development"])).to eql(correct_code)
      end
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
tfa-0.0.1 spec/lib/totp_command_spec.rb