diff options
| author | mo khan <mo@mokhan.ca> | 2014-07-25 14:24:07 -0600 |
|---|---|---|
| committer | mo khan <mo@mokhan.ca> | 2014-07-25 14:24:07 -0600 |
| commit | 5d26288b2c9cfd5ce6cb92fd0363621fba87d6a3 (patch) | |
| tree | 6a8d4bb6b6aa8b54a0079046f83340dce0ada9af /spec | |
| parent | b165d71bbdc267690331d989b54f237ea9defc1e (diff) | |
add a usage command.v0.0.1
Diffstat (limited to 'spec')
| -rw-r--r-- | spec/lib/console_spec.rb | 26 |
1 files changed, 19 insertions, 7 deletions
diff --git a/spec/lib/console_spec.rb b/spec/lib/console_spec.rb index 90098d0..966ca9a 100644 --- a/spec/lib/console_spec.rb +++ b/spec/lib/console_spec.rb @@ -3,14 +3,26 @@ module TFA subject { Console.new('testing') } let(:secret) { ::ROTP::Base32.random_base32 } - it "saves a new secret" do - subject.run(["add", "development", secret]) - expect(subject.run(["show", "development"])).to eql(secret) - end + describe "#run" do + context "when adding a key" do + it "saves a new secret" do + subject.run(["add", "development", secret]) + expect(subject.run(["show", "development"])).to eql(secret) + end + end + + context "when getting a one time password" do + it "creates a totp for a certain key" do + subject.run(["add", "development", secret]) + expect(subject.run(["totp", "development"])).to_not be_nil + end + end - it "creates a totp for a certain key" do - subject.run(["add", "development", secret]) - expect(subject.run(["totp", "development"])).to_not be_nil + context "when running an unknown command" do + it "returns the usage" do + expect(subject.run([])).to_not be_nil + end + end end end end |
