Re: [rspec-users] [RSpec, Rails] POST create action spec and before_filter

2009-05-19 Thread Tero Tilus
2009-05-18 21:40, Florent Florent: I have this controller: http://pastie.org/482270 I wrote this spec: http://pastie.org/482273 There are a few spots which draw my attention. At spec line 4 you create a mock Page with #save that always fails (succesfull save returns true). Is that

Re: [rspec-users] [RSpec, Rails] POST create action spec and before_filter

2009-05-19 Thread Florent Florent
2009/5/19 Tero Tilus t...@tilus.net 2009-05-18 21:40, Florent Florent: I have this controller: http://pastie.org/482270 I wrote this spec: http://pastie.org/482273 There are a few spots which draw my attention. At spec line 4 you create a mock Page with #save that always fails

Re: [rspec-users] [RSpec, Rails] POST create action spec and before_filter

2009-05-19 Thread Florent Florent
2009/5/19 Florent Florent flore...@gmail.com 2009/5/19 Tero Tilus t...@tilus.net Moreover the should set @context is imo a spec smell (even though it's in description string), because it refers to internal state of a PagesController instance, which you should not be interested in, but

Re: [rspec-users] [RSpec, Rails] POST create action spec and before_filter

2009-05-19 Thread Tero Tilus
2009-05-19 10:22, Florent Florent: BTW how can I spec that my @context is correctly set by my filter? How can you tell from _outside_ if the context is properly set or not? What does your controller use the context for? And what happens if the controller does or doesn't know about the context?

[rspec-users] [RSpec, Rails] POST create action spec and before_filter

2009-05-18 Thread Florent Florent
Hello, I face the following problem for a POST create action spec. I have this controller: http://pastie.org/482270 I wrote this spec: http://pastie.org/482273 The spec should set @context works fine. But when running the spec should build a new message I got this error: Page(id: integer,