Feature spec Feature specs are high-level tests meant to exercise slices of functionality. through an application. They should drive the application only via its external. interface, usually web pages.
Request specs are RSpec wrappers for Rails integration tests. They are designed to test the entire stack, including routing. You can specify single or multiple requests across multiple controllers or sessions.
A view spec just renders a view in isolation, with template variables provided by the test rather than by controllers. Like other types of rspec-rails spec, view specs are defined with the describe and it methods.
The conceptual difference is that you're usually testing a user story, and all interaction should be driven via the user interface. That's where Capybara comes in. A request spec is still testing the behavior of your application and doesn't have the expectation of readability that an acceptance test would have. So, feature is there for the improved syntax for acceptance tests.
Technical differences include request specs wrap Rails integration tests, whereas feature specs don't. This means with request specs you can use methods get, post, put, delete and assert against response. With feature specs you should drive all interaction through the browser and use methods like visit and assert against the page.
I'd recommend reading the feature_spec.feature in the rspec-rails source code on github. I hope this helps.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With