[rspec-users] Stories - Use view matchers rather than assigns[].should?

Pat Maddox pergesu at gmail.com
Wed Apr 9 22:55:25 EDT 2008

On Wed, Apr 9, 2008 at 7:37 PM, Tim Haines <tmhaines at gmail.com> wrote:
> Hi there,
> Just want to confirm I have this right.  Writing a story,
> assigns[:games].length.should == 30 fails for me complaining assigns[:games]
> is nil.  It seems assigns isn't set for story steps?   I've changed this to
> response.should have_tag(".game", 30).  Is this correct?

I would say that you shouldn't be trying to test that sort of thing in
a story.  The fact that Rails assigns stuff as instance variables in
views is a framework implementation detail, not externally visible


More information about the rspec-users mailing list