[rspec-users] spec with user culture

2009-12-22 Thread Gnagno Gnagno
Hello all, I am making my first experiments with rspec, I wanted to do something like this: when a user visit the home page of my site he will be redirected depending on his culture, so if his culture is english he will be redirected to myapp/en if he is italian to myapp/it and so on how can

Re: [rspec-users] spec with user culture

2009-12-22 Thread Gnagno Gnagno
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'].includ

Re: [rspec-users] spec with user culture

2009-12-23 Thread Gnagno Gnagno
Thank you very much :) I didn't know I could access request.env['HTTP_ACCEPT_LANGUAGE'] in writing, and didn't even try it -- Posted via http://www.ruby-forum.com/. ___ rspec-users mailing list rspec-users@rubyforge.org http://rubyforge.org/mailman/lis

Re: [rspec-users] spec with user culture

2009-12-23 Thread Gnagno Gnagno
Sorry, I have one more question, I didn't find the cucumber forum, so please forgive me if I am too much out of topic here. I was trying to achieve the same with cucumber, so I wrote this: Scenario Outline: visit home page and get redirect to localized home page Given my culture is When I

Re: [rspec-users] spec with user culture

2009-12-23 Thread Gnagno Gnagno
I solved the question concerning cucumber, I will post here the solution in case someone else will need it: in my step definitions I just put: Given /^my culture is (.+)$/ do |culture| header "HTTP_ACCEPT_LANGUAGE", "it-IT" if culture == 'italian' header "HTTP_ACCEPT_LANGUAGE", "en-GB" if cu