search for: new_expect

Displaying 3 results from an estimated 3 matches for "new_expect".

Did you mean: new_aspect
2006 Sep 29
1
yielding consecutive values
...========================================= --- 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_block_result + expectation = new_expectation.yields( lambda { ''lambda return value'' } ) + expectation.invoke() { |*parameters| assert_equal [''lambda return value''], parameters } + end + def test_should_return_specified_value expectation = new_expectation.returns(99) assert_equa...
2006 Sep 29
2
multiyield
...============================ --- 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_multiple_times_with_multiyield + expectation = new_expectation.multiyield(:foo, 1, ''bar'') + actual = [] + expectation.invoke() { |parameter| actual << parameter } + assert_equal [:foo, 1, ''bar''], actual + end + def test_should_return_specified_value expectation = new_expectation.returns(99)...
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