Sha256: 5589ec37385817c5eaf60422804d970a5f89fea0cf76d05da70b54f2be8783d3
Contents?: true
Size: 1.46 KB
Versions: 5
Compression:
Stored size: 1.46 KB
Contents
require 'spec_helper' describe EyProCli do describe "login" do context "with a valid user and password" do before(:each) { subject.class.core_file = @tempfile } it "writes the token" do allow(subject).to receive(:ask) { FFaker::Internet.email } output = capture(:stdout) { subject.login } expect(output).to match(/writing token/i) expect(read_yaml(@tempfile)).to have_key("https://api.engineyard.com/") end it "updates the token if it does not match" do allow(subject).to receive(:ask) { FFaker::Internet.email } output = capture(:stdout) { subject.login } expect(output).to match(/writing token/i) output = capture(:stdout) { subject.login } expect(output).to match(/token does not match/i) end it "does not update the token if it already exists" do allow(subject).to receive(:ask) { FFaker::Internet.email } output = capture(:stdout) { subject.login } expect(output).to match(/writing token/i) yaml = read_yaml(@tempfile) expect(yaml).to have_key("https://api.engineyard.com/") allow(subject.unauthenticated_core_client).to receive(:get_api_token) { Ey::Core::Response.new( :body => {"api_token" => yaml["https://api.engineyard.com/"]} ) } output = capture(:stdout) { subject.login } expect(output).to match(/token already exists/i) end end end end
Version data entries
5 entries across 5 versions & 1 rubygems
Version | Path |
---|---|
ey-pro-cli-0.0.8 | spec/login_spec.rb |
ey-pro-cli-0.0.7 | spec/login_spec.rb |
ey-pro-cli-0.0.6 | spec/login_spec.rb |
ey-pro-cli-0.0.5 | spec/login_spec.rb |
ey-pro-cli-0.0.4 | spec/login_spec.rb |