Commit cf229b0
Changed files (2)
spec
spec/lib/cli_spec.rb
@@ -70,7 +70,7 @@ module TFA
describe "#destroy" do
let(:name) { "development" }
- it 'removes the secret with the given name' do
+ it "removes the secret with the given name" do
subject.add(name, dev_secret)
subject.destroy(name)
spec/lib/totp_command_spec.rb
@@ -12,7 +12,7 @@ module TFA
let(:secret) { ::ROTP::Base32.random_base32 }
it "returns a time based one time password for the authentication secret given" do
- storage.save('development', secret)
+ storage.save("development", secret)
expect(subject.run("development")).to eql(code_for(secret))
end
end
@@ -22,16 +22,16 @@ module TFA
let(:staging_secret) { ::ROTP::Base32.random_base32 }
it "returns the one time password for all keys" do
- storage.save('development', development_secret)
- storage.save('staging', staging_secret)
+ storage.save("development", development_secret)
+ storage.save("staging", staging_secret)
expect(subject.run(nil)).to eql([
- { 'development' => code_for(development_secret) },
- { 'staging' => code_for(staging_secret) }
+ { "development" => code_for(development_secret) },
+ { "staging" => code_for(staging_secret) }
])
end
end
- context 'when the key is not known' do
+ context "when the key is not known" do
it "returns with nothing" do
expect(subject.run(["blah"])).to be_empty
end
@@ -40,11 +40,13 @@ module TFA
context "when the secret is invalid" do
let(:invalid_secret) { "hello world" }
- it 'returns an error message' do
- storage.save('development', invalid_secret)
- expect(subject.run(["development"])).to eql([
- { 'development' => "INVALID SECRET" }
- ])
+ before :each do
+ storage.save("development", invalid_secret)
+ end
+
+ it "returns an error message" do
+ expected = { "development" => "INVALID SECRET" }
+ expect(subject.run(["development"])).to match_array([expected])
end
end
end