[rspec-users] continuing on my quest to learn rspec...
matt at mattwynne.net
Tue Mar 23 20:03:20 EDT 2010
On 23 Mar 2010, at 17:43, Patrick J. Collins wrote:
> So... My first attempt at specing a method in my photo model didn't
> go so
> Both of these tests are failing, and I am not even sure if I am
> this anywhere near correct or not...
> In other words... HELP!!!!!!!!!!
> Patrick J. Collins
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?
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
More information about the rspec-users