spec/lib/show_command_spec.rb in tfa-0.0.3 vs spec/lib/show_command_spec.rb in tfa-0.0.4
- old
+ new
@@ -1,16 +1,26 @@
module TFA
describe ShowCommand do
subject { ShowCommand.new(storage) }
- let(:storage) { PStore.new(Tempfile.new('blah').path) }
+ let(:storage) { Storage.new(Tempfile.new('blah').path) }
- it "retrieves the secret associated with the key given" do
- secret = SecureRandom.uuid
- storage.transaction do
- storage['production'] = secret
+ describe "#run" do
+ context "when looking up the secret for a specific key" do
+ it "retrieves the secret associated with the key given" do
+ secret = SecureRandom.uuid
+ storage.save('production', secret)
+ result = subject.run(['production'])
+ expect(result).to eql(secret)
+ end
end
- result = subject.run(['production'])
- expect(result).to eql(secret)
+ context "when a specific name is not given" do
+ it "returns all the secrets" do
+ storage.save('development', "1")
+ storage.save('staging', "2")
+ storage.save('production', "3")
+ expect(subject.run([])).to eql([{"development" => "1"}, { "staging" => "2" }, { "production" => "3" }])
+ end
+ end
end
end
end