[rspec-users] Testing shorthand array push <<

Lance Carlson lancecarlson at gmail.com
Fri Jul 20 22:52:49 EDT 2007

Hi everyone,

I'm trying to test the shorthand way to push objects into an array. My
controller looks like:

current_user.foos << @foo

and I keep getting an error like Mock 'foos' received unexpected message :<<
with <FooClass>

does anyone have a good solution for this?

I tried controller.send(:current_user).labels.stub!(:<<).and_return([]) and
that didn't work.

-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://rubyforge.org/pipermail/rspec-users/attachments/20070720/1c71d52d/attachment.html 

More information about the rspec-users mailing list