Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Difference between feature spec and system spec

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.

like image 351
bgcode Avatar asked Apr 18 '18 22:04

bgcode


People also ask

What is feature spec?

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.

What are system specs Rails?

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.

What is a feature spec in RSpec and where do we use them in our application?

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.

What is a view spec?

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.


1 Answers

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.

like image 157
Thomas Walpole Avatar answered Oct 15 '22 21:10

Thomas Walpole