rspec_rails_4
rspec_rails_4 copied to clipboard
Ch.5 - JSON API should be tested in request specs?
You are testing JSON API in controller specs, but some people say it should be tested in request specs:
http://matthewlehner.net/rails-api-testing-guidelines/
Use RSpec Request Specs
Since we’ve established that we’ll be using Rack::Test to drive the tests, RSpec request specs make the most sense. There’s no need to get fancy and add extra weight to your testing tools for this.
Request specs provide a thin wrapper around Rails’ integration tests, and are designed to drive behavior through the full stack, including routing (provided by Rails) and without stubbing (that’s up to you).
I think this idea is reasonable, so it might be worth moving it to request specs.
That's the plan for the Rails 4/RSpec 3 version.
Okay, it's a good news!