[rspec-users] View Testing: Action with parameters

Britt Mileshosky mileshosky at hotmail.com
Sat Jun 21 18:03:11 EDT 2008

I'm looking for the solution to testing for the correct format of a form action with extra parameters in the url in my view tests.
I'm probably overlooking something simple, but I cannot figure out why this is not working.  Should i event be testing for this
in my view test, or should this be a controller-with-integrated-views specific test?

Thanks for the help on my first question to this list!

Test code abbreviated ----------------------------------------------------------------------------------------------------------------

@person = mock_model(Person)
assigns[:person] = @person

response.should have_tag("form[action=?][method=post]", categorizations_path(:person => @person) do

View code abbreviated ----------------------------------------------------------------------------------------------------------------

<% form_for :categorization, :url => {:person => @person} do |f| %>

Example should assert ----------------------------------------------------------------------------------------------------------------

should find form[action='/categorizations?person=1002'][method='post'] where 1002 is the autogenerated id of @person.

The i’m Talkathon starts 6/24/08.  For now, give amongst yourselves.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://rubyforge.org/pipermail/rspec-users/attachments/20080621/f69ee0e0/attachment.html>

More information about the rspec-users mailing list