Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

"eval" is deprecated. Please use "evaluate" instead

Writing cucumber features since recently I'm getting a warning

[DEPRECATION] "eval" is deprecated. Please use "evaluate" instead

Everything works fine, but this warning disturbs me. I'm using Rails 3.1.0 and ruby 1.9.3p392 (2013-02-22 revision 39386) [x86_64-linux]. My files are:

item.feature:

Background: logged in as an admin
Given I am logged in as an administrator

user_steps.rb

 Given /^I am logged in as an administrator$/ do
 steps %Q{
   Given the following users exist:
    | email               | password         | role       |
    | [email protected]      | admin_password   | admin      |
    | [email protected] | visitor_password | registered |
   And I am on the "home page"
   And I follow "Login"
   And I fill in "Email" with "[email protected]"
   And I fill in "Password" with "admin_password"
   And I press "Sign in"
   Then I should see "admin"
}
end

And as a result I have:

 Background: logged in as an admin            # features/item.feature:6
[DEPRECATION] "eval" is deprecated. Please use "evaluate" instead
[DEPRECATION] "eval" is deprecated. Please use "evaluate" instead
[DEPRECATION] "eval" is deprecated. Please use "evaluate" instead
[DEPRECATION] "eval" is deprecated. Please use "evaluate" instead
like image 419
Andrew Avatar asked Apr 06 '13 19:04

Andrew


1 Answers

Ran into the exact same issue. It's not breaking anything, it's just ugly.

It appears to be a mismatch of code. Gherkin has deprecated eval in favor of evaluate and Cucumber is calling the old method. There has all ready been a pull request and a closed issue for this on github

The quickest and easiest solution until Cucumber is updated, probably soon, is to just add this line to your Gemfile:

gem 'gherkin', '<= 2.11.6'

This will force gherkin back to a time before eval was deprecated.

Edit:

It appears that the cucumber gem has been updated and does not produce deprecation warnings anymore.

like image 118
Eric C Avatar answered Oct 05 '22 20:10

Eric C