Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Fix rake test_sqlite3_mem

Clearly nobody uses this except me. It's fast people!
  • Loading branch information...
commit cb8c95033392f70e1b6566a3c6dc6e033045f0c6 1 parent 2ea7183
@jonleighton jonleighton authored
View
3  activerecord/test/cases/disconnected_test.rb
@@ -7,13 +7,14 @@ class TestDisconnectedAdapter < ActiveRecord::TestCase
self.use_transactional_fixtures = false
def setup
+ skip "in-memory database mustn't disconnect" if in_memory_db?
@connection = ActiveRecord::Base.connection
end
def teardown
+ return if in_memory_db?
spec = ActiveRecord::Base.connection_config
ActiveRecord::Base.establish_connection(spec)
- @connection = nil
end
test "can't execute statements while disconnected" do
View
15 activerecord/test/cases/invalid_connection_test.rb
@@ -1,20 +1,15 @@
require "cases/helper"
-require "models/bird"
class TestAdapterWithInvalidConnection < ActiveRecord::TestCase
self.use_transactional_fixtures = false
- def setup
- @spec = ActiveRecord::Base.connection_config
- non_existing_spec = {adapter: @spec[:adapter], database: "i_do_not_exist"}
- ActiveRecord::Base.establish_connection(non_existing_spec)
- end
-
- def teardown
- ActiveRecord::Base.establish_connection(@spec)
+ class Bird < ActiveRecord::Base
+ # Can't just use current adapter; sqlite3 will create a database
+ # file on the fly.
+ establish_connection adapter: 'mysql', database: 'i_do_not_exist'
end
test "inspect on Model class does not raise" do
- assert_equal "Bird(no database connection)", Bird.inspect
+ assert_equal "#{Bird.name}(no database connection)", Bird.inspect
end
end

1 comment on commit cb8c950

@carlosantoniodasilva

I noticed this error as well, thanks @jonleighton :heart:

Please sign in to comment.
Something went wrong with that request. Please try again.