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

2009-04-27 Thread Dan North
2009/4/24 Stephen Eley sfe...@gmail.com On Thu, Apr 23, 2009 at 2:19 PM, Fernando Perez li...@ruby-forum.com 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

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 tasta...@gmail.com wrote: 2009/4/24 Stephen Eley sfe...@gmail.com On Thu, Apr 23, 2009 at 2:19 PM, Fernando Perez li...@ruby-forum.com wrote: [...] # Assume an article with no comments and a params structure # have already been set up in

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 tasta...@gmail.com wrote: 2009/4/24 Stephen Eley sfe...@gmail.com 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

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/. ___

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 li...@ruby-forum.com 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:

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 li...@ruby-forum.com 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

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

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 a