Release Notes

1.1.0

1.0.0

External changes

Internal changes

0.14.0

0.14.0.alpha

0.13.3

0.13.2

0.13.1

0.13.0

0.12.7

0.12.6

0.12.5

0.12.4

0.12.3

0.12.2

0.12.1

0.12.0

0.11.4

0.11.3

0.11.2

0.11.1

0.11.0

0.10.5

0.10.4

0.10.3

0.10.2

0.10.1

0.10.0

0.9.12

0.9.11

0.9.10

0.9.9

0.9.8

0.9.7

0.9.6

0.9.5

0.9.4

0.9.3

0.9.2

0.9.1

0.9.0

0.5.5

0.5.4

0.5.3

0.5.2

0.5.1

0.5.0

object = mock() object.expects(:method).with(has_key('key_1')) object.method('key_1' => 1, 'key_2' => 2) # no verification error raised

object = mock() object.expects(:method).with(has_key('key_1')) object.method('key_2' => 2) # verification error raised, because method was not called with Hash containing key: 'key_1'

object = mock() object.stubs(:method).returns(1, 2).then.raises(Exception).then.returns(4) object.method # => 1 object.method # => 2 object.method # => raises exception of class Exception object.method # => 4

object = mock() object.stubs(:method).yields(1, 2).then.yields(3) object.method { |*values| p values } # => [1, 2] object.method { |*values| p values } # => [3]

object = mock() object.stubs(:method).multiple_yields([1, 2], [3]) object.method { |*values| p values } # => [1, 2] # => [3]

object = mock() object.stubs(:method).returns(2) object.expects(:method).once.returns(1) object.method # => 1 object.method # => 2 object.method # => 2 # no verification error raised

# The following should still work...

Time.stubs(:now).returns(Time.parse('Mon Jan 01 00:00:00 UTC 2007')) Time.now # => Mon Jan 01 00:00:00 UTC 2007 Time.stubs(:now).returns(Time.parse('Thu Feb 01 00:00:00 UTC 2007')) Time.now # => Thu Feb 01 00:00:00 UTC 2007

0.4.0

0.3.3

0.3.2

0.3.1

0.3.0

0.2.1

0.2.0

So instead of...

wotsit = Mocha.new wotsit.expects(:thingummy).with(5).returns(10) doobrey = Doobrey.new(wotsit) doobrey.hoojamaflip wotsit.verify

you need to do...

wotsit = mock() wotsit.expects(:thingummy).with(5).returns(10) doobrey = Doobrey.new(wotsit) doobrey.hoojamaflip # no need to verify

There are also shortcuts as follows...

instead of...

wotsit = Mocha.new wotsit.expects(:thingummy).returns(10) wotsit.expects(:summat).returns(25)

you can have...

wotsit = mock(:thingummy => 5, :summat => 25)

and instead of...

wotsit = Mocha.new wotsit.stubs(:thingummy).returns(10) wotsit.stubs(:summat).returns(25)

you can have...

wotsit = stub(:thingummy => 5, :summat => 25)

0.1.2

0.1.1