[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 Tom Stuart
On 22 Dec 2009, at 11:26, Gnagno Gnagno wrote: > it "should redirect to spanish home page" do > get 'index' > #don't know how to say the culture is spanish > response.should redirect_to(spanish_home_page) > end How does the application detect the user's "culture"? Cheers, -Tom

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-22 Thread David Chelimsky
On Tue, Dec 22, 2009 at 8:25 AM, Gnagno Gnagno 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 :

[rspec-users] class variables different between spec and runtime?

2009-12-22 Thread Peter Fitzgibbons
Hello Folks, This gist http://gist.github.com/261791 has an example user.rb, user_spec.rb At runtime, this snippet fails u = User.find(123) u.update_with_profile({...}) The error occurred while evaluating nil.select): app/models/user.rb:6:in `moderator_fields' app/models/user.rb:118:in `updat

Re: [rspec-users] class variables different between spec and runtime?

2009-12-22 Thread David Chelimsky
On Tue, Dec 22, 2009 at 9:14 AM, Peter Fitzgibbons < peter.fitzgibb...@gmail.com> wrote: > Hello Folks, > > This gist http://gist.github.com/261791 has an example user.rb, > user_spec.rb > At runtime, this snippet fails > > u = User.find(123) > u.update_with_profile({...}) > The error occurred whi

Re: [rspec-users] class variables different between spec and runtime?

2009-12-22 Thread David Chelimsky
On Tue, Dec 22, 2009 at 9:22 AM, David Chelimsky wrote: > > > On Tue, Dec 22, 2009 at 9:14 AM, Peter Fitzgibbons < > peter.fitzgibb...@gmail.com> wrote: > >> Hello Folks, >> >> This gist http://gist.github.com/261791 has an example user.rb, >> user_spec.rb >> At runtime, this snippet fails >> >> u

Re: [rspec-users] class variables different between spec and runtime?

2009-12-22 Thread Rick DeNatale
On Tue, Dec 22, 2009 at 10:24 AM, David Chelimsky wrote: > > > On Tue, Dec 22, 2009 at 9:22 AM, David Chelimsky > wrote: >> >> >> On Tue, Dec 22, 2009 at 9:14 AM, Peter Fitzgibbons >> wrote: >>> >>> Hello Folks, >>> >>> This gist http://gist.github.com/261791 has an example user.rb, >>> user_spe

Re: [rspec-users] no should raise_exception

2009-12-22 Thread rogerdpack
> raise_error already catches any type of exception, error or not: > >   class BlahException < Exception; end >   class BlahError < StandardError; end > >   lambda { raise BlahException }.should raise_error(BlahException) >   lambda { raise BlahError }.should raise_error(BlahError) >   lambda { rai

[rspec-users] concept of given

2009-12-22 Thread rogerdpack
Forgive me if the question is a common one... does rspec have any concept like given "a certain set of paths" do it "should be able to recreate them" do; end it "..."; end end ? Thanks. -r ___ rspec-users mailing list rspec-users@rubyforge.org htt

Re: [rspec-users] class variables different between spec and runtime?

2009-12-22 Thread David Chelimsky
On Tue, Dec 22, 2009 at 9:30 AM, Rick DeNatale wrote: > Also counting on class variables to retain state in Rails is a recipe > for disaster. > Did you read that in rails recipes? :-/ ___ rspec-users mailing list rspec-users@rubyforge.org http://rubyfo

Re: [rspec-users] concept of given

2009-12-22 Thread David Chelimsky
On Tue, Dec 22, 2009 at 9:35 AM, rogerdpack wrote: > Forgive me if the question is a common one... > > does rspec have any concept like > > given "a certain set of paths" do > > it "should be able to recreate them" do; end > it "..."; end > end > Not built into rspec. There is a merb extension

Re: [rspec-users] concept of given

2009-12-22 Thread Rick DeNatale
On Tue, Dec 22, 2009 at 10:38 AM, David Chelimsky wrote: > On Tue, Dec 22, 2009 at 9:35 AM, rogerdpack wrote: >> >> Forgive me if the question is a common one... >> >> does rspec have any concept like >> >> given "a certain set of paths" do >> >>  it "should be able to recreate them" do; end >>  

Re: [rspec-users] concept of given

2009-12-22 Thread David Chelimsky
On Tue, Dec 22, 2009 at 10:15 AM, Rick DeNatale wrote: > On Tue, Dec 22, 2009 at 10:38 AM, David Chelimsky > wrote: > > On Tue, Dec 22, 2009 at 9:35 AM, rogerdpack > wrote: > >> > >> Forgive me if the question is a common one... > >> > >> does rspec have any concept like > >> > >> given "a certa

Re: [rspec-users] concept of given

2009-12-22 Thread rogerdpack
> context "given a certain set of paths" do Ahh so it's called context. Cool (though I'll admit that naming it "given" can make it sound more like an English sentence, so an alias would be a suggestion). Much thanks. -r ___ rspec-users mailing list rs

Re: [rspec-users] concept of given

2009-12-22 Thread David Chelimsky
On Tue, Dec 22, 2009 at 10:31 AM, rogerdpack wrote: > > > context "given a certain set of paths" do > > Ahh so it's called context. > > Cool (though I'll admit that naming it "given" can make it sound more > like an English sentence, so an alias would be a suggestion). > http://gist.github.com/20

Re: [rspec-users] class variables different between spec and runtime?

2009-12-22 Thread Peter Fitzgibbons
DOH! Thanks David, Happy Holidays! Peter Fitzgibbons (847) 687-7646 Email: peter.fitzgibb...@gmail.com IM GTalk: peter.fitzgibbons IM AOL: peter.fitzgibb...@gmail.com On Tue, Dec 22, 2009 at 9:24 AM, David Chelimsky wrote: > > > On Tue, Dec 22, 2009 at 9:22 AM, David Chelimsky wrote: > >> >> >

Re: [rspec-users] no should raise_exception

2009-12-22 Thread David Chelimsky
On Tue, Dec 22, 2009 at 9:33 AM, rogerdpack wrote: > > raise_error already catches any type of exception, error or not: > > > > class BlahException < Exception; end > > class BlahError < StandardError; end > > > > lambda { raise BlahException }.should raise_error(BlahException) > > lambda