title: Setting up one time login with minitest/capybara for running rails tests
body: <p>I'm using <code>capybara</code> with <code>minitest</code> on <strong>Rails 2.3.14</strong>. Like most applications, this one also requires login to do anything inside the site. I'd like to be able to login once per test-suite and use that session throughout all tests that are run. How do I refactor that to the <code>minitest_helper</code>? Right now my helper looks something like this:</p>
  
  <pre><code>#!/usr/bin/env ruby
  
  ENV['RAILS_ENV'] = 'test'
  require File.expand_path(File.dirname(__FILE__) + "/../config/environment")
  
  gem 'minitest'
  gem 'capybara_minitest_spec'
  
  require 'minitest/unit'
  require 'minitest/spec'
  require 'minitest/mock'
  require 'minitest/autorun'
  require 'capybara/rails'
  require 'factory_girl'
  
  
  FactoryGirl.find_definitions
  
  class MiniTest::Spec
  
    include FactoryGirl::Syntax::Methods
    include Capybara::DSL
    include ActionController::URLWriter
  
    before(:each) do
      # .. misc global setup stuff, db cleanup, etc.
    end
  
    after(:each) do
      # .. more misc stuff
    end
  
  end
  </code></pre>
  
  <p>thanks.</p>