Sha256: 7567ead734334fa0edba143241f14054bd703674b96a05061df01dfd4d0ca0d9

Contents?: true

Size: 785 Bytes

Versions: 6

Compression:

Stored size: 785 Bytes

Contents

module TFA
  describe Console do
    subject { Console.new('testing') }
    let(:secret) { ::ROTP::Base32.random_base32 }

    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

      context "when running an unknown command" do
        it "returns the usage" do
          expect(subject.run([])).to_not be_nil
        end
      end
    end
  end
end

Version data entries

6 entries across 6 versions & 1 rubygems

Version Path
tfa-0.0.6 spec/lib/console_spec.rb
tfa-0.0.5 spec/lib/console_spec.rb
tfa-0.0.4 spec/lib/console_spec.rb
tfa-0.0.3 spec/lib/console_spec.rb
tfa-0.0.2 spec/lib/console_spec.rb
tfa-0.0.1 spec/lib/console_spec.rb