Skip to content

Commit

Permalink
Document Testing configuration for RSpec users (#539)
Browse files Browse the repository at this point in the history
* Document testing configuration for RSpec users

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.

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

* Update README.md

* Link docs to rspec official docs instead of relish app

Co-authored-by: Cezary Kłos <cezary.klos@gmail.com>

---------

Co-authored-by: Cezary Kłos <cezary.klos@gmail.com>
  • Loading branch information
stefannibrasil and K4sku committed Apr 29, 2024
1 parent 6732db4 commit 0463bde
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -338,6 +338,10 @@ environment.rb for example):
Jbuilder.deep_format_keys true
```

## Testing JBuilder Response body with RSpec

To test the response body of your controller spec, enable `render_views` in your RSpec context. This [configuration](https://rspec.info/features/6-0/rspec-rails/controller-specs/render-views) renders the views in a controller test.

## Contributing to Jbuilder

Jbuilder is the work of many contributors. You're encouraged to submit pull requests, propose
Expand Down

0 comments on commit 0463bde

Please sign in to comment.