module

Lucky::RequestExpectations

Expectations for writing specs for HTTP requests and responses

Instance methods

send_json(status, expected : NamedTuple)
Source
send_json(status, **expected)

Test that the HTTP response has the expected status and JSON body

user = UserFactory.create

response = AppClient.new.exec(Users::Show.with(user.id))

response.should send_json(200, {status: "success"})
response.should send_json(200, name: user.name, age: user.age)
Source