I am reading the new version of Michael Hartle's Rails Tutorial, and since I really love BDD with Cucumber, I was worried that the author points here: http://ruby.railstutorial.org/chapters/sign-in-sign-out? version = 3.2 # sec: rspec_custom_matchers
In a few words, the main problem with Cucumber is that it is not possible to execute implementation-dependent DRYs, such as:
Then /^he should see an error message$/ do page.should have_selector('div.alert.alert-error', text: 'Invalid') end
writing custom RSpec matches as follows:
RSpec::Matchers.define :have_error_message do |message| match do |page| page.should have_selector('div.alert.alert-error', text: message) end end
Since such a custom connector must be placed in spec / support / utilities.rb and can be called from RSpec integration tests, but not from the Cucumber step definition.
Are you sure you are thinking about this?
Thanks.
Darme source share