Sha256: 6a07a8f2eef174dcf67b637ebac0411514976b97f5468f160c71daf99661206a

Contents?: true

Size: 1.15 KB

Versions: 3

Compression:

Stored size: 1.15 KB

Contents

$:.reject! { |e| e.include? 'TextMate' }
ENV["RAILS_ENV"] = "test"
#require File.expand_path(File.dirname(__FILE__) + "/../../../../config/environment")
require 'rubygems'
require 'factory_girl'
require 'ruby-debug'
require 'mocha'
require 'authlogic'
require 'authlogic/test_case'
require 'active_record'
require 'redgreen' rescue LoadError
require File.expand_path(File.dirname(__FILE__) + '/factories')
require File.join(File.dirname(__FILE__), 'shoulda_macros', 'controller')
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
end

Version data entries

3 entries across 3 versions & 2 rubygems

Version Path
muck-activity-0.1.5 test/test_helper.rb
muck-activity-0.1.6 test/test_helper.rb
muck-activities-0.1.7 test/test_helper.rb