Sha256: 083ef2f99a840d8aff7e18faa93d67e9dfe973a976518f68c7b95104c0beb1ac

Contents?: true

Size: 787 Bytes

Versions: 6

Compression:

Stored size: 787 Bytes

Contents

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

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

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

  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

6 entries across 6 versions & 1 rubygems

Version Path
magellan-cli-0.2.18 spec/magellan/cli/resources/organization_spec.rb
magellan-cli-0.2.17 spec/magellan/cli/resources/organization_spec.rb
magellan-cli-0.2.16 spec/magellan/cli/resources/organization_spec.rb
magellan-cli-0.2.15 spec/magellan/cli/resources/organization_spec.rb
magellan-cli-0.2.14 spec/magellan/cli/resources/organization_spec.rb
magellan-cli-0.2.13 spec/magellan/cli/resources/organization_spec.rb