title: How to Test Factories First with Minitest but without the spec framework?
body: <p>I found a blog post about <a href="http://blog.bigbinary.com/2012/10/10/test-factories-first.html" rel="nofollow">Testing Factories First</a> (by BigBinary - which happens to be a Minitest/spec version of <a href="http://robots.thoughtbot.com/testing-your-factories-first" rel="nofollow">Thoughtbot's RSpec original</a>).</p>
  
  <p>Could you please show me the equivalent <strong>without</strong> the <code>spec</code> framework - just with Minitest (Rails)?</p>
  
  <h1>The Thoughtbot approach (RSpec)</h1>
  
  <p><strong>spec/factories_spec.rb</strong></p>
  
  <pre><code>FactoryGirl.factories.map(&amp;:name).each do |factory_name|
    describe "The #{factory_name} factory" do
       it 'is valid' do
        build(factory_name).should be_valid
       end
    end
  end
  </code></pre>
  
  <p><strong>Rakefile</strong></p>
  
  <pre><code>if defined?(RSpec)
    desc 'Run factory specs.'
    RSpec::Core::RakeTask.new(:factory_specs) do |t|
      t.pattern = './spec/factories_spec.rb'
    end
  end
  
  task spec: :factory_specs
  </code></pre>
  
  <h1>The BigBinary approach (Minitest, spec)</h1>
  
  <p><strong>spec/factories_spec.rb</strong></p>
  
  <pre><code>require File.expand_path(File.dirname(__FILE__) + '/spec_helper')
  
  describe FactoryGirl do
    EXCEPTIONS = %w(base_address base_batch bad_shipping_address)
    FactoryGirl.factories.each do |factory|
      next if EXCEPTIONS.include?(factory.name.to_s)
      describe "The #{factory.name} factory" do
  
        it 'is valid' do
          instance = build(factory.name)
          instance.must_be :valid?
        end
      end
    end
  end
  </code></pre>
  
  <p><strong>lib/tasks/factory.rake</strong></p>
  
  <pre><code>desc 'Run factory specs.'
  Rake::TestTask.new(:factory_specs) do |t|
    t.pattern = './spec/factories_spec.rb'
  end
  
  task test: :factory_specs
  </code></pre>
  
  <p>What is the Minitest equivalent (without <code>spec</code>)?</p>