Dear All,
I’m a new member here. I’ve been using RSpec since my first Rails
project. I’m proud that I’ve deliver the most bugs free app in my
office (In my country, spec’ing even autotesting is not common).
Thanks to Ruby community that make autotesting very easy and
encouraging. I think Ruby is the best entry to start making quality
codes. Because ruby’s way is direct and focus.
There are things that bother me. On of them is this. What are we
spec’ing actually? I’ve heard that we should not do this
it “should save the person”
person = Person.new({:name => ‘Jack’})
person.save!
Person.find(person.id).should != null
end
bacause, it seems that we’re are spec’ing the Active Record which is
already well tested. So, any of you can give me some bad examples or
bad ways to do spec’ing and why. I’d like to learn from other
references too.
Thanks!
–
~A useful man to others is a lucky man
Rzqies, Order now! http://rzqies.wordpress.com
On Aug 24, 2008, at 10:39 AM, Muhammad I. wrote:
spec’ing actually? I’ve heard that we should not do this
references too.
Thanks!
Check out this thread:
http://groups.google.com/group/rspec/browse_thread/thread/7bb484873d327232/a2d46045dcbf1066?lnk=st&q=Should(not%3F)+test+associations+(was%3A+Dealing+with+dependent+data)#a2d46045dcbf1066
It helped me better understand what to spec.
-Jim
On Sun, Aug 24, 2008 at 9:53 PM, Jim G. [email protected] wrote:
On Aug 24, 2008, at 10:39 AM, Muhammad I. wrote:
Check out this thread:
http://groups.google.com/group/rspec/browse_thread/thread/7bb484873d327232/a2d46045dcbf1066?lnk=st&q=Should(not%3F)+test+associations+(was%3A+Dealing+with+dependent+data)#a2d46045dcbf1066
Nice link! Thanks. Actually I got a little confused on David’s
statement:
Try this as a next step:
- code a little
- comment out your code
- write a small example for a small bit of the commented code
- watch it fail
- uncomment just enough to make it pass
- watch it pass
- repeat the last 4 steps
I don’t really get it. Would you give me a simple example?
Thanks
–
~A useful man to others is a lucky man
Rzqies, Order now! http://rzqies.wordpress.com