Sha256: 0f30ba11049c89bd497d964e256e409b2bd8237ebe7197d4b8d4761d9c61ef3e
Contents?: true
Size: 1.37 KB
Versions: 2
Compression:
Stored size: 1.37 KB
Contents
ENV['RAILS_DB'] = ( ENV['RAILS_DB'] || 'sqlite' ).downcase require 'rubygems' require 'bundler' Bundler.setup require 'test/unit' begin; require 'redgreen'; rescue LoadError; end begin; require 'turn'; rescue LoadError; end $LOAD_PATH.unshift(File.dirname(__FILE__)) $LOAD_PATH.unshift(File.join(File.dirname(__FILE__), '..', 'lib')) require 'wherex' require 'active_record/fixtures' ROOT_PATH = File.expand_path( File.join( File.dirname(__FILE__) )) FIXTURES_PATH = File.join(File.dirname(__FILE__), 'fixtures') config = YAML::load(ERB.new(IO.read(File.join( ROOT_PATH, 'config', 'database.yml'))).result)['test'][ENV['RAILS_DB']] ActiveRecord::Base.establish_connection config dep = defined?(ActiveSupport::Dependencies) ? ActiveSupport::Dependencies : ::Dependencies dep.autoload_paths.unshift File.join( ROOT_PATH, 'app/models' ) dep.autoload_paths.unshift FIXTURES_PATH ActiveRecord::Base.silence do ActiveRecord::Migration.verbose = false load File.join(FIXTURES_PATH, 'schema.rb') end ActiveRecord::Fixtures.create_fixtures(FIXTURES_PATH, ActiveRecord::Base.connection.tables) class Test::Unit::TestCase def method_missing method, *args candidate = method.to_s.classify begin candidate.constantize.find( ActiveRecord::Fixtures.identify args[0] ) rescue NameError raise NameError.new "undefined local variable or method `#{method}`" end end end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
wherex-1.0.8 | test/helper.rb |
wherex-1.0.7 | test/helper.rb |