diff --git a/spec/vmfloaty/auth_spec.rb b/spec/vmfloaty/auth_spec.rb index 5133e37..f110359 100644 --- a/spec/vmfloaty/auth_spec.rb +++ b/spec/vmfloaty/auth_spec.rb @@ -16,8 +16,8 @@ describe Pooler do it 'returns a token from vmpooler' do stub_request(:post, 'https://first.last:password@vmpooler.example.com/token') - .with(:headers => { 'Accept' => '*/*', 'Accept-Encoding' => 'gzip;q=1.0,deflate;q=0.6,identity;q=0.3', 'Content-Length' => '0', 'User-Agent' => 'Faraday v0.9.2' }) - .to_return(:status => 200, :body => @get_token_response, :headers => {}) + .with(:headers => { 'Accept' => '*/*', 'Accept-Encoding' => 'gzip;q=1.0,deflate;q=0.6,identity;q=0.3', 'Content-Length' => '0', 'User-Agent' => 'Faraday v0.9.2' }) + .to_return(:status => 200, :body => @get_token_response, :headers => {}) token = Auth.get_token(false, @vmpooler_url, 'first.last', 'password') expect(token).to eq @token @@ -25,8 +25,8 @@ describe Pooler do it 'raises a token error if something goes wrong' do stub_request(:post, 'https://first.last:password@vmpooler.example.com/token') - .with(:headers => { 'Accept' => '*/*', 'Accept-Encoding' => 'gzip;q=1.0,deflate;q=0.6,identity;q=0.3', 'Content-Length' => '0', 'User-Agent' => 'Faraday v0.9.2' }) - .to_return(:status => 500, :body => '{"ok":false}', :headers => {}) + .with(:headers => { 'Accept' => '*/*', 'Accept-Encoding' => 'gzip;q=1.0,deflate;q=0.6,identity;q=0.3', 'Content-Length' => '0', 'User-Agent' => 'Faraday v0.9.2' }) + .to_return(:status => 500, :body => '{"ok":false}', :headers => {}) expect { Auth.get_token(false, @vmpooler_url, 'first.last', 'password') }.to raise_error(TokenError) end diff --git a/spec/vmfloaty/nonstandard_pooler_spec.rb b/spec/vmfloaty/nonstandard_pooler_spec.rb index 4b60db9..82eba9c 100644 --- a/spec/vmfloaty/nonstandard_pooler_spec.rb +++ b/spec/vmfloaty/nonstandard_pooler_spec.rb @@ -175,12 +175,12 @@ BODY it 'raises an error if the user tries to modify an unsupported attribute' do stub_request(:put, 'https://nspooler.example.com/host/myfakehost') - .with(:body => { '{}' => true }, + .with(:body => { '{}' => true }, :headers => { 'Accept' => '*/*', 'Accept-Encoding' => 'gzip;q=1.0,deflate;q=0.6,identity;q=0.3', 'Content-Type' => 'application/x-www-form-urlencoded', 'User-Agent' => 'Faraday v0.9.2', 'X-Auth-Token' => 'token-value' }) - .to_return(:status => 200, :body => '', :headers => {}) + .to_return(:status => 200, :body => '', :headers => {}) details = { :lifetime => 12 } expect { NonstandardPooler.modify(false, @nspooler_url, 'myfakehost', 'token-value', details) } - .to raise_error(ModifyError) + .to raise_error(ModifyError) end it 'modifies the reason of a vm' do diff --git a/spec/vmfloaty/utils_spec.rb b/spec/vmfloaty/utils_spec.rb index 2caed14..4f3e4ac 100644 --- a/spec/vmfloaty/utils_spec.rb +++ b/spec/vmfloaty/utils_spec.rb @@ -174,8 +174,8 @@ describe Utils do service = Service.new(MockOptions.new, 'url' => url) allow(service).to receive(:query) - .with(nil, hostname) - .and_return(response_body) + .with(nil, hostname) + .and_return(response_body) Utils.pretty_print_hosts(nil, service, hostname) end @@ -200,8 +200,8 @@ describe Utils do service = Service.new(MockOptions.new, 'url' => url) allow(service).to receive(:query) - .with(nil, hostname) - .and_return(response_body) + .with(nil, hostname) + .and_return(response_body) Utils.pretty_print_hosts(nil, service, hostname) end @@ -221,8 +221,8 @@ describe Utils do service = Service.new(MockOptions.new, 'url' => url, 'type' => 'ns') allow(service).to receive(:query) - .with(nil, hostname) - .and_return(response_body) + .with(nil, hostname) + .and_return(response_body) Utils.pretty_print_hosts(nil, service, hostname) end @@ -242,8 +242,8 @@ describe Utils do service = Service.new(MockOptions.new, 'url' => url, 'type' => 'ns') allow(service).to receive(:query) - .with(nil, hostname) - .and_return(response_body) + .with(nil, hostname) + .and_return(response_body) Utils.pretty_print_hosts(nil, service, hostname) end