9
votes

I'm trying to understand the need for Steak. I get that its like Cucumber, except that you can use pure ruby instead of mapping your english language specs to ruby like in Cucumber, but it says that it mainly adds a wrapper around the RSpec DSL, and lets you use that

taken from: http://jeffkreeftmeijer.com/2010/steak-because-cucumber-is-for-vegetarians/

module Spec::Example::ExampleGroupMethods
  alias scenario example
  alias background before
end

module Spec::DSL::Main
  alias feature describe
end

Is that all? I seems from the examples that you still do the heavy lifting with Capybara and RSpec matchers.. So why not just use Capybara with RSpec instead of adding a complication like Steak on top of it? Are the English language acceptance spec descriptions the only value proposition, or am I missing something else?

Thanks

2

2 Answers

19
votes

Technically speaking Steak just adds three things:

  • Some syntactic sugar in the form of aliases (scenario, background, feature) which remind developers that they are writing an acceptance spec, not a regular one.

  • A couple of convenient generators for Rails that help developers to quickly set up a new project or a new spec

  • Rake support to run your acceptance specs in isolation, among other things.

You can think of Steak as a minimal extension of RSpec. But even more important than the technical things are the non-technical things associated to Steak:

  • It provides a name for doing acceptance BDD with RSpec. Saying that you use Steak is shorter than explaining what type of testing you practice.

  • It provides a community (mailing list, wiki, twitter account…) of developers doing this particular form of testing, sharing experiences, problems and best practices.

I don't think Steak adds any complication for anyone familiar with RSpec, but if you think so and you don't really care about all previous things, then you don't need to use RSpec at all, you will probably be happier using just Test::Unit + Capybara.

2
votes

Your hunch is possibly correct and Steak further confuses the rSpec testing namespace.

The 'acceptance' directory, for example, implies you are doing acceptance testing with steak, which is rarely the case and generally the reason you use Steak over cucumber.

For a clearer definition see: http://en.wikipedia.org/wiki/Acceptance_testing

Since you are ruling out cucumber and using rSpec, which is typically not known as a DSL that stakeholders / non technical analysts read, a closer fit might be integration testing:

http://en.wikipedia.org/wiki/Integration_testing

We are phasing out steak in favor of rSpecs native 'request' and 'feature' specs, which are essentially the same thing out of the box. It might be worth checking those out.

https://www.relishapp.com/rspec/rspec-rails/docs/request-specs/request-spec https://www.relishapp.com/rspec/rspec-rails/docs/feature-specs/feature-spec