partitioned 1.3.4 → 1.3.5
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/.travis.yml +15 -0
- data/lib/partitioned/by_daily_time_field.rb +1 -1
- data/lib/partitioned/version.rb +1 -1
- data/lib/partitioned.rb +2 -1
- data/partitioned.gemspec +3 -2
- data/spec/monkey_patch_posgres_spec.rb +16 -16
- data/spec/partitioned/by_created_at_spec.rb +2 -2
- data/spec/partitioned/by_daily_time_field_spec.rb +7 -7
- data/spec/partitioned/by_foreign_key_spec.rb +7 -7
- data/spec/partitioned/by_id_spec.rb +6 -6
- data/spec/partitioned/by_integer_field_spec.rb +12 -12
- data/spec/partitioned/by_monthly_time_field_spec.rb +7 -7
- data/spec/partitioned/by_time_field_spec.rb +22 -22
- data/spec/partitioned/by_weekly_time_field_spec.rb +7 -7
- data/spec/partitioned/by_yearly_time_field_spec.rb +7 -7
- data/spec/partitioned/multi_level/configurator/dsl_spec.rb +9 -8
- data/spec/partitioned/multi_level/configurator/reader_spec.rb +14 -14
- data/spec/partitioned/partitioned_base/configurator/dsl_spec.rb +39 -38
- data/spec/partitioned/partitioned_base/configurator/reader_spec.rb +48 -48
- data/spec/partitioned/partitioned_base/sql_adapter_spec.rb +15 -15
- data/spec/partitioned/partitioned_base_spec.rb +20 -20
- data/spec/spec_helper.rb +11 -1
- data/spec/support/shared_example_spec_helper_for_integer_key.rb +19 -19
- data/spec/support/shared_example_spec_helper_for_time_key.rb +20 -20
- metadata +37 -36
@@ -46,7 +46,7 @@ module Partitioned
|
|
46
46
|
describe "model is abstract class" do
|
47
47
|
|
48
48
|
it "returns true" do
|
49
|
-
class_by_weekly_time_field.abstract_class.
|
49
|
+
expect(class_by_weekly_time_field.abstract_class).to be_truthy
|
50
50
|
end
|
51
51
|
|
52
52
|
end # model is abstract class
|
@@ -54,9 +54,9 @@ module Partitioned
|
|
54
54
|
describe "#partition_normalize_key_value" do
|
55
55
|
|
56
56
|
it "returns date with day set to 1st of the week" do
|
57
|
-
class_by_weekly_time_field.
|
58
|
-
partition_normalize_key_value(Date.parse('2011-01-05')).
|
59
|
-
|
57
|
+
expect(class_by_weekly_time_field.
|
58
|
+
partition_normalize_key_value(Date.parse('2011-01-05'))).
|
59
|
+
to eq(Date.parse('2011-01-03'))
|
60
60
|
end
|
61
61
|
|
62
62
|
end # #partition_normalize_key_value
|
@@ -64,7 +64,7 @@ module Partitioned
|
|
64
64
|
describe "#partition_table_size" do
|
65
65
|
|
66
66
|
it "returns 1.week" do
|
67
|
-
class_by_weekly_time_field.partition_table_size.
|
67
|
+
expect(class_by_weekly_time_field.partition_table_size).to eq(1.week)
|
68
68
|
end
|
69
69
|
|
70
70
|
end # #partition_table_size
|
@@ -78,7 +78,7 @@ module Partitioned
|
|
78
78
|
context "checks data in the base_name is Proc" do
|
79
79
|
|
80
80
|
it "returns Proc" do
|
81
|
-
data.base_name.
|
81
|
+
expect(data.base_name).to be_is_a Proc
|
82
82
|
end
|
83
83
|
|
84
84
|
end # checks data in the base_name is Proc
|
@@ -86,7 +86,7 @@ module Partitioned
|
|
86
86
|
context "checks data in the base_name" do
|
87
87
|
|
88
88
|
it "returns base_name" do
|
89
|
-
data.base_name.call(@employee, Date.parse('2011-01-05')).
|
89
|
+
expect(data.base_name.call(@employee, Date.parse('2011-01-05'))).to eq("20110103")
|
90
90
|
end
|
91
91
|
|
92
92
|
end # checks data in the base_name
|
@@ -46,7 +46,7 @@ module Partitioned
|
|
46
46
|
describe "model is abstract class" do
|
47
47
|
|
48
48
|
it "returns true" do
|
49
|
-
class_by_yearly_time_field.abstract_class.
|
49
|
+
expect(class_by_yearly_time_field.abstract_class).to be_truthy
|
50
50
|
end
|
51
51
|
|
52
52
|
end # model is abstract class
|
@@ -54,9 +54,9 @@ module Partitioned
|
|
54
54
|
describe "#partition_normalize_key_value" do
|
55
55
|
|
56
56
|
it "returns date with day set to 1st January of the year" do
|
57
|
-
class_by_yearly_time_field.
|
58
|
-
partition_normalize_key_value(Date.parse('2011-02-05')).
|
59
|
-
|
57
|
+
expect(class_by_yearly_time_field.
|
58
|
+
partition_normalize_key_value(Date.parse('2011-02-05'))).
|
59
|
+
to eq(Date.parse('2011-01-01'))
|
60
60
|
end
|
61
61
|
|
62
62
|
end # #partition_normalize_key_value
|
@@ -64,7 +64,7 @@ module Partitioned
|
|
64
64
|
describe "#partition_table_size" do
|
65
65
|
|
66
66
|
it "returns 1.year" do
|
67
|
-
class_by_yearly_time_field.partition_table_size.
|
67
|
+
expect(class_by_yearly_time_field.partition_table_size).to eq(1.year)
|
68
68
|
end
|
69
69
|
|
70
70
|
end # #partition_table_size
|
@@ -78,7 +78,7 @@ module Partitioned
|
|
78
78
|
context "checks data in the base_name is Proc" do
|
79
79
|
|
80
80
|
it "returns Proc" do
|
81
|
-
data.base_name.
|
81
|
+
expect(data.base_name).to be_is_a Proc
|
82
82
|
end
|
83
83
|
|
84
84
|
end # checks data in the on_field is Proc
|
@@ -86,7 +86,7 @@ module Partitioned
|
|
86
86
|
context "checks data in the base_name" do
|
87
87
|
|
88
88
|
it "returns base_name" do
|
89
|
-
data.base_name.call(@employee, Date.parse('2011-02-05')).
|
89
|
+
expect(data.base_name.call(@employee, Date.parse('2011-02-05'))).to eq("2011")
|
90
90
|
end
|
91
91
|
|
92
92
|
end # checks data in the base_name
|
@@ -35,7 +35,8 @@ describe Partitioned::MultiLevel::Configurator::Dsl do
|
|
35
35
|
"parent_table_name" => nil,
|
36
36
|
"check_constraint" => nil,
|
37
37
|
"encoded_name" => nil,
|
38
|
-
"using_classes" => []
|
38
|
+
"using_classes" => [],
|
39
|
+
"after_partition_table_create_hooks" => [],
|
39
40
|
}
|
40
41
|
end
|
41
42
|
|
@@ -44,7 +45,7 @@ describe Partitioned::MultiLevel::Configurator::Dsl do
|
|
44
45
|
context "check the model name" do
|
45
46
|
|
46
47
|
it "returns Employer" do
|
47
|
-
dsl.model.
|
48
|
+
expect(dsl.model).to eq(Employee)
|
48
49
|
end
|
49
50
|
|
50
51
|
end # check the model name
|
@@ -52,7 +53,7 @@ describe Partitioned::MultiLevel::Configurator::Dsl do
|
|
52
53
|
context "check the object data" do
|
53
54
|
|
54
55
|
it "returns data" do
|
55
|
-
dsl.data.instance_values.
|
56
|
+
expect(dsl.data.instance_values).to eq(data_stubs)
|
56
57
|
end
|
57
58
|
|
58
59
|
end # check the object data
|
@@ -66,9 +67,9 @@ describe Partitioned::MultiLevel::Configurator::Dsl do
|
|
66
67
|
context "when try to set the field which used to partition child tables" do
|
67
68
|
|
68
69
|
it "raises InvalidForMultiLevelPartitioning" do
|
69
|
-
|
70
|
+
expect {
|
70
71
|
dsl.on
|
71
|
-
}.
|
72
|
+
}.to raise_error(Partitioned::MultiLevel::Configurator::Dsl::InvalidForMultiLevelPartitioning)
|
72
73
|
end
|
73
74
|
|
74
75
|
end # when try to set the field which used to partition child tables
|
@@ -81,12 +82,12 @@ describe Partitioned::MultiLevel::Configurator::Dsl do
|
|
81
82
|
|
82
83
|
it "returns using_classes" do
|
83
84
|
dsl.using_classes("ByCompanyId", "ByCreatedAt")
|
84
|
-
dsl.data.using_classes.first.
|
85
|
-
dsl.data.using_classes.last.
|
85
|
+
expect(dsl.data.using_classes.first).to eq("ByCompanyId")
|
86
|
+
expect(dsl.data.using_classes.last).to eq("ByCreatedAt")
|
86
87
|
end
|
87
88
|
|
88
89
|
end # when try to set the using_classes field
|
89
90
|
|
90
91
|
end # using_classes
|
91
92
|
|
92
|
-
end
|
93
|
+
end
|
@@ -46,7 +46,7 @@ module Partitioned
|
|
46
46
|
context "checking arrays length" do
|
47
47
|
|
48
48
|
it "returns 6" do
|
49
|
-
reader.send(:using_configurators).length.
|
49
|
+
expect(reader.send(:using_configurators).length).to eq(6)
|
50
50
|
end
|
51
51
|
|
52
52
|
end # checking array length
|
@@ -55,13 +55,13 @@ module Partitioned
|
|
55
55
|
|
56
56
|
it "returns 'Partitioned::ById'" do
|
57
57
|
for i in 0..2
|
58
|
-
reader.send(:using_configurators)[i].model.to_s.
|
58
|
+
expect(reader.send(:using_configurators)[i].model.to_s).to eq("Partitioned::ById")
|
59
59
|
end
|
60
60
|
end
|
61
61
|
|
62
62
|
it "returns 'Partitioned::ByCreatedAt'" do
|
63
63
|
for i in 3..5
|
64
|
-
reader.send(:using_configurators)[i].model.to_s.
|
64
|
+
expect(reader.send(:using_configurators)[i].model.to_s).to eq("Partitioned::ByCreatedAt")
|
65
65
|
end
|
66
66
|
end
|
67
67
|
|
@@ -74,8 +74,8 @@ module Partitioned
|
|
74
74
|
context "when on_field value is set by default" do
|
75
75
|
|
76
76
|
it "returns [:id, :created_at]" do
|
77
|
-
reader.on_fields.sort{|a,b| a.to_s <=> b.to_s}.
|
78
|
-
|
77
|
+
expect(reader.on_fields.sort{|a,b| a.to_s <=> b.to_s}).
|
78
|
+
to eq([:id, :created_at].sort{|a,b| a.to_s <=> b.to_s})
|
79
79
|
end
|
80
80
|
|
81
81
|
end # when on_filed value is set by default
|
@@ -87,7 +87,7 @@ module Partitioned
|
|
87
87
|
context "when parent_table_schema_name value is set without options" do
|
88
88
|
|
89
89
|
it "returns public" do
|
90
|
-
reader.parent_table_schema_name.
|
90
|
+
expect(reader.parent_table_schema_name).to eq("public")
|
91
91
|
end
|
92
92
|
|
93
93
|
end # when parent_table_schema_name value is set by default
|
@@ -95,7 +95,7 @@ module Partitioned
|
|
95
95
|
context "when parent_table_schema_name value is set with options" do
|
96
96
|
|
97
97
|
it "returns employees_partitions" do
|
98
|
-
reader.parent_table_schema_name(1, Date.parse("2011-01-03")).
|
98
|
+
expect(reader.parent_table_schema_name(1, Date.parse("2011-01-03"))).to eq("employees_partitions")
|
99
99
|
end
|
100
100
|
|
101
101
|
end # when parent_table_schema_name value is set by value
|
@@ -107,7 +107,7 @@ module Partitioned
|
|
107
107
|
context "when parent_table_name value is set without options" do
|
108
108
|
|
109
109
|
it "returns employees" do
|
110
|
-
reader.parent_table_name.
|
110
|
+
expect(reader.parent_table_name).to eq("employees")
|
111
111
|
end
|
112
112
|
|
113
113
|
end # when parent_table_name value is set without options
|
@@ -115,7 +115,7 @@ module Partitioned
|
|
115
115
|
context "when parent_table_name value is set with options" do
|
116
116
|
|
117
117
|
it "returns employees_partitions.p0" do
|
118
|
-
reader.parent_table_name(1, Date.parse("2011-01-03")).
|
118
|
+
expect(reader.parent_table_name(1, Date.parse("2011-01-03"))).to eq("employees_partitions.p1")
|
119
119
|
end
|
120
120
|
|
121
121
|
end # when parent_table_name value is set with options
|
@@ -125,10 +125,10 @@ module Partitioned
|
|
125
125
|
describe "check_constraint" do
|
126
126
|
|
127
127
|
it "returns check_constraint" do
|
128
|
-
reader.check_constraint(1).
|
129
|
-
|
130
|
-
reader.check_constraint(1, Date.parse('2011-10-10')).
|
131
|
-
|
128
|
+
expect(reader.check_constraint(1)).
|
129
|
+
to eq("( id = 1 )")
|
130
|
+
expect(reader.check_constraint(1, Date.parse('2011-10-10'))).
|
131
|
+
to eq("created_at >= '2011-10-10' AND created_at < '2011-10-17'")
|
132
132
|
end
|
133
133
|
|
134
134
|
end # check_constraint
|
@@ -136,7 +136,7 @@ module Partitioned
|
|
136
136
|
describe "base_name" do
|
137
137
|
|
138
138
|
it "returns base_name" do
|
139
|
-
reader.base_name(1, Date.parse('2011-10-10')).
|
139
|
+
expect(reader.base_name(1, Date.parse('2011-10-10'))).to eq("1_20111010")
|
140
140
|
end
|
141
141
|
|
142
142
|
end # base_name
|
@@ -37,7 +37,8 @@ module Partitioned
|
|
37
37
|
"parent_table_schema_name" => nil,
|
38
38
|
"parent_table_name" => nil,
|
39
39
|
"check_constraint" => nil,
|
40
|
-
"encoded_name" => nil
|
40
|
+
"encoded_name" => nil,
|
41
|
+
"after_partition_table_create_hooks" => [],
|
41
42
|
}
|
42
43
|
end
|
43
44
|
|
@@ -46,7 +47,7 @@ module Partitioned
|
|
46
47
|
context "check the model name" do
|
47
48
|
|
48
49
|
it "returns Employer" do
|
49
|
-
dsl.model.
|
50
|
+
expect(dsl.model).to eq(Employee)
|
50
51
|
end
|
51
52
|
|
52
53
|
end # check the model name
|
@@ -54,7 +55,7 @@ module Partitioned
|
|
54
55
|
context "check the object data" do
|
55
56
|
|
56
57
|
it "returns data" do
|
57
|
-
dsl.data.instance_values.
|
58
|
+
expect(dsl.data.instance_values).to eq(data_stubs)
|
58
59
|
end
|
59
60
|
|
60
61
|
end # check the object data
|
@@ -69,7 +70,7 @@ module Partitioned
|
|
69
70
|
|
70
71
|
it "returns data.on value" do
|
71
72
|
dsl.on(:company_id)
|
72
|
-
dsl.data.on_field.
|
73
|
+
expect(dsl.data.on_field).to eq(:company_id)
|
73
74
|
end
|
74
75
|
|
75
76
|
end # when try to set the field which used to partition child tables
|
@@ -78,7 +79,7 @@ module Partitioned
|
|
78
79
|
|
79
80
|
it "returns data.on value" do
|
80
81
|
dsl.on('#{model.partition_field}')
|
81
|
-
dsl.data.on_field.
|
82
|
+
expect(dsl.data.on_field).to eq('#{model.partition_field}')
|
82
83
|
end
|
83
84
|
|
84
85
|
end # when try to set the field represented as a string to be interpolated naming the field to partition child tables
|
@@ -91,7 +92,7 @@ module Partitioned
|
|
91
92
|
|
92
93
|
it "returns proc" do
|
93
94
|
dsl.on lmd
|
94
|
-
dsl.data.on_field.
|
95
|
+
expect(dsl.data.on_field).to eq(lmd)
|
95
96
|
end
|
96
97
|
|
97
98
|
end # when try to set the field which(with proc) used to partition child tables
|
@@ -104,8 +105,8 @@ module Partitioned
|
|
104
105
|
|
105
106
|
it "returns index" do
|
106
107
|
dsl.index(:id, { :unique => true })
|
107
|
-
dsl.data.indexes.first.field.
|
108
|
-
dsl.data.indexes.first.options.
|
108
|
+
expect(dsl.data.indexes.first.field).to eq(:id)
|
109
|
+
expect(dsl.data.indexes.first.options).to eq({ :unique => true })
|
109
110
|
end
|
110
111
|
|
111
112
|
end # when try to set the index to be created on all child tables
|
@@ -120,7 +121,7 @@ module Partitioned
|
|
120
121
|
|
121
122
|
it "returns proc" do
|
122
123
|
dsl.index lmd
|
123
|
-
dsl.data.indexes.first.
|
124
|
+
expect(dsl.data.indexes.first).to eq(lmd)
|
124
125
|
end
|
125
126
|
|
126
127
|
end # when try to set the index(with proc) to be created on all child tables
|
@@ -133,9 +134,9 @@ module Partitioned
|
|
133
134
|
|
134
135
|
it "returns foreign_keys" do
|
135
136
|
dsl.foreign_key(:company_id)
|
136
|
-
dsl.data.foreign_keys.first.referencing_field.
|
137
|
-
dsl.data.foreign_keys.first.referenced_table.
|
138
|
-
dsl.data.foreign_keys.first.referenced_field.
|
137
|
+
expect(dsl.data.foreign_keys.first.referencing_field).to eq(:company_id)
|
138
|
+
expect(dsl.data.foreign_keys.first.referenced_table).to eq("companies")
|
139
|
+
expect(dsl.data.foreign_keys.first.referenced_field).to eq(:id)
|
139
140
|
end
|
140
141
|
|
141
142
|
end # when try to set the foreign key on a child table
|
@@ -150,7 +151,7 @@ module Partitioned
|
|
150
151
|
|
151
152
|
it "returns proc" do
|
152
153
|
dsl.index lmd
|
153
|
-
dsl.data.indexes.first.
|
154
|
+
expect(dsl.data.indexes.first).to eq(lmd)
|
154
155
|
end
|
155
156
|
|
156
157
|
end # when try to set the foreign key(with proc) on a child table
|
@@ -163,7 +164,7 @@ module Partitioned
|
|
163
164
|
|
164
165
|
it "returns check_constraint" do
|
165
166
|
dsl.check_constraint('company_id = #{field_value}')
|
166
|
-
dsl.data.check_constraint.
|
167
|
+
expect(dsl.data.check_constraint).to eq('company_id = #{field_value}')
|
167
168
|
end
|
168
169
|
|
169
170
|
end # when try to set the check constraint for a given child table
|
@@ -178,7 +179,7 @@ module Partitioned
|
|
178
179
|
|
179
180
|
it "returns proc" do
|
180
181
|
dsl.check_constraint lmd
|
181
|
-
dsl.data.check_constraint.
|
182
|
+
expect(dsl.data.check_constraint).to eq(lmd)
|
182
183
|
end
|
183
184
|
|
184
185
|
end # when try to set the check constraint(with proc) for a given child table
|
@@ -191,7 +192,7 @@ module Partitioned
|
|
191
192
|
|
192
193
|
it "returns check_constraint" do
|
193
194
|
dsl.order('tablename desc')
|
194
|
-
dsl.data.last_partitions_order_by_clause.
|
195
|
+
expect(dsl.data.last_partitions_order_by_clause).to eq('tablename desc')
|
195
196
|
end
|
196
197
|
|
197
198
|
end # when try to set the check constraint for a given child table
|
@@ -204,7 +205,7 @@ module Partitioned
|
|
204
205
|
|
205
206
|
it "returns schema_name" do
|
206
207
|
dsl.schema_name("employees_partitions")
|
207
|
-
dsl.data.schema_name.
|
208
|
+
expect(dsl.data.schema_name).to eq("employees_partitions")
|
208
209
|
end
|
209
210
|
|
210
211
|
end # when try to set the name of the schema that will contain all child tables
|
@@ -213,7 +214,7 @@ module Partitioned
|
|
213
214
|
|
214
215
|
it "returns schema_name" do
|
215
216
|
dsl.schema_name('#{model.table_name}_partitions')
|
216
|
-
dsl.data.schema_name.
|
217
|
+
expect(dsl.data.schema_name).to eq('#{model.table_name}_partitions')
|
217
218
|
end
|
218
219
|
|
219
220
|
end # when try to set the schema name represented as a string to be interpolated at run time
|
@@ -228,7 +229,7 @@ module Partitioned
|
|
228
229
|
|
229
230
|
it "returns proc" do
|
230
231
|
dsl.schema_name lmd
|
231
|
-
dsl.data.schema_name.
|
232
|
+
expect(dsl.data.schema_name).to eq(lmd)
|
232
233
|
end
|
233
234
|
|
234
235
|
end # when try to set the name of the schema(with proc) that will contain all child tables
|
@@ -241,7 +242,7 @@ module Partitioned
|
|
241
242
|
|
242
243
|
it "returns name_prefix" do
|
243
244
|
dsl.name_prefix("p")
|
244
|
-
dsl.data.name_prefix.
|
245
|
+
expect(dsl.data.name_prefix).to eq("p")
|
245
246
|
end
|
246
247
|
|
247
248
|
end # when try to set the name prefix for the child table's name
|
@@ -250,7 +251,7 @@ module Partitioned
|
|
250
251
|
|
251
252
|
it "returns name_prefix" do
|
252
253
|
dsl.name_prefix('#{model.table_name}_child_')
|
253
|
-
dsl.data.name_prefix.
|
254
|
+
expect(dsl.data.name_prefix).to eq('#{model.table_name}_child_')
|
254
255
|
end
|
255
256
|
|
256
257
|
end # when try to set the name prefix represented as a string to be interpolated at run time
|
@@ -265,7 +266,7 @@ module Partitioned
|
|
265
266
|
|
266
267
|
it "returns proc" do
|
267
268
|
dsl.name_prefix lmd
|
268
|
-
dsl.data.name_prefix.
|
269
|
+
expect(dsl.data.name_prefix).to eq(lmd)
|
269
270
|
end
|
270
271
|
|
271
272
|
end # when try to set the name prefix(with proc) for the child table's name
|
@@ -278,7 +279,7 @@ module Partitioned
|
|
278
279
|
|
279
280
|
it "returns base_name" do
|
280
281
|
dsl.base_name("25")
|
281
|
-
dsl.data.base_name.
|
282
|
+
expect(dsl.data.base_name).to eq("25")
|
282
283
|
end
|
283
284
|
|
284
285
|
end # when try to set the name of the child table without the schema name or name prefix
|
@@ -287,7 +288,7 @@ module Partitioned
|
|
287
288
|
|
288
289
|
it "returns base_name" do
|
289
290
|
dsl.base_name('#{model.partition_normalize_key_value(field_value)}')
|
290
|
-
dsl.data.base_name.
|
291
|
+
expect(dsl.data.base_name).to eq('#{model.partition_normalize_key_value(field_value)}')
|
291
292
|
end
|
292
293
|
|
293
294
|
end # when try to set the name of the child table represented as a string to be interpolated at run time
|
@@ -302,7 +303,7 @@ module Partitioned
|
|
302
303
|
|
303
304
|
it "returns proc" do
|
304
305
|
dsl.base_name lmd
|
305
|
-
dsl.data.base_name.
|
306
|
+
expect(dsl.data.base_name).to eq(lmd)
|
306
307
|
end
|
307
308
|
|
308
309
|
end # when try to set the name of the child table(with proc) without the schema name or name prefix
|
@@ -315,7 +316,7 @@ module Partitioned
|
|
315
316
|
|
316
317
|
it "returns part_name" do
|
317
318
|
dsl.part_name("p42")
|
318
|
-
dsl.data.part_name.
|
319
|
+
expect(dsl.data.part_name).to eq("p42")
|
319
320
|
end
|
320
321
|
|
321
322
|
end # when try to set the part name of the child table without the schema name
|
@@ -324,7 +325,7 @@ module Partitioned
|
|
324
325
|
|
325
326
|
it "returns part_name" do
|
326
327
|
dsl.part_name('#{model.table_name}_child_#{model.partition_normalize_key_value(field_value)}')
|
327
|
-
dsl.data.part_name.
|
328
|
+
expect(dsl.data.part_name).to eq('#{model.table_name}_child_#{model.partition_normalize_key_value(field_value)}')
|
328
329
|
end
|
329
330
|
|
330
331
|
end # when try to set the part name of the child table represented as a string to be interpolated at run time
|
@@ -339,7 +340,7 @@ module Partitioned
|
|
339
340
|
|
340
341
|
it "returns proc" do
|
341
342
|
dsl.part_name lmd
|
342
|
-
dsl.data.part_name.
|
343
|
+
expect(dsl.data.part_name).to eq(lmd)
|
343
344
|
end
|
344
345
|
|
345
346
|
end # when try to set the part name(with proc) of the child table without the schema name
|
@@ -352,7 +353,7 @@ module Partitioned
|
|
352
353
|
|
353
354
|
it "returns table_name" do
|
354
355
|
dsl.table_name("foos_partitions.p42")
|
355
|
-
dsl.data.table_name.
|
356
|
+
expect(dsl.data.table_name).to eq("foos_partitions.p42")
|
356
357
|
end
|
357
358
|
|
358
359
|
end # when try to set the full name of a child table
|
@@ -361,7 +362,7 @@ module Partitioned
|
|
361
362
|
|
362
363
|
it "returns table_name" do
|
363
364
|
dsl.table_name('#{model.table_name}_partitions.#{model.table_name}_child_#{model.partition_normalize_key_value(field_value)}')
|
364
|
-
dsl.data.table_name.
|
365
|
+
expect(dsl.data.table_name).to eq('#{model.table_name}_partitions.#{model.table_name}_child_#{model.partition_normalize_key_value(field_value)}')
|
365
366
|
end
|
366
367
|
|
367
368
|
end # when try to set the table name of the child table represented as a string to be interpolated at run time
|
@@ -376,7 +377,7 @@ module Partitioned
|
|
376
377
|
|
377
378
|
it "returns proc" do
|
378
379
|
dsl.table_name lmd
|
379
|
-
dsl.data.table_name.
|
380
|
+
expect(dsl.data.table_name).to eq(lmd)
|
380
381
|
end
|
381
382
|
|
382
383
|
end # when try to set the full name(with proc) of a child table
|
@@ -389,7 +390,7 @@ module Partitioned
|
|
389
390
|
|
390
391
|
it "returns parent_table_name" do
|
391
392
|
dsl.parent_table_name("employees")
|
392
|
-
dsl.data.parent_table_name.
|
393
|
+
expect(dsl.data.parent_table_name).to eq("employees")
|
393
394
|
end
|
394
395
|
|
395
396
|
end # when try to set the table name who is the direct ancestor of a child table
|
@@ -398,7 +399,7 @@ module Partitioned
|
|
398
399
|
|
399
400
|
it "returns parent_table_name" do
|
400
401
|
dsl.parent_table_name('#{model.table_name}')
|
401
|
-
dsl.data.parent_table_name.
|
402
|
+
expect(dsl.data.parent_table_name).to eq('#{model.table_name}')
|
402
403
|
end
|
403
404
|
|
404
405
|
end # when try to set the parent table name represented as a string to be interpolated at run time
|
@@ -413,7 +414,7 @@ module Partitioned
|
|
413
414
|
|
414
415
|
it "returns proc" do
|
415
416
|
dsl.parent_table_name lmd
|
416
|
-
dsl.data.parent_table_name.
|
417
|
+
expect(dsl.data.parent_table_name).to eq(lmd)
|
417
418
|
end
|
418
419
|
|
419
420
|
end # when try to set the table name(with proc) who is the direct ancestor of a child table
|
@@ -426,7 +427,7 @@ module Partitioned
|
|
426
427
|
|
427
428
|
it "returns parent_table_schema_name" do
|
428
429
|
dsl.parent_table_schema_name("public")
|
429
|
-
dsl.data.parent_table_schema_name.
|
430
|
+
expect(dsl.data.parent_table_schema_name).to eq("public")
|
430
431
|
end
|
431
432
|
|
432
433
|
end # when try to set the schema name of the table who is the direct ancestor of a child table
|
@@ -435,7 +436,7 @@ module Partitioned
|
|
435
436
|
|
436
437
|
it "returns parent_table_schema_name" do
|
437
438
|
dsl.parent_table_schema_name('#{model.table_name}')
|
438
|
-
dsl.data.parent_table_schema_name.
|
439
|
+
expect(dsl.data.parent_table_schema_name).to eq('#{model.table_name}')
|
439
440
|
end
|
440
441
|
|
441
442
|
end # when try to set the schema name represented as a string to be interpolated at run time
|
@@ -450,7 +451,7 @@ module Partitioned
|
|
450
451
|
|
451
452
|
it "returns proc" do
|
452
453
|
dsl.parent_table_schema_name lmd
|
453
|
-
dsl.data.parent_table_schema_name.
|
454
|
+
expect(dsl.data.parent_table_schema_name).to eq(lmd)
|
454
455
|
end
|
455
456
|
|
456
457
|
end # when try to set the schema name(with proc) of the table who is the direct ancestor of a child table
|
@@ -460,4 +461,4 @@ module Partitioned
|
|
460
461
|
end # Dsl
|
461
462
|
end # Configurator
|
462
463
|
end # PartitionedBase
|
463
|
-
end # Partitioned
|
464
|
+
end # Partitioned
|