[rspec-users] Specyfing behaviour VS specifying implementation

Piotr Wlodarek lists at ruby-forum.com
Tue Jul 15 05:59:55 EDT 2008


At first it seems obvious: one should specify behaviour, not
implementation.

However, there may be a tremendous overhead and duplication with such
approach.

Let's assume:

def a
  # lot's of business logic
end

deb b
  # lot's of business logic
end

def main
  a
  b
end

Assuming we do have specs for methods a and b, how the main method
should be specified?

1) Full behaviour specification
   Problem: it duplicates specification of a and b

2) Specify that main should call a, then b
   Problem: it specifies implementation, NOT behaviour


So, what is the right way?
-- 
Posted via http://www.ruby-forum.com/.


More information about the rspec-users mailing list