spec/kontena/cli/common_spec.rb in kontena-cli-1.4.0.pre1 vs spec/kontena/cli/common_spec.rb in kontena-cli-1.4.0.pre2
- old
+ new
@@ -165,20 +165,21 @@
end
end
end
describe '#use_refresh_token' do
+ let(:token) { double }
let(:server) do
- spy
+ double(:server,
+ name: 'example',
+ url: 'http://www.example.org',
+ token: token,
+ ssl_cert_path: nil,
+ ssl_subject_cn: nil,
+ )
end
- let(:token) do
- token = double
- allow(server).to receive(:token).and_return(token)
- token
- end
-
let(:client) do
spy
end
it 'returns nil if token is nil' do
@@ -201,11 +202,10 @@
expect(token).to receive(:expired?).and_return true
expect(subject.use_refresh_token(server)).to be_nil
end
it 'creates refresh_token request to given server' do
- allow(server).to receive(:url).and_return('http://www.example.org')
- expect(Kontena::Client).to receive(:new).with('http://www.example.org', token).and_return(client)
+ expect(Kontena::Client).to receive(:new).with('http://www.example.org', token, ssl_cert_path: nil, ssl_subject_cn: nil).and_return(client)
expect(client).to receive(:refresh_token).once
subject.use_refresh_token(server)
end
end
end