Sha256: 46c60ec23f67b3c32aacb49240509c1e4bf14f6c1a931a53f16ee4131752995b

Contents?: true

Size: 710 Bytes

Versions: 27

Compression:

Stored size: 710 Bytes

Contents

# -*- coding: utf-8 -*-
require 'spec_helper'

describe Magellan::Cli::Messaging::Http do

  let(:cmd){ Magellan::Cli::Messaging::Http.new }

  describe :login_by_token do
    let(:email)    { "user1@example.com" }
    let(:password) { "password" }
    let(:success_res) { double(:success_res, status: 200) }
    let(:error_res)   { double(:error_res, status: 401) }

    it "success" do
      allow(cmd.http_conn.httpclient).to receive(:get).and_return(success_res)
      cmd.login_by_token!(email, password)
    end

    it "error" do
      allow(cmd.http_conn.httpclient).to receive(:get).and_return(error_res)
      expect{cmd.login_by_token!(email, password)}.to raise_error(SystemExit)
    end
  end
end

Version data entries

27 entries across 27 versions & 1 rubygems

Version Path
magellan-cli-0.11.1 spec/magellan/cli/http_spec.rb
magellan-cli-0.11.0 spec/magellan/cli/http_spec.rb
magellan-cli-0.10.0 spec/magellan/cli/http_spec.rb
magellan-cli-0.9.1 spec/magellan/cli/http_spec.rb
magellan-cli-0.9.0 spec/magellan/cli/http_spec.rb
magellan-cli-0.8.3 spec/magellan/cli/http_spec.rb
magellan-cli-0.8.2 spec/magellan/cli/http_spec.rb
magellan-cli-0.8.1 spec/magellan/cli/http_spec.rb
magellan-cli-0.8.0 spec/magellan/cli/http_spec.rb
magellan-cli-0.7.11 spec/magellan/cli/http_spec.rb
magellan-cli-0.7.10 spec/magellan/cli/http_spec.rb
magellan-cli-0.7.9 spec/magellan/cli/http_spec.rb
magellan-cli-0.7.8 spec/magellan/cli/http_spec.rb
magellan-cli-0.7.7 spec/magellan/cli/http_spec.rb
magellan-cli-0.7.6 spec/magellan/cli/http_spec.rb
magellan-cli-0.7.5 spec/magellan/cli/http_spec.rb
magellan-cli-0.7.4 spec/magellan/cli/http_spec.rb
magellan-cli-0.7.3 spec/magellan/cli/http_spec.rb
magellan-cli-0.7.2 spec/magellan/cli/http_spec.rb
magellan-cli-0.7.1 spec/magellan/cli/http_spec.rb