search for: expectation_test

Displaying 4 results from an estimated 4 matches for "expectation_test".

2006 Sep 22
2
foo.expects(:blah).returns(10).then(11) syntax
I recently needed the behavior of my object to change on subsequent method calls so I added the syntax above. Here''s the diff of changes I made: Index: test/mocha/expectation_test.rb =================================================================== --- test/mocha/expectation_test.rb (revision 854) +++ test/mocha/expectation_test.rb (working copy) @@ -95,6 +95,12 @@ assert_equal 99, expectation.invoke end + def test_should_return_values_in_order + e...
2006 Sep 29
1
yielding consecutive values
...on = ''/destination/'') yield_results = [''/'', ''filename.yaml'', ''blah.xml''] Find.expects(:find).with(documentation).yields(lambda { yield_results.shift } ) ... end So I made these changes... Index: test/mocha/expectation_test.rb =================================================================== --- test/mocha/expectation_test.rb (revision 62) +++ test/mocha/expectation_test.rb (working copy) @@ -91,6 +91,11 @@ assert_equal parameters_for_yield, yielded_parameters end + def test_should_yield_with_bl...
2006 Sep 29
2
multiyield
...).with(documentation).multiyield (''filename.yaml'', ''blah.xml'') File.expects(:directory?).with(''filename.yaml'') File.expects(:directory?).with(''blah.xml'') .... end So, I wrote multiyield.... Index: test/mocha/expectation_test.rb =================================================================== --- test/mocha/expectation_test.rb (revision 62) +++ test/mocha/expectation_test.rb (working copy) @@ -91,6 +91,13 @@ assert_equal parameters_for_yield, yielded_parameters end + def test_should_yield_multipl...
2007 Mar 12
10
using mocha with rspec
Hi folks. I''ve just started using rspec and I have to say it''s very nice. The thing is, I prefer mocha''s mocking dialect. So I thought a simple require ''mocha'' would set me up. Unfortunately, rspec does all its goodness using do/end blocks in anonymous classes, so it wasn''t quite that obvious. Anyway, here is the incantation I ended up