Re: [rspec-users] Depot app, Demeter's law and troubles cleanly spe cing

2009-04-27 Thread Stephen Eley
On Sun, Apr 26, 2009 at 10:20 PM, Dan North wrote: > 2009/4/24 Stephen Eley >> >> Yeah, I'm a smartass. > > Well you seem to be on the right lines to me. Thank you! That means a great deal to me. -- Have Fun, Steve Eley (sfe...@gmail.com) ESCAPE POD - The Science Fiction Podcast Magazi

Re: [rspec-users] Depot app, Demeter's law and troubles cleanly spe cing

2009-04-27 Thread David Chelimsky
On Sun, Apr 26, 2009 at 9:20 PM, Dan North wrote: > 2009/4/24 Stephen Eley >> >> On Thu, Apr 23, 2009 at 2:19 PM, Fernando Perez >> wrote: >> >> [...] >> >> # Assume an article with no comments and a params structure >> # have already been set up in before(:each) >> >> it "should make a new comm

Re: [rspec-users] Depot app, Demeter's law and troubles cleanly spe cing

2009-04-27 Thread Dan North
2009/4/24 Stephen Eley > On Thu, Apr 23, 2009 at 2:19 PM, Fernando Perez > wrote: > > [...] > > # Assume an article with no comments and a params structure > # have already been set up in before(:each) > > it "should make a new comment belonging to the article" do > post :create, :comment => @m

Re: [rspec-users] Depot app, Demeter's law and troubles cleanly spe cing

2009-04-23 Thread Stephen Eley
On Thu, Apr 23, 2009 at 2:19 PM, Fernando Perez wrote: > Rails definitely entices you to break Demeter's law just so often. So fix it. It's usually just a matter of putting in some delegators. If you don't like @article.comments.build, you can declare your own Article.build_comment() method and

Re: [rspec-users] Depot app, Demeter's law and troubles cleanly spe cing

2009-04-23 Thread Zach Dennis
On Thu, Apr 23, 2009 at 2:19 PM, Fernando Perez wrote: > Rails definitely entices you to break Demeter's law just so often. > > Now how to cleanly spec: > > @comment = @article.comments.build(params[:comment]) ? You think that's bad, I've seen many a code that looks like: project.tasks.map(&:res

Re: [rspec-users] Depot app, Demeter's law and troubles cleanly spe cing

2009-04-23 Thread Fernando Perez
Rails definitely entices you to break Demeter's law just so often. Now how to cleanly spec: @comment = @article.comments.build(params[:comment]) ? Mocking and stubbing is starting to get ugly now. -- Posted via http://www.ruby-forum.com/. ___ rspec-u

Re: [rspec-users] Depot app, Demeter's law and troubles cleanly spe cing

2009-04-22 Thread Lenny Marks
On Apr 21, 2009, at 9:45 AM, Steve Schafer wrote: On Mon, 20 Apr 2009 12:40:08 -0700, you wrote: I wrote a blog post that may be helpful. http://www.patmaddox.com/blog/demeter-is-for-encapsulation Basically, when you have structural objects as in this case, demeter isn't useful. I agree

Re: [rspec-users] Depot app, Demeter's law and troubles cleanly spe cing

2009-04-21 Thread Steve Schafer
On Mon, 20 Apr 2009 12:40:08 -0700, you wrote: >I wrote a blog post that may be helpful. >http://www.patmaddox.com/blog/demeter-is-for-encapsulation Basically, >when you have structural objects as in this case, demeter isn't >useful. That's a good example as far as it goes, but I think it makes