[rspec-users] How to spec the existence of specs

Nick Hoffman nick at deadorange.com
Fri Aug 29 10:10:50 EDT 2008


On 2008-08-29, at 05:06, Joseph Wilk wrote:
>> Each method generates specs depending on its arguments
>
> How does each method generate the specs?
> * Using script/generate rspec...
> or
> * File handling and writing your own?
>
> --
> Joseph Wilk
> http://www.joesniff.co.uk

Hi again Joseph. Each method generates the specs by calling RSpec's  
#describe and #it methods, like this:

def check_model_attributes_when_nil(model, ...
   ...
   columns_to_check.each do |attribute|
     describe model, "with '#{attribute}' set to nil" do
       ...
       it "should be invalid" do
         @model_instance.should_not be_valid
       end
       ...
     end
   end


More information about the rspec-users mailing list