Skip to content
This repository has been archived by the owner on Aug 3, 2021. It is now read-only.

Ch.5 - JSON API should be tested in request specs? #102

Open
JunichiIto opened this issue Mar 27, 2014 · 2 comments
Open

Ch.5 - JSON API should be tested in request specs? #102

JunichiIto opened this issue Mar 27, 2014 · 2 comments

Comments

@JunichiIto
Copy link

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.

@ruralocity
Copy link
Member

That's the plan for the Rails 4/RSpec 3 version.

@JunichiIto
Copy link
Author

Okay, it's a good news!

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants