gpt4 book ai didi

ruby-on-rails - cucumber rails -

转载 作者:行者123 更新时间:2023-12-03 01:21:26 25 4
gpt4 key购买 nike

我创建了一个新的 Rails 3.2 应用程序,我的 cucumber 规范返回此错误 -

undefined method `path_to' for #<Cucumber::Rails::World:

运行时:

When /^(?:|I )go to (.+)$/ do |page_name|
visit path_to(page_name)
end

我的 bundler 看起来像这样:

  • capybara (1.1.2)
  • cucumber (1.1.4)
  • cucumber rails (1.2.1)
  • database_cleaner (0.7.0)
  • factory_girl (2.2.0)
  • factory_girl_rails (1.3.0)
  • 小 cucumber (2.7.6)
  • 守卫(0.8.8)
  • 守卫 cucumber (0.7.5)
  • guard-rspec (0.5.11)
  • rails (3.2.1)
  • rspec (2.8.0)
  • rspec-core (2.8.0)
  • rspec 期望 (2.8.0)
  • rspec-mocks (2.8.0)
  • rspec-rails (2.8.1)
  • selenium-webdriver (2.18.0)
  • xpath (0.1.4)

知道为什么吗?我以为是 capybara ,但它是最新的。

最佳答案

在feature/support/paths.rb中

module NavigationHelpers
def path_to(page_name)
case page_name
when /home page/
root_path
else
begin
page_name =~ /the (.*) page/
path_components = $1.split(/\s+/)
self.send(path_components.push('path').join('_').to_sym)
rescue Object => e
raise "can't find mapping from \"#{page_name}\" to a path. \n" + "Now, go and add a mapping in #{__FILE__}"
end
end
end
end

将上面的代码写入path.rb文件

关于ruby-on-rails - cucumber rails -,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/9128491/

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