Open
Description
Great gem, thank you for sharing!
Here's a bug and a suggested feature to fix it.
The below is pseudo-code -- apologies if it doesn't work.
Steps to reproduce:
In your rspec tests, write something like:
context "when params have an issue, returns bad request" do
it "notifies that params are missing" do
post "/mypath"
expect(response.code).to eq("400")
expect(response.body).to eq("missing required parameter: param_a")
end
it "notifies that params do not match schema " do
post "/mypath", with: {param_a: 123}
expect(response.code).to eq("400")
expect(response.body).to eq("param_a must be a string")
end
end
Actual result:
It seems that only the response body received for the first or last test that is run is placed into examples. Because the test order is randomized, the output is therefore not deterministic. In other words, sometimes you'll see:
...
example:
"param_a must be a string"
and sometimes you'll see
...
example:
"missing required parameter: param_a"
Expected result:
The output should be deterministic (ordered the same way every time, i.e. alphabetically) and should include all of the examples from tests.
i.e.
...
description: when params have an issue, returns bad request
examples:
notifies_that_params_are_missing: -
missing required parameter, param_a
notifies_that_params_do_not_match_schema: -
param_a must be a string
If you're open to it, I can work on a PR!
Thanks again!