Sha256: 50ce455b155a922ef9cdd5b374addd050e731dbc68e2efd673fec6f684e3d474

Contents?: true

Size: 932 Bytes

Versions: 175

Compression:

Stored size: 932 Bytes

Contents

require 'spec_helper'

describe Softcover::Commands::Auth do
  context 'valid login' do
    before do
      email = 'valid@lemurheavy.com'
      pass = 'asdf'

      stub_valid_login email, pass, TEST_API_KEY

      Softcover::Commands::Auth.login email, pass
    end

    it 'should set the api key' do
      expect(Softcover::Config['api_key']).to eq TEST_API_KEY
    end
  end

  context 'invalid login' do
    before do
      email = 'invalid@lemurheavy.com'
      pass = 'asdf'

      stub_invalid_login email, pass

      Softcover::Commands::Auth.login email, pass
    end

    it 'should not set the api key' do
      expect(Softcover::Config['api_key']).to be_nil
    end
  end

  context "logging out" do
    before do
      Softcover::Config['api_key'] = 'asdfasdf'
      Softcover::Commands::Auth.logout
    end

    it "should unset the api_key" do
      expect(Softcover::Config['api_key']).to be_nil
    end
  end
end

Version data entries

175 entries across 175 versions & 2 rubygems

Version Path
softcover-1.10.7 spec/auth_spec.rb
softcover-1.10.6 spec/auth_spec.rb
softcover-1.10.5 spec/auth_spec.rb
softcover-1.10.4 spec/auth_spec.rb
softcover-1.10.3 spec/auth_spec.rb
softcover-1.10.2 spec/auth_spec.rb
softcover-1.10.1 spec/auth_spec.rb
softcover-1.10.0 spec/auth_spec.rb
softcover-1.9.1 spec/auth_spec.rb
softcover-1.9.0 spec/auth_spec.rb
softcover-1.8.3 spec/auth_spec.rb
softcover-1.8.2 spec/auth_spec.rb
softcover-1.8.1 spec/auth_spec.rb
softcover-1.8.0 spec/auth_spec.rb
softcover-1.7.5 spec/auth_spec.rb
softcover-1.7.4 spec/auth_spec.rb
softcover-1.7.3 spec/auth_spec.rb
softcover-1.7.2 spec/auth_spec.rb
softcover-1.7.1 spec/auth_spec.rb
softcover-1.7.0 spec/auth_spec.rb