Helpers para Steak
Cucumber features are great because they are easy to read even if you’re a programmer.
To reach almost the same result with Steak we can use helpers. Take a look on some tips and how your acceptance specs could be improved:
We are using the “let” method from Rspec to avoid Mocks and instance variables inside the scenarios but it doesn’t matter, lets take a look on helpers. In that simple spec we have three good helpers that can be used around all system. They are:
- log_in_with
- should_have_notice
- should_be_on
And the implementation could be (inside spec/acceptance/suppport/helpers.rb):
The helpers are self explanatory. If you will copy and paste it to you project don’t forget to adjust should_have_notice and should_have_error to match your layout ( have_css(“.message.#{name}”, :text => message) )
Other helpers that could be useful