Skip to content

Commit 35250c6

Browse files
committed
various test fixes, mostly to do with spacing
1 parent 9a3c067 commit 35250c6

File tree

8 files changed

+23
-23
lines changed

8 files changed

+23
-23
lines changed

spec/request/app_features_spec.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -165,7 +165,7 @@
165165
h = Hash.new({ code: 403, errors: CF_NOT_AUTHORIZED }.freeze)
166166

167167
%w[no_role org_auditor org_billing_manager].each { |r| h[r] = { code: 404 } }
168-
%w[admin space_devµeloper].each { |r| h[r] = { code: 200, response_object: feature_response_object } }
168+
%w[admin space_developer].each { |r| h[r] = { code: 200, response_object: feature_response_object } }
169169
h
170170
end
171171

spec/unit/controllers/v3/sidecars_controller_spec.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@
3030
it 'fails to map a route' do
3131
expect do
3232
get :index_by_process
33-
end.to raise_error(ActionController::UrlGenerationError, /No route matches \{:action=>"index_by_process", :controller=>"sidecars"\}/)
33+
end.to raise_error(ActionController::UrlGenerationError, /No route matches \{action: "index_by_process", controller: "sidecars"\}/)
3434
end
3535
end
3636

spec/unit/lib/cloud_controller/config_spec.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -155,7 +155,7 @@ module VCAP::CloudController
155155
it "can't handle an unescaped @" do
156156
expect do
157157
DatabasePartsParser.database_parts_from_connection(uri)
158-
end.to raise_error(URI::InvalidURIError, "bad URI(is not URI?): \"#{uri}\"")
158+
end.to raise_error(URI::InvalidURIError, "bad URI (is not URI?): \"#{uri}\"")
159159
end
160160
end
161161

spec/unit/lib/cloud_controller/database_parts_parser_spec.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@
4040
uri = 'mysql://user:p4s [email protected]:1234/databasename'
4141
expect do
4242
VCAP::CloudController::DatabasePartsParser.database_parts_from_connection(uri)
43-
end.to raise_error(URI::InvalidURIError, "bad URI(is not URI?): \"#{uri}\"")
43+
end.to raise_error(URI::InvalidURIError, "bad URI (is not URI?): \"#{uri}\"")
4444
end
4545
end
4646
end

