Sha256: 5e3482eeb763a27f6dbe877956312fbfed55509a974f511127a61e9b8c01b705

Contents?: true

Size: 1.5 KB

Versions: 11

Compression:

Stored size: 1.5 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(Typus.root, 'app', folder)
  ActiveSupport::Dependencies.load_paths << File.join(Typus.root, '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(Typus.root, 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

11 entries across 11 versions & 2 rubygems

Version Path
fesplugas-typus-0.9.17 test/helper.rb
typus-0.9.26 test/helper.rb
typus-0.9.25 test/helper.rb
typus-0.9.24 test/helper.rb
typus-0.9.23 test/helper.rb
typus-0.9.22 test/helper.rb
typus-0.9.21 test/helper.rb
typus-0.9.20 test/helper.rb
typus-0.9.19 test/helper.rb
typus-0.9.18 test/helper.rb
typus-0.9.17 test/helper.rb