describe
, context
, feature
, scenario
: What is the difference(s) among the four and when do I use each one?
The context
is an alias for describe
, so they are functionally equivalent. You can use them interchangeably, the only difference is how your spec file reads. There is no difference in test output for example. The RSpec book says:
"We tend to use
describe()
for things andcontext()
for context".
Personally I like to use describe
, but I can see why people prefer context
.
feature
and scenario
are a part of Capybara, and not RSpec, and are meant to be used for acceptance tests. feature
is equivalent to describe
/ context
, and scenario
equivalent to it
/ example
.
If you're writing acceptance tests with Capybara, use the feature
/ scenario
syntax, if not use describe
/ it
syntax.