Sha256: 8964c9d434d2b02bb226a6abf2ffdddb9ceb37d57c72ee5fd17438b04e303fb6

Contents?: true

Size: 1.39 KB

Versions: 18

Compression:

Stored size: 1.39 KB

Contents

$:.reject! { |e| e.include? 'TextMate' }
ENV["RAILS_ENV"] = "test"
require File.expand_path(File.dirname(__FILE__) + "/../config/environment")
require 'test_help'
require 'ruby-debug'
gem 'thoughtbot-factory_girl' # from github
require 'factory_girl'
require 'authlogic/test_case'
require 'redgreen' rescue LoadError
require File.expand_path(File.dirname(__FILE__) + '/factories')
require File.join(File.dirname(__FILE__), 'shoulda_macros', 'controller')
require File.join(File.dirname(__FILE__), 'shoulda_macros', 'models')

class ActiveSupport::TestCase 
  self.use_transactional_fixtures = true
  self.use_instantiated_fixtures  = false

  include Authlogic::TestCase
  
  def login_as(user)
    success = UserSession.create(user)
    if !success
      errors = user.errors.full_messages.to_sentence
      message = 'User has not been activated' if !user.active?
      raise "could not login as #{user.to_param}.  Please make sure the user is valid. #{message} #{errors}"
    end
    UserSession.find
  end
  
  def assure_logout
    user_session = UserSession.find
    user_session.destroy if user_session
  end
  
  def ensure_flash(val)
    assert_contains flash.values, val, ", Flash: #{flash.inspect}"
  end
  
  # For Selenium
  # setup do |session|
  #   session.host! "localhost:3001"
  # end
  
  def make_parent_params(parent)
    { :parent_id => parent.id, :parent_type => parent.class.to_s }
  end
    
end

Version data entries

18 entries across 18 versions & 3 rubygems

Version Path
muck-comments-0.1.14 test/rails_root/test/test_helper.rb
muck-invites-0.1.2 test/rails_root/test/test_helper.rb
muck-shares-0.1.7 test/rails_root/test/test_helper.rb
muck-comments-0.1.13 test/rails_root/test/test_helper.rb
muck-invites-0.1.1 test/rails_root/test/test_helper.rb
muck-shares-0.1.6 test/rails_root/test/test_helper.rb
muck-comments-0.1.12 test/rails_root/test/test_helper.rb
muck-shares-0.1.5 test/rails_root/test/test_helper.rb
muck-comments-0.1.11 test/rails_root/test/test_helper.rb
muck-shares-0.1.4 test/rails_root/test/test_helper.rb
muck-comments-0.1.10 test/rails_root/test/test_helper.rb
muck-shares-0.1.1 test/rails_root/test/test_helper.rb
muck-shares-0.1.2 test/rails_root/test/test_helper.rb
muck-shares-0.1.3 test/rails_root/test/test_helper.rb
muck-comments-0.1.7 test/rails_root/test/test_helper.rb
muck-comments-0.1.8 test/rails_root/test/test_helper.rb
muck-comments-0.1.9 test/rails_root/test/test_helper.rb
muck-shares-0.1.0 test/rails_root/test/test_helper.rb