aboutsummaryrefslogtreecommitdiffstats
path: root/actionwebservice/test/abstract_unit.rb
blob: 392951ede7131af778308b98cd6a6adbaf52fcd8 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
ENV["RAILS_ENV"] = "test"
$:.unshift(File.dirname(__FILE__) + '/../lib')
$:.unshift(File.dirname(__FILE__) + '/../../activesupport/lib')
$:.unshift(File.dirname(__FILE__) + '/../../actionpack/lib')
$:.unshift(File.dirname(__FILE__) + '/../../activerecord/lib')

require 'test/unit'
require 'action_web_service'
require 'action_controller'
require 'action_controller/test_process'

ActionController::Base.logger = nil
ActionController::Base.ignore_missing_templates = true

begin
  PATH_TO_AR = File.dirname(__FILE__) + '/../../activerecord'
  require "#{PATH_TO_AR}/lib/active_record" unless Object.const_defined?(:ActiveRecord)
  require "#{PATH_TO_AR}/lib/active_record/fixtures" unless Object.const_defined?(:Fixtures)
rescue Object => e
  fail "\nFailed to load activerecord: #{e}"
end

ActiveRecord::Base.establish_connection(
  :adapter  => "mysql",
  :username => "rails",
  :encoding => "utf8",
  :database => "actionwebservice_unittest"
)
ActiveRecord::Base.connection

Test::Unit::TestCase.fixture_path = "#{File.dirname(__FILE__)}/fixtures/"

# restore default raw_post functionality
class ActionController::TestRequest
  def raw_post
    super
  end
end