Skip to content

Commit

Permalink
Merge pull request #4 from alphagov/search-endpoint
Browse files Browse the repository at this point in the history
Add trivial initial search endpoint
  • Loading branch information
csutter authored Sep 5, 2023
2 parents bd4c03c + 95ee5dd commit f77a9dc
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 0 deletions.
5 changes: 5 additions & 0 deletions app/controllers/searches_controller.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
class SearchesController < ApplicationController
def show
render json: {}
end
end
2 changes: 2 additions & 0 deletions config/routes.rb
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
Rails.application.routes.draw do
resource :search, only: [:show]

# Healthchecks
get "/healthcheck/live", to: proc { [200, {}, %w[OK]] }
get "/healthcheck/ready", to: GovukHealthcheck.rack_response
Expand Down
10 changes: 10 additions & 0 deletions spec/requests/search_request_spec.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
RSpec.describe "Making a search request" do
describe "GET /search.json" do
it "returns HTTP 200 and an empty JSON object" do
get "/search.json"

expect(response).to have_http_status(:ok)
expect(JSON.parse(response.body)).to eq({})
end
end
end

0 comments on commit f77a9dc

Please sign in to comment.