spec/kontena/cli/master/users/invite_command_spec.rb in kontena-cli-0.15.5 vs spec/kontena/cli/master/users/invite_command_spec.rb in kontena-cli-0.16.0.pre1
- old
+ new
@@ -2,33 +2,19 @@
require 'kontena/cli/master/users_command'
require 'kontena/cli/master/users/invite_command'
describe Kontena::Cli::Master::Users::InviteCommand do
+ include ClientHelpers
+
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
+ expect(client).to receive(:post).with("/oauth2/authorize", {email: 'john@example.org', response_type: "invite"}).once
+ expect(client).to receive(:post).with("/oauth2/authorize", {email: 'jane@example.org', response_type: "invite"}).once
subject.run(['john@example.org', 'jane@example.org'])
end
end
end