[rspec-users] How much test data to use in specs

Rahoul Baruah baz at madeofstone.net
Wed Aug 27 12:57:24 EDT 2008


On 27 Aug 2008, at 16:35, Matt Wynne wrote:

> describe "when the address is less than two characters long" do
> 	it "should be invalid" do ... end
> end
>
> describe "when the address is more than two characters long" do
>
> 	describe "and the address is less than 128 characters long" do
> 		it "should be valid" do ... end
> 	end
>
> 	describe "and the address is more than 128 characters long" do
> 		it "should be invalid" do ... end
> 	end
>
> end

For this, trivial, example, I find that far too verbose.

The "specification" says "if it is less than 2 characters then  
invalid" and "if it is more than 128 characters then invalid" .

But you are actually running three checks - "if less than 2", "if  
greater than 2 but less than 128" and "if greater than 2 and greater  
than 128".

B


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/






-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://rubyforge.org/pipermail/rspec-users/attachments/20080827/2fd03ded/attachment.html>


More information about the rspec-users mailing list