[rspec-users] Testing on enter state

Rahoul Baruah baz at madeofstone.net
Wed Nov 19 09:30:22 EST 2008


-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1


On 19 Nov 2008, at 14:01, David Chelimsky wrote:

> For example, this:
>
> describe Dog do
>  it "should increase its heart rate when the postman arrives" do
>    dog = Dog.new
>    lambda {dog.see Postman.new}.should change{dog.heartrate}.by(10)
>  end
> end
>
> rather than this:
>
> describe Dog do
>  it "should transition to an agitated state when the postman  
> arrives" do
>    dog = Dog.new
>    dog.should_receive(:transition_to).with(:agitated)
>    dog.see Postman.new
>  end
> end


Can I just say that that is a truly great example :-)


Rahoul Baruah
Web design and development: http://www.3hv.co.uk/
Nottingham Forest: http://www.eighteensixtyfive.co.uk/
Serious Rails Hosting: http://www.brightbox.co.uk/
Lifecast: http://www.madeofstone.net/






-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.8 (Darwin)

iEYEARECAAYFAkkkIv4ACgkQu0BNRvjN8xSqWACfRAq1jiaqQnxDfvhdG/F1xy4A
qeMAn11P+WAcY8F7XVENIfMl1BEE9sO5
=Vp0S
-----END PGP SIGNATURE-----


More information about the rspec-users mailing list