mirror of
https://github.com/discourse/discourse.git
synced 2024-11-26 02:40:53 -06:00
2861b9337d
* DEV: Fix flaky admin badges.json api docs spec This commit is to fix this incredibly vague error message: ``` Failure/Error: expect(valid).to eq(true) expected: true got: false ``` From this test: > Assertion: badges /admin/badges.json get success response behaves like > a JSON endpoint response body matches the documented response schema I was finally able to repro locally using parallel tests: ``` RAILS_ENV=test bundle exec ./bin/turbo_rspec ``` I *think* the parallel tests might be swallowing the `puts` output, but when I also specified the individual spec file ``` RAILS_ENV=test bundle exec ./bin/turbo_rspec spec/requests/api/badges_spec.rb ``` It revealed the issue: ``` VALIDATION DETAILS: {"missing_keys"=>["i18n_name"]} ``` ``` ruby ... def include_i18n_name? object.system? end ``` Looks like if the "system" user isn't being used the `i18n_name` won't be returned in the json response so we shouldn't mark it as a required attribute. * Switch to using fab! When using `let(:badge)` to fabricate a test badge it wouldn't be returned from the controller, but switching to using `fab!` allows it to be returned in the json data giving us a non-system badge to test against. |
||
---|---|---|
.. | ||
fabricators | ||
fixtures | ||
helpers | ||
import_export | ||
initializers | ||
integration | ||
integrity | ||
jobs | ||
lib | ||
mailers | ||
models | ||
multisite | ||
requests | ||
script/import_scripts | ||
serializers | ||
services | ||
support | ||
tasks | ||
views | ||
rails_helper.rb | ||
regenerate_swagger_docs | ||
swagger_helper.rb |