title: Test database seeding with Minitest-rails, Capybara, Capybara-webkit and Rails 4
body: <p>I'm very new to TDD, and have opted to go with the above mentioned Gems. I think I have set it up correctly as I can run my tests. I can't, however, figure out how to populate my test database from db/seeds.rb. When I invoke </p>
  
  <pre><code>rake db:seed RAILS_ENV=test
  </code></pre>
  
  <p>in the terminal, I can see the rows created in the database through PGAdmin. However, when I run my tests with the following</p>
  
  <pre><code>rake minitest:all
  </code></pre>
  
  <p>the database ends up being blank afterwards, and in the test when I save a screenshot, the items from the database does not appear in the frontend as it does when I'm in dev.</p>
  
  <p>My test_helper.rb contains the following.</p>
  
  <pre><code>ENV["RAILS_ENV"] = "test"
  require File.expand_path("../../config/environment", __FILE__)
  require "rails/test_help"
  require "minitest/rails"
  require 'minitest/rails/capybara'
  require 'minitest/focus'
  require 'minitest/colorize'
  Capybara.javascript_driver = :webkit
  
  class ActiveSupport::TestCase
    fixtures :all
      DatabaseCleaner.strategy = :transaction
  
      class MiniTest::Spec
        before :each do
              Rake::Task["db:seed"].invoke
              DatabaseCleaner.start
        end
  
        after :each do
              DatabaseCleaner.clean
        end
      end
  end
  </code></pre>
  
  <p>And for some extra background, my db/seeds.rb file (which works when seeded from manually using rake)</p>
  
  <pre><code>ProgramIndustry.delete_all
  ProgramIndustry.create([
          { name: 'Accounting and finance'},
          { name: 'Banking'},
          { name: 'Construction'},
          { name: 'Education'}
  ])
  </code></pre>
  
  <p>Why would the database not be populated with seeds.rb when the tests start?</p>