Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/unit-testing/4.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Ruby on rails Can';不要用Cucumber来解释这个错误;Can';无法从“查找映射”;_Ruby On Rails_Cucumber - Fatal编程技术网

Ruby on rails Can';不要用Cucumber来解释这个错误;Can';无法从“查找映射”;

Ruby on rails Can';不要用Cucumber来解释这个错误;Can';无法从“查找映射”;,ruby-on-rails,cucumber,Ruby On Rails,Cucumber,我正在尝试用Cucumber来习惯BDD,我已经写了一些特性,但我对这一特性特别感到困惑,下面是错误: Scenario: # features/viewing_posts.feature:6 Given there is a post with the title "Just another day at the beach" # features/step_defin

我正在尝试用Cucumber来习惯BDD,我已经写了一些特性,但我对这一特性特别感到困惑,下面是错误:

Scenario:                                                               # features/viewing_posts.feature:6
Given there is a post with the title "Just another day at the beach"  # features/step_definitions/post_steps.rb:1
And I am on the homepage                                              # features/step_definitions/web_steps.rb:44
When I follow "Just another day at the beach"                         # features/step_definitions/web_steps.rb:56
Then I should be on the post page for "Just another day at the beach" # features/step_definitions/web_steps.rb:230
  Can't find mapping from "the post page for "Just another day at the beach"" to a path.
  Now, go and add a mapping in /Users/jeff/rails_projects/jeffc/features/support/paths.rb (RuntimeError)
  ./features/support/paths.rb:29:in `rescue in path_to'
  ./features/support/paths.rb:23:in `path_to'
  ./features/step_definitions/web_steps.rb:233:in `/^(?:|I )should be on (.+)$/'
  features/viewing_posts.feature:10:in `Then I should be on the post page for "Just another day at the beach"'

Failing Scenarios:
cucumber features/viewing_posts.feature:6 # Scenario: 
我在错误中检查了我的web_steps.rb,我有应该匹配的步骤

Then /^(?:|I )should be on (.+)$/ do |page_name|
  current_path = URI.parse(current_url).path
  if current_path.respond_to? :should
    current_path.should == path_to(page_name)
  else
    assert_equal path_to(page_name), current_path
  end
end
一直到“那么我应该在帖子页面上…”

有人能告诉我这是怎么回事吗

谢谢


J

它希望在
paths.rb中找到路径映射

Now, go and add a mapping in /Users/jeff/rails_projects/jeffc/features/support/paths.rb (RuntimeError)

你可能需要移动它。您的其他测试是偶然遇到同样的问题,还是与您已有的测试结果一致?

天哪,我为噪音感到抱歉,谢谢。没错,不用担心。Cucumber试着告诉你你需要做的一切,但当我还是新手时,我也看不到它想告诉我的一半废话。在path.rb中我该怎么做?@Aravin没事,应该可以保持原样。你有什么问题吗?