黄瓜导轨-

发布于 2025-01-01 16:00:21 字数 803 浏览 2 评论 0原文

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

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

运行时:

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

我的捆绑程序如下所示:

  • capybara (1.1.2)
  • cucumber (1.1.4)
  • cucumber-rails (1.2.1)
  • database_cleaner (0.7.1) 0)
  • factory_girl(2.2.0)
  • factory_girl_rails(1.3.0)
  • 小黄瓜(2.7.6)
  • 守卫(0.8.8)
  • 守卫黄瓜(0.7.5)
  • 守卫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)

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

I have created a new rails 3.2 app and my cucumber specs are returning this error -

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

When running:

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

My bundler looks like this:

  • 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)
  • gherkin (2.7.6)
  • guard (0.8.8)
  • guard-cucumber (0.7.5)
  • guard-rspec (0.5.11)
  • rails (3.2.1)
  • rspec (2.8.0)
  • rspec-core (2.8.0)
  • rspec-expectations (2.8.0)
  • rspec-mocks (2.8.0)
  • rspec-rails (2.8.1)
  • selenium-webdriver (2.18.0)
  • xpath (0.1.4)

Any idea why ? I thought it was capybara but it is uptodate.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

等往事风中吹 2025-01-08 16:00:21

在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

上面的代码写入paths.rb文件中

In 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

write above code into your paths.rb file

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文