File tree 4 files changed +26
-20
lines changed
4 files changed +26
-20
lines changed Load Diff This file was deleted.
Original file line number Diff line number Diff line change
1
+ require 'test_helper'
2
+
3
+ describe Namespace ::Type do
4
+ describe "class injection" do
5
+ it "should build hierarchy classname correctly" do
6
+ assert_equal "Namespace::TypeHierarchy" , Namespace ::Type . hierarchy_class . to_s
7
+ assert_equal "Namespace::TypeHierarchy" , Namespace ::Type . _ct . hierarchy_class_name
8
+ assert_equal "TypeHierarchy" , Namespace ::Type . _ct . short_hierarchy_class_name
9
+ end
10
+ end
11
+ end
Original file line number Diff line number Diff line change 1
- require 'spec_helper '
1
+ require 'test_helper '
2
2
3
- RSpec . describe ' Configuration' do
3
+ describe " Configuration" do
4
4
it 'returns connection to the pool after has_closure_tree setup' do
5
5
class TypeDuplicate < ActiveRecord ::Base
6
6
self . table_name = "namespace_type#{ table_name_suffix } "
7
7
has_closure_tree
8
8
end
9
- expect ( ActiveRecord ::Base . connection_pool . active_connection? ) . to be_falsey # +false+ in AR 4, +nil+ in AR 5
9
+
10
+ refute ActiveRecord ::Base . connection_pool . active_connection?
11
+ # +false+ in AR 4, +nil+ in AR 5
10
12
end
11
13
12
14
it 'returns connection to the pool after has_closure_tree setup with order' do
13
15
class MetalDuplicate < ActiveRecord ::Base
14
16
self . table_name = "#{ table_name_prefix } metal#{ table_name_suffix } "
15
17
has_closure_tree order : 'sort_order' , name_column : 'value'
16
18
end
17
- expect ( ActiveRecord ::Base . connection_pool . active_connection? ) . to be_falsey
19
+
20
+ refute ActiveRecord ::Base . connection_pool . active_connection?
18
21
end
19
22
20
23
it 'returns connection to the pool after has_closure_tree_root setup' do
21
24
class GroupDuplicate < ActiveRecord ::Base
22
25
self . table_name = "#{ table_name_prefix } group#{ table_name_suffix } "
23
26
has_closure_tree_root :root_user
24
27
end
25
- expect ( ActiveRecord ::Base . connection_pool . active_connection? ) . to be_falsey
28
+
29
+ refute ActiveRecord ::Base . connection_pool . active_connection?
26
30
end
27
31
end
Original file line number Diff line number Diff line change 1
- require 'spec_helper '
1
+ require 'test_helper '
2
2
3
- RSpec . describe ClosureTree ::Support do
3
+ describe ClosureTree ::Support do
4
4
let ( :sut ) { Tag . _ct }
5
+
5
6
it 'passes through table names without prefix and suffix' do
6
7
expected = 'some_random_table_name'
7
- expect ( sut . remove_prefix_and_suffix ( expected ) ) . to eq ( expected )
8
+ assert_equal expected , sut . remove_prefix_and_suffix ( expected )
8
9
end
10
+
9
11
it 'extracts through table name with prefix and suffix' do
10
12
expected = 'some_random_table_name'
11
13
tn = ActiveRecord ::Base . table_name_prefix + expected + ActiveRecord ::Base . table_name_suffix
12
- expect ( sut . remove_prefix_and_suffix ( tn ) ) . to eq ( expected )
14
+ assert_equal expected , sut . remove_prefix_and_suffix ( tn )
13
15
end
14
16
end
You can’t perform that action at this time.
0 commit comments