Monday, November 14, 2011

WARNING: i18n methods within step definitions are deprecated

When running some older step definition files with a newer version of Cukes, I kept getting the message "WARNING: i18n methods within step definitions are deprecated..." even though I couldn't see any il8n methods in my cucumber files.

After a bit of digging, I found that you need to update your steps files so that you don't use any And/Then/When/Given methods inside your steps, and instead use the method step - but this only applies inside your step definitions. For example this:

When /^I sign in as "(.*)\/(.*)"$/ do |email, password|
  Given %{I am not logged in}
  When %{I go to the sign in page}
  And %{I fill in "Email" with "#{email}"}
  And %{I fill in "Password" with "#{password}"}
  And %{I press "Sign in"}
end

Changes to:

When /^I sign in as "(.*)\/(.*)"$/ do |email, password|
  step %{I am not logged in}
  step %{I go to the sign in page}
  step %{I fill in "Email" with "#{email}"}
  step %{I fill in "Password" with "#{password}"}
  step %{I press "Sign in"}
end

No comments:

Post a Comment