Skip to content

Commit 9875469

Browse files
authored
Minitest migration part 1 (#404)
1 parent 09ffe3b commit 9875469

File tree

4 files changed

+26
-20
lines changed

4 files changed

+26
-20
lines changed

spec/closure_tree/namespace_type_spec.rb

Lines changed: 0 additions & 11 deletions
This file was deleted.
Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
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
Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,27 +1,31 @@
1-
require 'spec_helper'
1+
require 'test_helper'
22

3-
RSpec.describe 'Configuration' do
3+
describe "Configuration" do
44
it 'returns connection to the pool after has_closure_tree setup' do
55
class TypeDuplicate < ActiveRecord::Base
66
self.table_name = "namespace_type#{table_name_suffix}"
77
has_closure_tree
88
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
1012
end
1113

1214
it 'returns connection to the pool after has_closure_tree setup with order' do
1315
class MetalDuplicate < ActiveRecord::Base
1416
self.table_name = "#{table_name_prefix}metal#{table_name_suffix}"
1517
has_closure_tree order: 'sort_order', name_column: 'value'
1618
end
17-
expect(ActiveRecord::Base.connection_pool.active_connection?).to be_falsey
19+
20+
refute ActiveRecord::Base.connection_pool.active_connection?
1821
end
1922

2023
it 'returns connection to the pool after has_closure_tree_root setup' do
2124
class GroupDuplicate < ActiveRecord::Base
2225
self.table_name = "#{table_name_prefix}group#{table_name_suffix}"
2326
has_closure_tree_root :root_user
2427
end
25-
expect(ActiveRecord::Base.connection_pool.active_connection?).to be_falsey
28+
29+
refute ActiveRecord::Base.connection_pool.active_connection?
2630
end
2731
end
Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,16 @@
1-
require 'spec_helper'
1+
require 'test_helper'
22

3-
RSpec.describe ClosureTree::Support do
3+
describe ClosureTree::Support do
44
let(:sut) { Tag._ct }
5+
56
it 'passes through table names without prefix and suffix' do
67
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)
89
end
10+
911
it 'extracts through table name with prefix and suffix' do
1012
expected = 'some_random_table_name'
1113
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)
1315
end
1416
end

0 commit comments

Comments
 (0)