Sha256: 078cdbbba23c9f52e7846775c0c051620bd7b2ef92a910c9184fac80a3f13351

Contents?: true

Size: 555 Bytes

Versions: 2

Compression:

Stored size: 555 Bytes

Contents

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

2 entries across 2 versions & 1 rubygems

Version Path
tfa-0.0.3 spec/lib/totp_command_spec.rb
tfa-0.0.2 spec/lib/totp_command_spec.rb