5
我有我的意见观点的链接回复到像这样的评论:错误电流通路与水豚和RSpec比较
<%= link_to t('.reply', :default => t("helpers.links.reply")), new_story_comment_path(comment.story, parent_id: comment)%>
测试的某些部分是这样的:
it "replies to a comment" do
comment = FactoryGirl.create :comment, story_id: story.id, user_id: user.id
visit story_path story
save_and_open_page
click_link "reply"
current_path.should eq(new_story_comment_path story.id, parent_id: comment.id)
...
end
我得到这个错误:
1) Comments replies to a comment
Failure/Error: current_path.should eq(new_story_comment_path story.id, parent_id: comment.id)
expected: "/stories/1/comments/new?parent_id=1"
got: "/stories/1/comments/new"
(compared using ==)
# ./spec/requests/comments_spec.rb:23:in `block (2 levels) in <top (required)>'
我查了一下页面保存_and_open_page和链接是正确的:
file:///stories/1/comments/new?parent_id=1
我也查了test.log中的文件,我可以看到这一行:
Started GET "/stories/1/comments/new?parent_id=1" for 127.0.0.1 at 2012-09-02 21:05:57
为什么我一次比一次这个错误,而应该是正确的吗?
谢谢:)我不得不改变所有路径到网址。 – ArashM