Commit 2e67274
Changed files (2)
spec
spec/lib/show_command_spec.rb
@@ -1,7 +1,7 @@
module TFA
describe ShowCommand do
subject { ShowCommand.new(storage) }
- let(:storage) { Storage.new(Tempfile.new('blah').path) }
+ let(:storage) { Storage.new(SecureRandom.uuid) }
describe "#run" do
context "when looking up the secret for a specific key" do
spec/lib/totp_command_spec.rb
@@ -1,8 +1,8 @@
module TFA
describe TotpCommand do
subject { TotpCommand.new(storage) }
- let(:secret) { ::ROTP::Base32.random_base32 }
let(:storage) { Storage.new(Tempfile.new('test').path) }
+ let(:storage) { Storage.new(SecureRandom.uuid) }
def code_for(secret)
::ROTP::TOTP.new(secret).now
@@ -10,6 +10,8 @@ module TFA
describe "#run" do
context "when a single key is given" do
+ let(:secret) { ::ROTP::Base32.random_base32 }
+
it "returns a time based one time password for the authentication secret given" do
storage.save('development', secret)
expect(subject.run(["development"])).to eql(code_for(secret))