Re: [rspec-users] Testing on enter state

2008-11-19 Thread Mark Wilden
In other words, the object changes its private state to achieve a publically visible result (otherwise, why bother?) Test that result. ///ark ___ rspec-users mailing list rspec-users@rubyforge.org http://rubyforge.org/mailman/listinfo/rspec-users

Re: [rspec-users] Testing on enter state

2008-11-19 Thread Mark Wilden
In other words, the object changes its private state to achieve a publically visible result (otherwise, why bother?) Test that result. ///ark ___ rspec-users mailing list rspec-users@rubyforge.org http://rubyforge.org/mailman/listinfo/rspec-users

Re: [rspec-users] Testing on enter state

2008-11-19 Thread Rahoul Baruah
-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 rat

Re: [rspec-users] Testing on enter state

2008-11-19 Thread Ramon Tayag
Ahh.. yes, you do. Thanks a lot! That definitely answers my question. Ramon Tayag On Wed, Nov 19, 2008 at 10:01 PM, David Chelimsky <[EMAIL PROTECTED]> wrote: > I didn't mean make the methods public. I meant use the public API. > > For example, this: > > describe Dog do > it "should increase i

Re: [rspec-users] Testing on enter state

2008-11-19 Thread David Chelimsky
On Wed, Nov 19, 2008 at 7:55 AM, Ramon Tayag <[EMAIL PROTECTED]> wrote: > On Wed, Nov 19, 2008 at 9:52 PM, David Chelimsky <[EMAIL PROTECTED]> wrote: >> On Wed, Nov 19, 2008 at 7:17 AM, Ramon Tayag <[EMAIL PROTECTED]> wrote: >>> I was reading some old posts on how we shouldn't test private methods,

Re: [rspec-users] Testing on enter state

2008-11-19 Thread Ramon Tayag
Not sure if I'm understanding right, but no, I can make the method public -- I just got used to methods, that aren't (or don't need to be) called by anything but its owner, being private. If I make it public it solves my question somewhat :) Thanks, Ramon Tayag On Wed, Nov 19, 2008 at 9:52 PM,

Re: [rspec-users] Testing on enter state

2008-11-19 Thread David Chelimsky
On Wed, Nov 19, 2008 at 7:17 AM, Ramon Tayag <[EMAIL PROTECTED]> wrote: > I was reading some old posts on how we shouldn't test private methods, > but there seemed to be an exception for states. > > When my model enters a state, a method is executed. (:on => Proc ...) > I just want to test this met

[rspec-users] Testing on enter state

2008-11-19 Thread Ramon Tayag
I was reading some old posts on how we shouldn't test private methods, but there seemed to be an exception for states. When my model enters a state, a method is executed. (:on => Proc ...) I just want to test this method. I couldn't find much material on it. How can I go about this? Thanks, Ram