Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
Fix rake test_sqlite3_mem
Clearly nobody uses this except me. It's fast people!
  • Loading branch information
jonleighton authored and carlosantoniodasilva committed Jun 28, 2013
1 parent 78d11a2 commit fb86632
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 11 deletions.
3 changes: 2 additions & 1 deletion activerecord/test/cases/disconnected_test.rb
Expand Up @@ -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
Expand Down
15 changes: 5 additions & 10 deletions 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

2 comments on commit fb86632

@senny
Copy link
Member

@senny senny commented on fb86632 Aug 26, 2013

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

❤️

@pftg
Copy link
Contributor

@pftg pftg commented on fb86632 Aug 27, 2013

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

❤️💛💚

Please sign in to comment.