Sha256: 37c968f70b357edfcefc38e443f799cb294f04e3b03d54df0f7a65626d509b31

Contents?: true

Size: 899 Bytes

Versions: 20

Compression:

Stored size: 899 Bytes

Contents

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

describe Magellan::Cli::Resources::Organization do

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

  let(:cli){ double(:cli, :check_login_auth! => nil) }
  before{ allow(cmd).to receive(:cli).and_return(cli) }

  describe :list do
    before do
      expect(cmd).to receive(:get_json).and_return([{id: 1, name: "org1", creator_id: 1}])
      expect($stdout).to receive(:puts)
    end
    it do
      cmd.list
    end
  end

  describe :create do
    let(:organization_list_response) { [ { "id" => 1, "name" => "new1" } ] }
    before do
      expect(cmd).to receive(:post_json).with("/admin/magellan~auth~organization/new.json", {"magellan_auth_organization" => { "name" => "new1" }})
      allow(cmd).to receive(:get_json).with(any_args).and_return(organization_list_response)
    end
    it do
      cmd.create("new1")
    end
  end

end

Version data entries

20 entries across 20 versions & 1 rubygems

Version Path
magellan-cli-0.5.9 spec/magellan/cli/resources/organization_spec.rb
magellan-cli-0.5.8 spec/magellan/cli/resources/organization_spec.rb
magellan-cli-0.5.7 spec/magellan/cli/resources/organization_spec.rb
magellan-cli-0.5.6 spec/magellan/cli/resources/organization_spec.rb
magellan-cli-0.5.5 spec/magellan/cli/resources/organization_spec.rb
magellan-cli-0.5.4 spec/magellan/cli/resources/organization_spec.rb
magellan-cli-0.5.3 spec/magellan/cli/resources/organization_spec.rb
magellan-cli-0.5.2 spec/magellan/cli/resources/organization_spec.rb
magellan-cli-0.5.1 spec/magellan/cli/resources/organization_spec.rb
magellan-cli-0.5.0 spec/magellan/cli/resources/organization_spec.rb
magellan-cli-0.4.4 spec/magellan/cli/resources/organization_spec.rb
magellan-cli-0.4.3 spec/magellan/cli/resources/organization_spec.rb
magellan-cli-0.4.2 spec/magellan/cli/resources/organization_spec.rb
magellan-cli-0.4.1 spec/magellan/cli/resources/organization_spec.rb
magellan-cli-0.4.0 spec/magellan/cli/resources/organization_spec.rb
magellan-cli-0.3.4 spec/magellan/cli/resources/organization_spec.rb
magellan-cli-0.3.3 spec/magellan/cli/resources/organization_spec.rb
magellan-cli-0.3.2 spec/magellan/cli/resources/organization_spec.rb
magellan-cli-0.3.1 spec/magellan/cli/resources/organization_spec.rb
magellan-cli-0.3.0 spec/magellan/cli/resources/organization_spec.rb