[rspec-users] continuing on my quest to learn rspec...

Matt Wynne matt at mattwynne.net
Tue Mar 23 20:03:20 EDT 2010

On 23 Mar 2010, at 17:43, Patrick J. Collins wrote:

> Ok,
> So...  My first attempt at specing a method in my photo model didn't  
> go so
> well..
> http://gist.github.com/341447
> Both of these tests are failing, and I am not even sure if I am  
> structuring
> this anywhere near correct or not...
> In other words... HELP!!!!!!!!!!
> Patrick J. Collins
> http://collinatorstudios.com

Okay I have a few thoughts for you Patrick, hopefully I'll be able to  
give you them in an order that makes some sense.

Firstly I wonder why you're putting this behaviour on the photo class.  
Have you ever heard of the code smell 'feature envy'? Photo#set_cover  
seems to me to be talking mostly to the photo_album, so perhaps this  
behaviour should move there?

Something like

Also, I'm not seeing anything in the specs that actually triggers any  
behaviour in the class. You set up a stub and then immediately assert  
what the photo album's cover should be - when are you expecting the  
code you want to test to be caused to actually run?

> _______________________________________________
> rspec-users mailing list
> rspec-users at rubyforge.org
> http://rubyforge.org/mailman/listinfo/rspec-users


+447974 430184

More information about the rspec-users mailing list