Hi all,

I'm hoping someone can help me here I'm trying to carry out functional
testing, my IDE is NetBeans 6.8 and I've found that any tests on
controllers who have to deal with related data are failing.

I've got a controller called business that hold the details of a
business along with its owner which is a user created using authlogic.

In the get_index, and show_business sections of the test I'm getting an
ActionView error because I've changed the related view to display the
related data not the actualy foreign key e.g. it shows 'Graham' not 1

The errors reported are

test_should_get_index(BusinessesControllerTest):
ActionView::TemplateError: undefined method `login' for nil:NilClass
On line #24 of app/views/businesses/index.html.erb

    21:     <td><%=h business.country %></td>
    22:     <td><%=h business.longitude %></td>
    23:     <td><%=h business.lattitude %></td>
    24:     <td><%=h business.user.login %></td>
    25:     <td><%= link_to 'Show', business %></td>
    26:     <td><%= link_to 'Edit', edit_business_path(business) %></td>
    27:     <td><%= link_to 'Destroy', business, :confirm => 'Are you
sure?', :method => :delete %></td>

test_should_show_business(BusinessesControllerTest):
ActionView::TemplateError: undefined method `login' for nil:NilClass
On line #38 of app/views/businesses/show.html.erb

    35:
    36: <p>
    37:   <b>Business Owner:</b>
    38:   <%=h @business.user.login%>
    39: </p>
    40:
    41: <%= link_to 'Edit', edit_business_path(@business) %> |



I am also getting a run time error on the get_new test as it can't save
a record because there is no logged in user.

I've read that these failures are normal because of the changes I made
ocurred after ROR created the test files but not how to resolve the
issues.

Can anyone give me some pointers on this???


Thanks,


Graham
-- 
Posted via http://www.ruby-forum.com/.

-- 
You received this message because you are subscribed to the Google Groups "Ruby 
on Rails: Talk" group.
To post to this group, send email to rubyonrails-t...@googlegroups.com.
To unsubscribe from this group, send email to 
rubyonrails-talk+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/rubyonrails-talk?hl=en.

Reply via email to