[rspec-users] spec with user culture

David Chelimsky dchelimsky at gmail.com
Tue Dec 22 09:33:32 EST 2009


On Tue, Dec 22, 2009 at 8:25 AM, Gnagno Gnagno <lists at ruby-forum.com> wrote:

> Tom Stuart wrote:
> > How does the application detect the user's "culture"?
> >
> > Cheers,
> > -Tom
>
> Thanks for your reply Tom,
>
> in my home controller I have a line like this for each language:
> redirect_to localized_home_page_path :culture => 'es' and return if
> request.env['HTTP_ACCEPT_LANGUAGE'].include? 'es-ES'
>

You can set that explicitly in the example:

it "should redirect to spanish home page" do
  request.env['HTTP_ACCEPT_LANGUAGE'] = 'es-ES'
  get 'index'
  response.should redirect_to(spanish_home_page)
end

HTH,
David


>
> as I said before I am just 'experimenting and playing' so any suggestion
> is accepted :)
>
>
> maybe I should access to the request object from my spec code?
>
>
>
> --
> Posted via http://www.ruby-forum.com/.
> _______________________________________________
> rspec-users mailing list
> rspec-users at rubyforge.org
> http://rubyforge.org/mailman/listinfo/rspec-users
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://rubyforge.org/pipermail/rspec-users/attachments/20091222/2f320525/attachment.html>


More information about the rspec-users mailing list