Sha256: 8acec666b580503c3e202396b24d4001c9adc7fdde5deaeef72096d84c2bf065

Contents?: true

Size: 542 Bytes

Versions: 7

Compression:

Stored size: 542 Bytes

Contents

require 'abstract_unit'

class TestRecord < ActiveRecord::Base
end

class TestUnconnectedAdaptor < Test::Unit::TestCase
  self.use_transactional_fixtures = false

  def setup
    @connection = ActiveRecord::Base.remove_connection
  end

  def teardown
    ActiveRecord::Base.establish_connection(@connection)
  end

  def test_unconnected
    assert_raise(ActiveRecord::ConnectionNotEstablished) do
      TestRecord.find(1)   
    end
    assert_raise(ActiveRecord::ConnectionNotEstablished) do
      TestRecord.new.save   
    end
  end
end

Version data entries

7 entries across 7 versions & 1 rubygems

Version Path
activerecord-1.11.1 test/unconnected_test.rb
activerecord-1.12.1 test/unconnected_test.rb
activerecord-1.12.2 test/unconnected_test.rb
activerecord-1.11.0 test/unconnected_test.rb
activerecord-1.13.0 test/unconnected_test.rb
activerecord-1.13.2 test/unconnected_test.rb
activerecord-1.13.1 test/unconnected_test.rb