Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
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
1 parent
78d11a2
commit fb86632
Showing
2 changed files
with
7 additions
and
11 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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 |
fb86632
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
❤️
fb86632
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
❤️💛💚