gpt4 book ai didi

ruby-on-rails - "eval"已弃用。请改用 "evaluate"

转载 作者:IT王子 更新时间:2023-10-29 00:26:42 24 4
gpt4 key购买 nike

自从最近开始编写 cucumber 功能时,我收到了警告

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

一切正常,但这个警告让我不安。我正在使用 Rails 3.1.0ruby 1.9.3p392(2013-02-22 修订版 39386)[x86_64-linux]。我的文件是:

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 |
| admin@test.com | admin_password | admin |
| visitor@visitor.com | visitor_password | registered |
And I am on the "home page"
And I follow "Login"
And I fill in "Email" with "admin@test.com"
And I fill in "Password" with "admin_password"
And I press "Sign in"
Then I should see "admin"
}
end

结果我有:

 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

最佳答案

遇到了完全相同的问题。它没有破坏任何东西,它只是丑陋。

这似乎是代码不匹配。 Gherkin 弃用了 eval,取而代之的是 evaluate,而 Cucumber 正在调用旧方法。已经准备好拉取请求和a closed issue for this on github

在 Cucumber 更新(可能很快)之前,最快和最简单的解决方案是将这一行添加到您的 Gemfile 中:

gem 'gherkin', '<= 2.11.6'

这将强制 gherkin 回到 eval 被弃用之前的时间。

编辑:

看来 cucumber gem 已经更新,不再产生弃用警告。

关于ruby-on-rails - "eval"已弃用。请改用 "evaluate",我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/15855193/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com