rails / jbuilder

Jbuilder: generate JSON objects with a Builder-style DSL
MIT License
4.34k stars 440 forks source link

Document Testing configuration for RSpec users #539

Closed stefannibrasil closed 7 months ago

stefannibrasil commented 2 years ago

JBuilder documentation does not guide users to any extra configuration to test the response body of a template.

Searching for "Rspec" in the project, we see that there are lots of closed issues related to this issue.

Although this extra configuration is not related to JBuilder, I believe this is an important thing to have in the documentation. Users clearly need that extra guidance.

Including a note about it in the documentation would save users hours of trying to debug JBuilder, and maintainers hours that could be used on another features.

Opening this PR for a discussion. I am not sure this is the best place to put this note. Any suggestions?

stefannibrasil commented 2 years ago

It looks like there are some flakey specs:


Failure:
JbuilderTemplateTest#test_supports_the_cached:_true_option [/home/runner/work/jbuilder/jbuilder/test/jbuilder_template_test.rb:313]:
Expected: "Post #5"
  Actual: nil

rails test home/runner/work/jbuilder/jbuilder/test/jbuilder_template_test.rb:309

The CI is failing even when no code changes were made. I opened an issue #540