diff options
| author | Gavin Miller <gavmille@cisco.com> | 2015-08-06 16:34:58 -0600 |
|---|---|---|
| committer | Gavin Miller <gavmille@cisco.com> | 2015-08-06 16:34:58 -0600 |
| commit | 39f9e7695b4a55a6a9848d80f05b5cc623f8f027 (patch) | |
| tree | 87dbe3bec258c2fda251fcfb67f9c87cf7b556ed | |
| parent | b4332fff23e51324947373a8e302e637cf94f266 (diff) | |
Fix up hound catches on quoting
| -rw-r--r-- | lib/tfa/cli.rb | 2 | ||||
| -rw-r--r-- | spec/lib/cli_spec.rb | 14 |
2 files changed, 9 insertions, 7 deletions
diff --git a/lib/tfa/cli.rb b/lib/tfa/cli.rb index 747846e..107f202 100644 --- a/lib/tfa/cli.rb +++ b/lib/tfa/cli.rb @@ -29,7 +29,7 @@ module TFA end def clean(secret) - if secret.include?('=') + if secret.include?("=") /secret=([^&]*)/.match(secret).captures.first else secret diff --git a/spec/lib/cli_spec.rb b/spec/lib/cli_spec.rb index 10ba29d..52f1a42 100644 --- a/spec/lib/cli_spec.rb +++ b/spec/lib/cli_spec.rb @@ -11,23 +11,25 @@ module TFA 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) + 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 - subject.add('development', "otpauth://totp/email@email.com?secret=#{secret}&issuer=") - expect(subject.show('development')).to eql(secret) + 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 for the authentication secret given" do - subject.add('development', secret) + it "returns a time based one time password" do + subject.add("development", secret) expect(subject.totp("development")).to eql(code_for(secret)) end end |
