Is there a difference between a feature spec and system spec? Both seem to use Capybara to test the full application yet they have different docs on RSpec.
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.
Summary. System specs are a wrapper around Rails' system tests. The benefits of using system specs instead of feature specs is that you don't have to explicitly include the Capybara gem, nor do you have to use Database Cleaner.
Feature specs They're written from the perspective of a user clicking around the application and filling in forms. We use RSpec and Capybara, which allow you to write tests that can interact with the web page in this manner.
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.
System specs are built on top of Rails own system tests while feature specs were implemented by RSpec before Rails had system tests. If you're starting a new project write system specs, but if you have existing feature specs there's really nothing to be gained currently by changing them to system specs since functionality wise they're basically identical.
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