# step_definitions/general_steps.rb Then /^he should see an error message "(.+)"$/ do |text| within(error_message) do page.should have_content(text) end end # support/general_helpers.rb module GeneralHelpers def error_message page.first('div.alert.alert-error') end end World(GeneralHelpers)