forked from ClosureTree/closure_tree
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request ClosureTree#263 from Envek/pool-checkin
Return database connection into pool after configuration
- Loading branch information
Showing
3 changed files
with
31 additions
and
0 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
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 |
---|---|---|
@@ -0,0 +1,27 @@ | ||
require 'spec_helper' | ||
|
||
describe 'Configuration' do | ||
it 'returns connection to the pool after has_closure_tree setup' do | ||
class TypeDuplicate < ActiveRecord::Base | ||
self.table_name = "namespace_type#{table_name_suffix}" | ||
has_closure_tree | ||
end | ||
expect(ActiveRecord::Base.connection_pool.active_connection?).to be_falsey # +false+ in AR 4, +nil+ in AR 5 | ||
end | ||
|
||
it 'returns connection to the pool after has_closure_tree setup with order' do | ||
class MetalDuplicate < ActiveRecord::Base | ||
self.table_name = "#{table_name_prefix}metal#{table_name_suffix}" | ||
has_closure_tree order: 'sort_order', name_column: 'value' | ||
end | ||
expect(ActiveRecord::Base.connection_pool.active_connection?).to be_falsey | ||
end | ||
|
||
it 'returns connection to the pool after has_closure_tree_root setup' do | ||
class GroupDuplicate < ActiveRecord::Base | ||
self.table_name = "#{table_name_prefix}group#{table_name_suffix}" | ||
has_closure_tree_root :root_user | ||
end | ||
expect(ActiveRecord::Base.connection_pool.active_connection?).to be_falsey | ||
end | ||
end |