spec/unit/lib/services/service_brokers/v2/http_client_spec.rb

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -83,11 +83,11 @@ module VCAP::Services::ServiceBrokers::V2
8383
it 'logs the default headers' do
8484
make_request
8585
expect(fake_logger).to have_received(:debug).with(match(%r{Accept" => "application/json}))
86-
expect(fake_logger).to have_received(:debug).with(match(/X-VCAP-Request-ID"=>"[[:alnum:]-]+/))
87-
expect(fake_logger).to have_received(:debug).with(match(/X-Broker-API-Request-Identity"=>"[[:alnum:]-]+/))
88-
expect(fake_logger).to have_received(:debug).with(match(/X-Broker-Api-Version"=>"2\.15/))
86+
expect(fake_logger).to have_received(:debug).with(match(/X-VCAP-Request-ID" => "[[:alnum:]-]+/))
87+
expect(fake_logger).to have_received(:debug).with(match(/X-Broker-API-Request-Identity" => "[[:alnum:]-]+/))
88+
expect(fake_logger).to have_received(:debug).with(match(/X-Broker-Api-Version" => "2\.15/))
8989
api_info_path = TestConfig.config[:temporary_enable_v2] ? '/v2/info' : '/'
90-
expect(fake_logger).to have_received(:debug).with(match(/X-Api-Info-Location"=>"api2\.vcap\.me#{api_info_path}/))
90+
expect(fake_logger).to have_received(:debug).with(match(/X-Api-Info-Location" => "api2\.vcap\.me#{api_info_path}/))
9191
end
9292

9393
context 'when an https URL is used' do
@@ -357,12 +357,12 @@ def expect_timeout_to_be(timeout)
357357

358358
it 'redacts credentials from response body' do
359359
make_request
360-
expect(fake_logger).to have_received(:debug).with(/"credentials"=>"\[REDACTED\]"/)
360+
expect(fake_logger).to have_received(:debug).with(/"credentials" => "\[REDACTED\]"/)
361361
end
362362

363363
it 'does not redact other keys' do
364364
make_request
365-
expect(fake_logger).to have_received(:debug).with(%r{"syslog_drain_url"=>"example.com/1234"})
365+
expect(fake_logger).to have_received(:debug).with(%r{"syslog_drain_url" => "example.com/1234"})
366366
end
367367

368368
context 'non-json responses' do
@@ -507,7 +507,7 @@ def expect_timeout_to_be(timeout)
507507

508508
it 'logs the Content-Type Header' do
509509
make_request
510-
expect(fake_logger).to have_received(:debug).with(match(%r{"Content-Type"=>"application/json"}))
510+
expect(fake_logger).to have_received(:debug).with(match(%r{"Content-Type" => "application/json"}))
511511
end
512512

513513
it 'has a content body' do
@@ -584,7 +584,7 @@ def expect_timeout_to_be(timeout)
584584

585585
it 'logs the Content-Type Header' do
586586
make_request
587-
expect(fake_logger).to have_received(:debug).with(match(%r{"Content-Type"=>"application/json"}))
587+
expect(fake_logger).to have_received(:debug).with(match(%r{"Content-Type" => "application/json"}))
588588
end
589589

590590
it 'has a content body' do

spec/unit/presenters/error_presenter_spec.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ def response_code
3939
let(:error) { StandardError.new }
4040

4141
it 'logs the response code and unsanitized error hash' do
42-
expect(presenter.log_message).to eq('Request failed: 500: {"fake"=>"insane"}')
42+
expect(presenter.log_message).to eq('Request failed: 500: {"fake" => "insane"}')
4343
end
4444
end
4545

spec/unit/support/matchers/be_a_response_like_spec.rb

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -70,13 +70,13 @@
7070
it 'fails when hash values within arrays do not match' do
7171
expect do
7272
expect({ 'a' => [{ 'b' => 1 }] }).to be_a_response_like({ 'a' => [{ 'b' => 2 }] })
73-
end.to raise_expectation_not_met_with_key_change(expected: '- a[0]: {"b"=>2}', actual: '+ a[0]: {"b"=>1}')
73+
end.to raise_expectation_not_met_with_key_change(expected: '- a[0]: {"b" => 2}', actual: '+ a[0]: {"b" => 1}')
7474
end
7575

7676
it 'fails when hash keys within arrays do not match' do
7777
expect do
7878
expect({ 'a' => [{ 'b' => 1 }] }).to be_a_response_like({ 'a' => [{ 'c' => 1 }] })
79-
end.to raise_expectation_not_met_with_key_change(expected: '- a[0]: {"c"=>1}', actual: '+ a[0]: {"b"=>1}')
79+
end.to raise_expectation_not_met_with_key_change(expected: '- a[0]: {"c" => 1}', actual: '+ a[0]: {"b" => 1}')
8080
end
8181

8282
it 'fails when actual is empty but expected is an empty array' do
@@ -88,14 +88,14 @@
8888
it 'fails when actual as a non-empty but expected is an empty array' do
8989
expect do
9090
expect({ 'a' => [{ 'b' => 1 }] }).to be_a_response_like({ 'a' => [] })
91-
end.to raise_expectation_not_met_with_summary(/\+ a\[0\]: \{"b"=>1\}/)
91+
end.to raise_expectation_not_met_with_summary(/\+ a\[0\]: \{"b" => 1\}/)
9292
end
9393

9494
it 'fails on deeply nested value mismatches' do
9595
expect do
9696
expect({ 'a' => [{ 'a' => { 'a' => [{ 'a' => 1 }, { 'b' => 2 }] } }] }).to be_a_response_like({ 'a' => [{ 'a' => { 'a' => [{ 'a' => 1 }, { 'b' => 1 }] } }] })
97-
end.to raise_expectation_not_met_with_key_change(expected: '- a[0].a.a[1]: {"b"=>1}',
98-
actual: '+ a[0].a.a[1]: {"b"=>2}')
97+
end.to raise_expectation_not_met_with_key_change(expected: '- a[0].a.a[1]: {"b" => 1}',
98+
actual: '+ a[0].a.a[1]: {"b" => 2}')
9999
end
100100

101101
def raise_expectation_not_met_with_summary(ptn)

spec/unit/support/matchers/match_json_response_spec.rb

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -70,13 +70,13 @@
7070
it 'fails when hash values within arrays do not match' do
7171
expect do
7272
expect({ 'a' => [{ 'b' => 1 }] }).to match_json_response({ a: [{ b: 2 }] })
73-
end.to raise_expectation_not_met_with_key_change(expected: '- a[0]: {:b=>2}', actual: '+ a[0]: {:b=>1}')
73+
end.to raise_expectation_not_met_with_key_change(expected: '- a[0]: {b: 2}', actual: '+ a[0]: {b: 1}')
7474
end
7575

7676
it 'fails when hash keys within arrays do not match' do
7777
expect do
7878
expect({ 'a' => [{ 'b' => 1 }] }).to match_json_response({ a: [{ c: 1 }] })
79-
end.to raise_expectation_not_met_with_key_change(expected: '- a[0]: {:c=>1}', actual: '+ a[0]: {:b=>1}')
79+
end.to raise_expectation_not_met_with_key_change(expected: '- a[0]: {c: 1}', actual: '+ a[0]: {b: 1}')
8080
end
8181

8282
it 'fails when actual is empty but expected is an empty array' do
@@ -88,14 +88,14 @@
8888
it 'fails when actual as a non-empty but expected is an empty array' do
8989
expect do
9090
expect({ 'a' => [{ 'b' => 1 }] }).to match_json_response({ a: [] })
91-
end.to raise_expectation_not_met_with_summary(/\+ a\[0\]: \{:b=>1\}/)
91+
end.to raise_expectation_not_met_with_summary(/\+ a\[0\]: \{b: 1\}/)
9292
end
9393

9494
it 'fails on deeply nested value mismatches' do
9595
expect do
9696
expect({ 'a' => [{ 'a' => { 'a' => [{ 'a' => 1 }, { 'b' => 2 }] } }] }).to match_json_response({ a: [{ a: { a: [{ a: 1 }, { b: 1 }] } }] })
97-
end.to raise_expectation_not_met_with_key_change(expected: '- a[0].a.a[1]: {:b=>1}',
98-
actual: '+ a[0].a.a[1]: {:b=>2}')
97+
end.to raise_expectation_not_met_with_key_change(expected: '- a[0].a.a[1]: {b: 1}',
98+
actual: '+ a[0].a.a[1]: {b: 2}')
9999
end
100100

101101
it 'outputs submatcher error message when it errors' do

0 commit comments

Comments
 (0)