Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Tree: b4c289ac55
Fetching contributors…

Cannot retrieve contributors at this time

45 lines (35 sloc) 1.287 kB
require "rubygems"
gem "rspec", "1.1.11"
require "test/unit"
require "spec"
$:.unshift(File.dirname(__FILE__) + '/../lib')
RAILS_ROOT = File.dirname(__FILE__)
if rails_version = ENV['RAILS_VERSION']
gem "rails", rails_version
end
require "rails/version"
puts "==== Testing with Rails #{Rails::VERSION::STRING} ===="
require 'active_record'
require 'active_record/fixtures'
require "action_controller"
require "action_controller/test_process"
require "unit_record"
if UnitRecord.rails_version >= "2.3"
ActiveSupport::TestCase.class_eval { include ActiveRecord::TestFixtures }
end
# Needed because of this line in setup_with_fixtures and teardown_with_fixtures:
# return unless defined?(ActiveRecord::Base) && !ActiveRecord::Base.configurations.blank?
ActiveRecord::Base.configurations = {"irrelevant" => {:adapter => "stub"}}
ActiveRecord::Base.disconnect! :strategy => :raise, :stub_associations => true
describe UnitRecord do
it "disconnects tests from the database" do
lambda do
ActiveRecord::Base.connection.select_value("SELECT 1")
end.should raise_error
end
it "can change strategy to noop" do
ActiveRecord::Base.connection.change_strategy(:noop) do
ActiveRecord::Base.connection.select_value("SELECT 1").should == nil
end
end
end
Jump to Line
Something went wrong with that request. Please try again.