Sha256: 37761f8d5d89909d73e8b0ea66e1c3e40656372b480b417bd0a4bd6c4319104c

Contents?: true

Size: 1019 Bytes

Versions: 32

Compression:

Stored size: 1019 Bytes

Contents

require_relative "../../../../spec_helper"
require 'kontena/cli/master/users_command'
require 'kontena/cli/master/users/invite_command'

describe Kontena::Cli::Master::Users::InviteCommand do

  let(:subject) do
    described_class.new(File.basename($0))
  end

  let(:valid_settings) do
    {'current_server' => 'alias',
     'servers' => [
         {'name' => 'some_master', 'url' => 'some_master'},
         {'name' => 'alias', 'url' => 'someurl', 'token' => '123456'}
     ]
    }
  end

  let(:client) { spy(:client) }

  describe "#invite" do
    before(:each) do
      allow(subject).to receive(:client).and_return(client)
      allow(subject).to receive(:settings).and_return(valid_settings)
    end

    it 'makes invitation request for all given users' do
      expect(client).to receive(:post).with("users", {email: 'john@example.org'}).once
      expect(client).to receive(:post).with("users", {email: 'jane@example.org'}).once

      subject.run(['john@example.org', 'jane@example.org'])
    end
  end
end

Version data entries

32 entries across 32 versions & 1 rubygems

Version Path
kontena-cli-0.15.5 spec/kontena/cli/master/users/invite_command_spec.rb
kontena-cli-0.15.5.rc2 spec/kontena/cli/master/users/invite_command_spec.rb
kontena-cli-0.15.5.rc1 spec/kontena/cli/master/users/invite_command_spec.rb
kontena-cli-0.15.4 spec/kontena/cli/master/users/invite_command_spec.rb
kontena-cli-0.15.4.rc2 spec/kontena/cli/master/users/invite_command_spec.rb
kontena-cli-0.15.4.rc1 spec/kontena/cli/master/users/invite_command_spec.rb
kontena-cli-0.15.4.pre1 spec/kontena/cli/master/users/invite_command_spec.rb
kontena-cli-0.15.3 spec/kontena/cli/master/users/invite_command_spec.rb
kontena-cli-0.15.2 spec/kontena/cli/master/users/invite_command_spec.rb
kontena-cli-0.15.1 spec/kontena/cli/master/users/invite_command_spec.rb
kontena-cli-0.15.0 spec/kontena/cli/master/users/invite_command_spec.rb
kontena-cli-0.15.0.rc3 spec/kontena/cli/master/users/invite_command_spec.rb
kontena-cli-0.15.0.rc2 spec/kontena/cli/master/users/invite_command_spec.rb
kontena-cli-0.15.0.rc1 spec/kontena/cli/master/users/invite_command_spec.rb
kontena-cli-0.14.7 spec/kontena/cli/master/users/invite_command_spec.rb
kontena-cli-0.14.6 spec/kontena/cli/master/users/invite_command_spec.rb
kontena-cli-0.14.5 spec/kontena/cli/master/users/invite_command_spec.rb
kontena-cli-0.14.4 spec/kontena/cli/master/users/invite_command_spec.rb
kontena-cli-0.14.3 spec/kontena/cli/master/users/invite_command_spec.rb
kontena-cli-0.14.2 spec/kontena/cli/master/users/invite_command_spec.rb