search for: justinko

Displaying 2 results from an estimated 2 matches for "justinko".

2012 Feb 21
8
should_receive_chain
Do you often find yourself doing this: active = double(''active'') active.should_receive(:first) users = double(''users'', active: active) account.should_receive(:users).and_return(users) for this: account.users.active.first ? Of course, we could use stub_chain, but that doesn''t let us know *where* the chain broke. Would you like to do this?
2011 Sep 08
2
rspec and testing IO
I have a class that expects some input via ''gets''. I found that, when testing, I can do something as simple as this: @foo.stub!(:gets) { "stuff\n" } However that only works in the most simple case. In my case the class asks a series of questions that require a yes/no answer culminating in some end state. The class then asks if the user would like to go through the