spec/integration/app_spec.rb in pact_broker-1.4.0 vs spec/integration/app_spec.rb in pact_broker-1.5.0
- old
+ new
@@ -10,16 +10,18 @@
ProviderStateBuilder.new.create_pact_with_hierarchy 'Some Consumer', '1.0', 'Some Provider'
end
let(:hal_browser_enabled) { true }
let(:group_url) { '/groups/Some%20Consumer' }
+ let(:enable_diagnostic_endpoints) { false }
let(:app) do
app = PactBroker::App.new do | config |
config.auto_migrate_db = false
config.use_hal_browser = hal_browser_enabled
config.database_connection = ::DB::PACT_BROKER_DB
+ config.enable_diagnostic_endpoints = enable_diagnostic_endpoints
end
end
context "when Accept includes text/html" do
let(:env) { {'HTTP_ACCEPT' => 'text/html'} }
@@ -160,8 +162,24 @@
expect(subject.status).to eq 200
expect(subject.headers['Content-Type']).to include 'text/css'
end
end
+ end
+
+ context "when the diagnostic endpoints are enabled" do
+ let(:enable_diagnostic_endpoints) { true }
+
+ it "returns a 200 to /diagnostic/status/heartbeat" do
+ get "/diagnostic/status/heartbeat"
+ expect(last_response.status).to eq 200
+ end
+ end
+
+ context "when the diagnostic endpoints are not enabled" do
+ it "returns a 404 to /diagnostic/status/heartbeat" do
+ get "/diagnostic/status/heartbeat"
+ expect(last_response.status).to eq 404
+ end
end
end
end