[rspec-users] Rendering a view and passing a variable

Olivier Dupuis odupuis at uottawa.ca
Thu Nov 29 21:29:09 EST 2007

Hello all,

I have a view which display html based on the value of a variable.  Here's the code :

<% if @language == 'e' %>
  <%= link_to "Fran&ccedil;ais", :action => :index, :id => "f" %>
<% end %>

In my test, I'm trying to set the value of the variable first, but that just doesn't seem to work :

it "should display in english when @language is equal to 'E'" do
    @language = "e"
    render "/search/index"
    response.should have_tag("a[href=?]", "/search/index/f")

I get the error message saying that no tag was found.

Any help would be appreciated

Thank you in advance

Olivier Dupuis
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://rubyforge.org/pipermail/rspec-users/attachments/20071129/72a905bc/attachment.html 

More information about the rspec-users mailing list