Sha256: 646d6e4a5c61266aada02bfacff39a325dfa193a665d630600dc0aa5bb6b5a2d

Contents?: true

Size: 1.56 KB

Versions: 14

Compression:

Stored size: 1.56 KB

Contents

ENV['RAILS_ENV'] = 'test'
require File.expand_path(File.dirname(__FILE__) + "/../../../../config/environment")
require 'test_help'
require 'mocha'

begin
  require 'redgreen'
rescue LoadError
end

##
# Different DB settings and load our schema.
#

connection = case ENV['DB']
             when /mysql/
               { :adapter => 'mysql', :username => 'root', :database => 'typus_test' }
             when /postgresql/
               { :adapter => 'postgresql', :encoding => 'unicode', :database => 'typus_test' }
             else
               { :adapter => 'sqlite3', :dbfile => ':memory:' }
             end

ActiveRecord::Base.establish_connection(connection)
ActiveRecord::Base.logger = Logger.new(File.dirname(__FILE__) + '/debug.log')

require File.dirname(__FILE__) + '/schema'

##
# To test the plugin without touching the application we set our 
# load_paths and view_paths.
#

ActiveSupport::Dependencies.load_paths = []
%w( models controllers helpers ).each do |folder|
  ActiveSupport::Dependencies.load_paths << File.join(Rails.root, 'vendor/plugins/typus/app', folder)
  ActiveSupport::Dependencies.load_paths << File.join(Rails.root, 'vendor/plugins/typus/test/fixtures/app', folder)
end

ActionController::Base.view_paths = []
%w( app/views test/fixtures/app/views ).each do |folder|
  ActionController::Base.append_view_path(File.join(Rails.root, 'vendor/plugins/typus', folder))
end

class ActiveSupport::TestCase
  self.fixture_path = File.dirname(__FILE__) + '/fixtures'
  self.use_transactional_fixtures = true
  self.use_instantiated_fixtures  = false
  fixtures :all
end

Version data entries

14 entries across 14 versions & 1 rubygems

Version Path
fesplugas-typus-0.9.0 test/helper.rb
fesplugas-typus-0.9.1 test/helper.rb
fesplugas-typus-0.9.10 test/helper.rb
fesplugas-typus-0.9.11 test/helper.rb
fesplugas-typus-0.9.12 test/helper.rb
fesplugas-typus-0.9.13 test/helper.rb
fesplugas-typus-0.9.14 test/helper.rb
fesplugas-typus-0.9.15 test/helper.rb
fesplugas-typus-0.9.16 test/helper.rb
fesplugas-typus-0.9.2 test/helper.rb
fesplugas-typus-0.9.3 test/helper.rb
fesplugas-typus-0.9.4 test/helper.rb
fesplugas-typus-0.9.5 test/helper.rb
fesplugas-typus-0.9.9 test/helper.rb