I am trying to write specs for the posts/show.html.erb view of a simple application I'm putting together to learn rspec. I'm a bit stumped at the moment on trying to figure out where the extra "%2F" is coming from. Any ideas?
My spec...
it "should render a form to add a comment" do
render "posts/show.html.erb"
response.should have_selector("form[method=post]", :action => post_comments_path([@post, @comment])) do |form|
form.should have_selector("input[name='comment[author_name]']")
form.should have_selector("textarea[name='comment[body]']")
form.should have_selector("input[type=submit]")
end
end
The spec output with the extra %2F...
'posts/show.html.erb should render a form to add a comment' FAILED
expected following output to contain a <form[method=post] action='/posts/1001%2F/comments'/> tag:
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN" "http://www.w3.org/TR/REC-html40/loose.dtd">
<html><body>
<p>#[Post:0x1288146 @name="Post_1001"]
#[Post:0x1288146 @name="Post_1001"]
#[Post:0x1288146 @name="Post_1001"]
Comments<br></p>
<form action="/posts/1001/comments" class="new_comment" id="new_comment" method="post">
</form>
</body></html>
./spec/views/posts/show.html.erb_spec.rb:13: