Mam łącze w moim zdaniem uwagi na odpowiadanie na komentarze jak ten:błąd porównując bieżącą ścieżkę z kapibary i RSpec
<%= link_to t('.reply', :default => t("helpers.links.reply")), new_story_comment_path(comment.story, parent_id: comment)%>
Część testu jest tak:
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
otrzymuję ten błąd:
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)>'
sprawdziłem stronę z Save _and_open_page i link jest poprawny:
file:///stories/1/comments/new?parent_id=1
ja również sprawdzić plik test.log i widzę tę linię:
Started GET "/stories/1/comments/new?parent_id=1" for 127.0.0.1 at 2012-09-02 21:05:57
Dlaczego ja dostać ten błąd za każdym razem, podczas gdy powinno być prawidłowe?
Dzięki :) Musiałem zmienić wszystkie ścieżki do adresu URL. – ArashM