You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I'm using airborne to write test cases around APIs i've created and it works great except a scenario when i'm trying to pass an empty json for a POST endpoint which has some of parameters as required. I'm using grape to create REST APIs.
Example:
describe "Empty POST on Resource" do
let(:req_params) {
{
}
}
it "fails to create a new lead" do
post "/v1/resource/", req_params
expect(response).to have_http_status(422)
end
end
I'm receiving following response, if required fields are not present in test case.
undefined method `[]' for nil:NilClass
# /path/to/directory/api/exceptions.rb:43:in `notify'
#/path/to/directory/api/base.rb:104:in `block (2 levels) in <module:Base>'
# ./spec/api/pulpit/api_v1_spec.rb:62:in `block (4 levels) in <top (required)>'
However, If i make mandatory params in api as optional, things work fine. Not sure why.
The text was updated successfully, but these errors were encountered:
I'm using airborne to write test cases around APIs i've created and it works great except a scenario when i'm trying to pass an empty json for a POST endpoint which has some of parameters as required. I'm using grape to create REST APIs.
Example:
I'm receiving following response, if required fields are not present in test case.
However, If i make mandatory params in api as optional, things work fine. Not sure why.
The text was updated successfully, but these errors were encountered: