Sha256: cd54d058f032691f1048da7fc5c6517b92bc73afa178814a1a24fd5b3521a6c5
Contents?: true
Size: 1000 Bytes
Versions: 1
Compression:
Stored size: 1000 Bytes
Contents
module TFA describe CLI do subject { CLI.new } def code_for(secret) ::ROTP::TOTP.new(secret).now end let(:secret) { ::ROTP::Base32.random_base32 } describe "#add" do context "when a secret is added" do it "adds the secret" do subject.add("development", secret) expect(subject.show("development")).to eql(secret) end end context "when a full otpauth string is added" do it "strips out the url for just the secret" do url = "otpauth://totp/email@email.com?secret=#{secret}&issuer=" subject.add("development", url) expect(subject.show("development")).to eql(secret) end end end describe "#totp" do context "when a single key is given" do it "returns a time based one time password" do subject.add("development", secret) expect(subject.totp("development")).to eql(code_for(secret)) end end end end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
tfa-0.0.11 | spec/lib/cli_spec.rb |