RSpec test health endpoint without controller or action

Viewed 174

I've got something like this code in my routes.rb

get '/health', to: proc { [200, {}, ['']] }

and I need to write RSpec test.

I've got only this line without any defined controller or action, is it possible to create such specs?

1 Answers

what about simple request spec? Maybe something like this:

require "rails_helper"

RSpec.describe "Health check", type: :request do
  it "does return 200 status" do
    get "/health"
    expect(response.status).to eq 200
  end
end
Related