tôi có một liên kết trong quan điểm ý kiến của tôi để trả lời bình luận như thế này:lỗi trong so sánh đường dẫn hiện tại với Capybara và rspec
<%= link_to t('.reply', :default => t("helpers.links.reply")), new_story_comment_path(comment.story, parent_id: comment)%>
Một số phần của bài thi là như thế này:
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
tôi nhận được lỗi này:
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)>'
tôi đã kiểm tra trang với tiết kiệm _and_open_page và liên kết là đúng:
file:///stories/1/comments/new?parent_id=1
Tôi cũng đã kiểm tra các tập tin test.log và tôi có thể nhìn thấy dòng này:
Started GET "/stories/1/comments/new?parent_id=1" for 127.0.0.1 at 2012-09-02 21:05:57
Tại sao tôi nhận được lỗi này mỗi lần, trong khi nó phải được có đúng không?
Cảm ơn :) Tôi phải thay đổi tất cả đường dẫn thành url. – ArashM