
ENV["RAILS_ENV"] = "test"

# Boot rails application and testing parts ...
require "fixtures/rails_app/config/environment"
require "rails/test_help"

# As we are simulating the application we need to reload the 
# configurations to get the custom paths.
Typus.reload!

# 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", :database => ":memory:" }
             end

ActiveRecord::Base.establish_connection(connection)

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

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

%w( models controllers helpers ).each do |folder|
  ActiveSupport::Dependencies.load_paths << File.join(Typus.root, "app", folder)
end

ActionController::Base.append_view_path(File.join(Typus.root, "app/views"))

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


ENV["RAILS_ENV"] = "test"

# Boot rails application and testing parts ...
require "fixtures/rails_app/config/environment"
require "rails/test_help"

# As we are simulating the application we need to reload the 
# configurations to get the custom paths.
Typus.reload!

# Different DB settings and load our schema.
connection = case ENV["DB"]
             when /mysql/
               { :adapter => "mysql", :database => "typus_test" }
             when /postgresql/
               { :adapter => "postgresql", :encoding => "unicode", :database => "typus_test" }
             else
               { :adapter => "sqlite3", :database => ":memory:" }
             end

ActiveRecord::Base.establish_connection(connection)

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

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

%w( models controllers helpers ).each do |folder|
  ActiveSupport::Dependencies.load_paths << File.join(Typus.root, "app", folder)
end

ActionController::Base.append_view_path(File.join(Typus.root, "app/views"))

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

Use .my.cnf to connect to the database
Use .my.cnf to connect to the database
