Sha256: e3982f0afc5e327bd00bbbba07a24d0dd8b8937f02581401a76d61901556c635

Contents?: true

Size: 1.42 KB

Versions: 1

Compression:

Stored size: 1.42 KB

Contents

ENV["RAILS_ENV"] = "test"
$:.unshift(File.dirname(__FILE__) + '/../lib')
require 'rubygems'
require 'multi_rails_init'
require 'active_record'
require 'active_record/version'
require 'active_record/fixtures'
require 'action_controller'
require 'action_controller/test_process'
require 'action_view'
require 'test/unit'
require 'shoulda'

gem 'jnunemaker-matchy'
require 'matchy'
require File.dirname(__FILE__) + '/../init.rb'

config = YAML::load(IO.read(File.dirname(__FILE__) + '/db/database.yml'))
ActiveRecord::Base.logger = Logger.new(File.dirname(__FILE__) + "/debug.log")
ActiveRecord::Base.establish_connection(config[ENV['DB'] || 'sqlite3mem'])
ActiveRecord::Migration.verbose = false
load(File.dirname(__FILE__) + "/db/schema.rb")

class User < ActiveRecord::Base
  acts_as_audited :except => :password
  
  attr_protected :logins
  
  def name=(val)
    write_attribute(:name, CGI.escapeHTML(val))
  end
end
class Company < ActiveRecord::Base
end

class Test::Unit::TestCase
  # def change(receiver=nil, message=nil, &block)
  #   ChangeExpectation.new(self, receiver, message, &block)
  # end
  
  def create_user(attrs = {})
    User.create({:name => 'Brandon', :username => 'brandon', :password => 'password'}.merge(attrs))
  end
  
  def create_versions(n = 2)
    returning User.create(:name => 'Foobar 1') do |u|
      (n - 1).times do |i|
        u.update_attribute :name, "Foobar #{i + 2}"
      end
      u.reload
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
acts_as_audited-1.0.1 test/test_helper.rb