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