代码之家  ›  专栏  ›  技术社区  ›  Amy

cucumber+spork=未定义的方法'visit'(nomethodorr)?

  •  2
  • Amy  · 技术社区  · 14 年前

    我要把头发扯出来。在spork兼容模式(-drb)下运行cucumber时 访问() 方法不起作用。

    只需尝试功能步骤:

    When I go to the home page
    

    调用Web步骤:

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

    在命令行上运行“cucumber”会产生以下错误:

    % cucumber
    Using the default profile...
    Disabling profiles...
    .F--
    
    (::) failed steps (::)
    
    undefined method `visit' for #<Object:0x82fcc588> (NoMethodError)
    ./features/step_definitions/web_steps.rb:24:in `/^(?:|I )go to (.+)$/'
    features/authenticated/home_page_visit.feature:10:in `When I go to the home page'
    
    Failing Scenarios:
    cucumber features/authenticated/home_page_visit.feature:7 # Scenario: Visit the home page
    

    有人知道为什么visit()不可用吗?


    我的环境:

    我使用的是rails 2.3.9,刚刚安装了cucumber rails(0.3.2)、cucumber(0.9.2)、capybara(0.3.9)和spork(0.8.4)。有趣的是,如果我不使用spork,那么这绝对可以:

    % cucumber
    Using the default profile...
    ...
    
    1 scenario (1 passed)
    3 steps (3 passed)
    0m0.114s
    

    另一个区间数据点:

    我做了一些调试并深入到cucumber gem本身(在cucumber-0.9.2/lib/cucumber/core-ext/instance-exec.rb中)中 () 扔掉什么 self.class.name公司 是为了 标准输出 ,当我运行spork时,它会弹出“object”,但当我运行spork时,它会打印“cucumber::rails::world”。

    1 回复  |  直到 14 年前
        1
  •  0
  •   Prakash Murthy    12 年前

    是我打开的 this issue 在github上,我可以确认它适用于cucumber 0.9.3及更高版本。

    推荐文章
    Rahul  ·  Rspec极慢
    12 年前