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

David Chelimsky dchelimsky at gmail.com
Thu Nov 29 21:46:33 EST 2007


On Nov 29, 2007 8:44 PM, Olivier Dupuis <odupuis at uottawa.ca> wrote:
> Thanks again David!
>
> Sorry for the easy question. I should have looked more carefully at the documentation.

Please, no apologies. The docs aren't perfect, so while it's good to
know they're there, you should always feel free to ask.

Cheers,
David

>
> Olivier
>
>
>
> -----Original Message-----
> From: rspec-users-bounces at rubyforge.org on behalf of David Chelimsky
> Sent: Thu 11/29/2007 9:29 PM
> To: rspec-users
> Subject: Re: [rspec-users] Rendering a view and passing a variable
>
> On Nov 29, 2007 8:29 PM, Olivier Dupuis <odupuis at uottawa.ca> wrote:
> >
> >
> >
> >
> > 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")
> >  end
> >
> >  I get the error message saying that no tag was found.
> >
> >  Any help would be appreciated
>
> http://rspec.rubyforge.org/documentation/rails/writing/views.html
>
> assigns[:language] = "e"
>
> Cheers,
> David
>
> >
> >  Thank you in advance
> >
> >  Olivier Dupuis
> > _______________________________________________
> > rspec-users mailing list
> > rspec-users at rubyforge.org
> > http://rubyforge.org/mailman/listinfo/rspec-users
> >
> _______________________________________________
> rspec-users mailing list
> rspec-users at rubyforge.org
> http://rubyforge.org/mailman/listinfo/rspec-users
>
>
> _______________________________________________
> rspec-users mailing list
> rspec-users at rubyforge.org
> http://rubyforge.org/mailman/listinfo/rspec-users
>


More information about the rspec-users mailing list