Sha256: 59b4e3e9f18cbe2c1c0248be65dc78135817589726fd32d3adc21f285430fab1

Contents?: true

Size: 1.02 KB

Versions: 23

Compression:

Stored size: 1.02 KB

Contents

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

describe Magellan::Cli::Resources::Project do

  let(:base_url){ "https://localhost:3000" }
  let(:httpclient){ double(:httpclient) }
  let(:cli) do
    cli = double(:access_api, base_url: base_url, auth_token: {}, login_auth: {})
    allow(cli).to receive(:httpclient).and_return(httpclient)
    cli
  end
  let(:res){ double(:res, status: 200, body: {}.to_json) }

  let(:cmd){ Magellan::Cli::Resources::Project.new }

  before do
    allow(cmd).to receive(:access_api).and_yield(cli)
  end

  describe :list do
    it do
      expect(httpclient).to receive(:get).with("#{base_url}/admin/project.json").and_return(res)
      expect($stdout).to receive(:puts)
      cmd.list
    end
  end

  describe :show do
    it do
      allow(res).to receive(:body).and_return("{}")
      allow(res).to receive(:status).and_return(200)
      expect(httpclient).to receive(:get).with("#{base_url}/admin/project/1.json").and_return(res)
      expect($stdout).to receive(:puts)
      cmd.show(1)
    end
  end

end

Version data entries

23 entries across 23 versions & 1 rubygems

Version Path
magellan-cli-0.5.0 spec/magellan/cli/resources/project_spec.rb
magellan-cli-0.4.4 spec/magellan/cli/resources/project_spec.rb
magellan-cli-0.4.3 spec/magellan/cli/resources/project_spec.rb
magellan-cli-0.4.2 spec/magellan/cli/resources/project_spec.rb
magellan-cli-0.4.1 spec/magellan/cli/resources/project_spec.rb
magellan-cli-0.4.0 spec/magellan/cli/resources/project_spec.rb
magellan-cli-0.3.4 spec/magellan/cli/resources/project_spec.rb
magellan-cli-0.3.3 spec/magellan/cli/resources/project_spec.rb
magellan-cli-0.3.2 spec/magellan/cli/resources/project_spec.rb
magellan-cli-0.3.1 spec/magellan/cli/resources/project_spec.rb
magellan-cli-0.3.0 spec/magellan/cli/resources/project_spec.rb
magellan-cli-0.2.19 spec/magellan/cli/resources/project_spec.rb
magellan-cli-0.2.18 spec/magellan/cli/resources/project_spec.rb
magellan-cli-0.2.17 spec/magellan/cli/resources/project_spec.rb
magellan-cli-0.2.16 spec/magellan/cli/resources/project_spec.rb
magellan-cli-0.2.15 spec/magellan/cli/resources/project_spec.rb
magellan-cli-0.2.14 spec/magellan/cli/resources/project_spec.rb
magellan-cli-0.2.13 spec/magellan/cli/resources/project_spec.rb
magellan-cli-0.2.12 spec/magellan/cli/resources/project_spec.rb
magellan-cli-0.2.11 spec/magellan/cli/resources/project_spec.rb