Forum: Ruby on Rails Rspec ideology

Announcement (2017-05-07): is now read-only since I unfortunately do not have the time to support and maintain the forum any more. Please see and for other Rails- und Ruby-related community platforms.
B60e912e4197b989217622463d622da9?d=identicon&s=25 (Guest)
on 2007-05-31 14:37
(Received via mailing list)
Hi all.
Could anybody help me with Rspec?
I think that Rspec is used such a way:
1.I decide MyModel must have method my_method which return array of 2
model objects.
2.I write spec where I use stub instead of my_method
3.I create my_method in MyModel and write code of it.
4.I comment stub definition in my spec and use spec as test
Is it right?
Cd804cfeeea508f6bf2f5487c9ef4aed?d=identicon&s=25 linoj (Guest)
on 2007-05-31 20:25
(Received via mailing list)
not really.
Stubs are used to isolate code you want to test, apart from other
code, so you stub out the calls that you're not testing here.

So for model tests
1. decide...
2. write spec to test the model method, test fails
3. write model method to implement the spec
4. run spec again, it succeeds

when you are ready to spec a method that calls the model one you just
wrote, than you could stub the model method so the new code doesnt
depend on it.

B60e912e4197b989217622463d622da9?d=identicon&s=25 (Guest)
on 2007-06-01 08:53
(Received via mailing list)
Thanks for replay,
but what is difference from such spec to rails unit test?
This topic is locked and can not be replied to.