partitioned 1.3.4 → 1.3.5

Sign up to get free protection for your applications and to get access to all the features.
@@ -24,7 +24,7 @@ module Partitioned
24
24
  let!(:default_reader) { Partitioned::PartitionedBase::Configurator::Reader.new(Employee) }
25
25
  let!(:reader) do
26
26
  reader = Partitioned::PartitionedBase::Configurator::Reader.new(Employee)
27
- reader.stub!(:configurators).and_return([dsl])
27
+ allow(reader).to receive(:configurators).and_return([dsl])
28
28
  reader
29
29
  end
30
30
 
@@ -33,7 +33,7 @@ module Partitioned
33
33
  context "checking arrays length" do
34
34
 
35
35
  it "returns 3" do
36
- default_reader.send(:configurators).length.should == 3
36
+ expect(default_reader.send(:configurators).length).to eq(3)
37
37
  end
38
38
 
39
39
  end # checking array length
@@ -41,15 +41,15 @@ module Partitioned
41
41
  context "checking models class for each of configurators" do
42
42
 
43
43
  it "returns 'Partitioned::ById'" do
44
- default_reader.send(:configurators)[0].model.to_s.should == "Partitioned::ById"
44
+ expect(default_reader.send(:configurators)[0].model.to_s).to eq("Partitioned::ById")
45
45
  end
46
46
 
47
47
  it "returns 'Partitioned::ByIntegerField'" do
48
- default_reader.send(:configurators)[1].model.to_s.should == "Partitioned::ByIntegerField"
48
+ expect(default_reader.send(:configurators)[1].model.to_s).to eq("Partitioned::ByIntegerField")
49
49
  end
50
50
 
51
51
  it "returns 'Partitioned::PartitionedBase'" do
52
- default_reader.send(:configurators)[2].model.to_s.should == "Partitioned::PartitionedBase"
52
+ expect(default_reader.send(:configurators)[2].model.to_s).to eq("Partitioned::PartitionedBase")
53
53
  end
54
54
 
55
55
  end # checking models class for each of configurators
@@ -61,7 +61,7 @@ module Partitioned
61
61
  context "when schema_name value is set by default" do
62
62
 
63
63
  it "returns 'employees_partitions'" do
64
- default_reader.schema_name.should == "employees_partitions"
64
+ expect(default_reader.schema_name).to eq("employees_partitions")
65
65
  end
66
66
 
67
67
  end # when schema_name value is set by default
@@ -70,7 +70,7 @@ module Partitioned
70
70
 
71
71
  it "returns 'employees_partitions'" do
72
72
  dsl.schema_name("employees_partitions")
73
- reader.schema_name.should == "employees_partitions"
73
+ expect(reader.schema_name).to eq("employees_partitions")
74
74
  end
75
75
 
76
76
  end # when schema_name value is set by value
@@ -79,7 +79,7 @@ module Partitioned
79
79
 
80
80
  it "returns 'employees_partitions'" do
81
81
  dsl.schema_name('#{model.table_name}_partitions')
82
- reader.schema_name.should == "employees_partitions"
82
+ expect(reader.schema_name).to eq("employees_partitions")
83
83
  end
84
84
 
85
85
  end # when schema_name value is set by string
@@ -94,7 +94,7 @@ module Partitioned
94
94
 
95
95
  it "returns 'employees_partitions'" do
96
96
  dsl.schema_name lmd
97
- reader.schema_name.should == "employees_partitions"
97
+ expect(reader.schema_name).to eq("employees_partitions")
98
98
  end
99
99
 
100
100
  end # when schema_name value is set by proc
@@ -106,7 +106,7 @@ module Partitioned
106
106
  context "when on_field value is set by default" do
107
107
 
108
108
  it "returns [:id]" do
109
- default_reader.on_fields.should == [:id]
109
+ expect(default_reader.on_fields).to eq([:id])
110
110
  end
111
111
 
112
112
  end # when on_filed value is set by default
@@ -115,7 +115,7 @@ module Partitioned
115
115
 
116
116
  it "returns [:company_id]" do
117
117
  dsl.on :company_id
118
- reader.on_fields.should == [:company_id]
118
+ expect(reader.on_fields).to eq([:company_id])
119
119
  end
120
120
 
121
121
  end # "when on_field value is set by symbol
@@ -124,7 +124,7 @@ module Partitioned
124
124
 
125
125
  it "returns [:id]" do
126
126
  dsl.on '#{model.partition_field}'
127
- reader.on_fields.should == [:id]
127
+ expect(reader.on_fields).to eq([:id])
128
128
  end
129
129
 
130
130
  end # "when on_field value is set by string
@@ -137,7 +137,7 @@ module Partitioned
137
137
 
138
138
  it "returns [:id]" do
139
139
  dsl.on lmd
140
- reader.on_fields.should == [:id]
140
+ expect(reader.on_fields).to eq([:id])
141
141
  end
142
142
 
143
143
  end # "when on_field value is set by proc
@@ -149,7 +149,7 @@ module Partitioned
149
149
  context "when indexes value is set by default" do
150
150
 
151
151
  it "returns { :id => { :unique => true } }" do
152
- default_reader.indexes.should == { :id => { :unique => true } }
152
+ expect(default_reader.indexes).to eq({ :id => { :unique => true } })
153
153
  end
154
154
 
155
155
  end # when indexes value is set by default
@@ -158,7 +158,7 @@ module Partitioned
158
158
 
159
159
  it "returns { :id => { :unique => false } }" do
160
160
  dsl.index(:id, { :unique => false })
161
- reader.indexes.should == { :id => { :unique => false } }
161
+ expect(reader.indexes).to eq({ :id => { :unique => false } })
162
162
  end
163
163
 
164
164
  end # when indexes value is set by values
@@ -173,7 +173,7 @@ module Partitioned
173
173
 
174
174
  it "returns { :id => {} }" do
175
175
  dsl.index lmd
176
- reader.indexes.should == { :id => {} }
176
+ expect(reader.indexes).to eq({ :id => {} })
177
177
  end
178
178
 
179
179
  end # when indexes value is set by proc
@@ -186,9 +186,9 @@ module Partitioned
186
186
 
187
187
  it "returns foreign_keys" do
188
188
  dsl.foreign_key(:company_id)
189
- reader.foreign_keys.first.referenced_field.should == :id
190
- reader.foreign_keys.first.referenced_table.should == "companies"
191
- reader.foreign_keys.first.referencing_field.should == :company_id
189
+ expect(reader.foreign_keys.first.referenced_field).to eq(:id)
190
+ expect(reader.foreign_keys.first.referenced_table).to eq("companies")
191
+ expect(reader.foreign_keys.first.referencing_field).to eq(:company_id)
192
192
  end
193
193
 
194
194
  end # when foreign_keys value is set by symbol
@@ -203,9 +203,9 @@ module Partitioned
203
203
 
204
204
  it "returns foreign_keys" do
205
205
  dsl.foreign_key lmd
206
- reader.foreign_keys.first.referenced_field.should == :id
207
- reader.foreign_keys.first.referenced_table.should == "companies"
208
- reader.foreign_keys.first.referencing_field.should == :company_id
206
+ expect(reader.foreign_keys.first.referenced_field).to eq(:id)
207
+ expect(reader.foreign_keys.first.referenced_table).to eq("companies")
208
+ expect(reader.foreign_keys.first.referencing_field).to eq(:company_id)
209
209
  end
210
210
 
211
211
  end # when foreign_keys value is set by proc
@@ -218,7 +218,7 @@ module Partitioned
218
218
 
219
219
  it "returns 'company_id = 1'" do
220
220
  dsl.check_constraint('company_id = #{field_value}')
221
- reader.check_constraint(1).should == "company_id = 1"
221
+ expect(reader.check_constraint(1)).to eq("company_id = 1")
222
222
  end
223
223
 
224
224
  end # when check_constraint value is set by string
@@ -233,7 +233,7 @@ module Partitioned
233
233
 
234
234
  it "returns 'id = 1'" do
235
235
  dsl.check_constraint lmd
236
- reader.check_constraint(1).should == "id = 1"
236
+ expect(reader.check_constraint(1)).to eq("id = 1")
237
237
  end
238
238
 
239
239
  end # when check_constraint value is set by proc
@@ -245,7 +245,7 @@ module Partitioned
245
245
  context "when parent_table_name value is set by default" do
246
246
 
247
247
  it "returns employees" do
248
- default_reader.parent_table_name.should == "employees"
248
+ expect(default_reader.parent_table_name).to eq("employees")
249
249
  end
250
250
 
251
251
  end # when parent_table_name value is set by default
@@ -254,7 +254,7 @@ module Partitioned
254
254
 
255
255
  it "returns employees" do
256
256
  dsl.parent_table_name("employees")
257
- reader.parent_table_name.should == "employees"
257
+ expect(reader.parent_table_name).to eq("employees")
258
258
  end
259
259
 
260
260
  end # when parent_table_name value is set by value
@@ -263,7 +263,7 @@ module Partitioned
263
263
 
264
264
  it "returns employees" do
265
265
  dsl.parent_table_name('#{model.table_name}')
266
- reader.parent_table_name.should == "employees"
266
+ expect(reader.parent_table_name).to eq("employees")
267
267
  end
268
268
 
269
269
  end # when parent_table_name value is set by string
@@ -278,7 +278,7 @@ module Partitioned
278
278
 
279
279
  it "returns employees" do
280
280
  dsl.parent_table_name lmd
281
- reader.parent_table_name.should == "employees"
281
+ expect(reader.parent_table_name).to eq("employees")
282
282
  end
283
283
 
284
284
  end # when parent_table_name value is set by proc
@@ -290,7 +290,7 @@ module Partitioned
290
290
  context "when parent_table_schema_name value is set by default" do
291
291
 
292
292
  it "returns public" do
293
- default_reader.parent_table_schema_name.should == "public"
293
+ expect(default_reader.parent_table_schema_name).to eq("public")
294
294
  end
295
295
 
296
296
  end # when parent_table_schema_name value is set by default
@@ -299,7 +299,7 @@ module Partitioned
299
299
 
300
300
  it "returns employees" do
301
301
  dsl.parent_table_schema_name("employees")
302
- reader.parent_table_schema_name.should == "employees"
302
+ expect(reader.parent_table_schema_name).to eq("employees")
303
303
  end
304
304
 
305
305
  end # when parent_table_schema_name value is set by value
@@ -308,7 +308,7 @@ module Partitioned
308
308
 
309
309
  it "returns employees" do
310
310
  dsl.parent_table_schema_name('#{model.table_name}')
311
- reader.parent_table_schema_name.should == "employees"
311
+ expect(reader.parent_table_schema_name).to eq("employees")
312
312
  end
313
313
 
314
314
  end # when parent_table_schema_name value is set by string
@@ -323,7 +323,7 @@ module Partitioned
323
323
 
324
324
  it "returns employees" do
325
325
  dsl.parent_table_schema_name lmd
326
- reader.parent_table_schema_name.should == "employees"
326
+ expect(reader.parent_table_schema_name).to eq("employees")
327
327
  end
328
328
 
329
329
  end # when parent_table_schema_name value is set by proc
@@ -335,7 +335,7 @@ module Partitioned
335
335
  context "when table_name value is set by default" do
336
336
 
337
337
  it "returns employees_partitions.p10000000" do
338
- default_reader.table_name(10000000).should == "employees_partitions.p10000000"
338
+ expect(default_reader.table_name(10000000)).to eq("employees_partitions.p10000000")
339
339
  end
340
340
 
341
341
  end # when table_name value is set by default
@@ -344,7 +344,7 @@ module Partitioned
344
344
 
345
345
  it "returns employees_partitions.p42" do
346
346
  dsl.table_name("employees_partitions.p42")
347
- reader.table_name.should == "employees_partitions.p42"
347
+ expect(reader.table_name(57)).to eq("employees_partitions.p42")
348
348
  end
349
349
 
350
350
  end # when table_name value is set by value
@@ -353,7 +353,7 @@ module Partitioned
353
353
 
354
354
  it "returns employees_partitions.employees_child_10000000" do
355
355
  dsl.table_name('#{model.table_name}_partitions.#{model.table_name}_child_#{model.partition_normalize_key_value(field_value)}')
356
- reader.table_name(10000000).should == "employees_partitions.employees_child_10000000"
356
+ expect(reader.table_name(10000000)).to eq("employees_partitions.employees_child_10000000")
357
357
  end
358
358
 
359
359
  end # when table_name value is set by string
@@ -368,7 +368,7 @@ module Partitioned
368
368
 
369
369
  it "returns employees_partitions.employees_child_10000000" do
370
370
  dsl.table_name lmd
371
- reader.table_name(10000000).should == "employees_partitions.employees_child_10000000"
371
+ expect(reader.table_name(10000000)).to eq("employees_partitions.employees_child_10000000")
372
372
  end
373
373
 
374
374
  end # when table_name value is set by proc
@@ -381,7 +381,7 @@ module Partitioned
381
381
 
382
382
  it "returns 42" do
383
383
  dsl.base_name("42")
384
- reader.base_name.should == "42"
384
+ expect(reader.base_name).to eq("42")
385
385
  end
386
386
 
387
387
  end # when base_name value is set by value
@@ -390,7 +390,7 @@ module Partitioned
390
390
 
391
391
  it "returns 10000000" do
392
392
  dsl.base_name('#{model.partition_normalize_key_value(field_value)}')
393
- reader.base_name(10000000).should == "10000000"
393
+ expect(reader.base_name(10000000)).to eq("10000000")
394
394
  end
395
395
 
396
396
  end # when base_name value is set by string
@@ -405,7 +405,7 @@ module Partitioned
405
405
 
406
406
  it "returns 10000000" do
407
407
  dsl.base_name lmd
408
- reader.base_name(10000000).should == "10000000"
408
+ expect(reader.base_name(10000000)).to eq("10000000")
409
409
  end
410
410
 
411
411
  end # when base_name value is set by proc
@@ -417,7 +417,7 @@ module Partitioned
417
417
  context "when name_prefix value is set by default" do
418
418
 
419
419
  it "returns 'p'" do
420
- default_reader.name_prefix.should == "p"
420
+ expect(default_reader.name_prefix).to eq("p")
421
421
  end
422
422
 
423
423
  end # when name_prefix value is set by default
@@ -426,7 +426,7 @@ module Partitioned
426
426
 
427
427
  it "returns 'p'" do
428
428
  dsl.name_prefix("p")
429
- reader.name_prefix.should == "p"
429
+ expect(reader.name_prefix).to eq("p")
430
430
  end
431
431
 
432
432
  end # when name_prefix value is set by value
@@ -435,7 +435,7 @@ module Partitioned
435
435
 
436
436
  it "returns 'employees_child_'" do
437
437
  dsl.name_prefix('#{model.table_name}_child_')
438
- reader.name_prefix.should == "employees_child_"
438
+ expect(reader.name_prefix).to eq("employees_child_")
439
439
  end
440
440
 
441
441
  end # when name_prefix value is set by string
@@ -450,7 +450,7 @@ module Partitioned
450
450
 
451
451
  it "returns 'employees_child_'" do
452
452
  dsl.name_prefix lmd
453
- reader.name_prefix.should == "employees_child_"
453
+ expect(reader.name_prefix).to eq("employees_child_")
454
454
  end
455
455
 
456
456
  end # when name_prefix value is set by proc
@@ -463,7 +463,7 @@ module Partitioned
463
463
 
464
464
  it "returns 'p42'" do
465
465
  dsl.part_name("p42")
466
- reader.part_name.should == "p42"
466
+ expect(reader.part_name).to eq("p42")
467
467
  end
468
468
 
469
469
  end # when part_name value is set by value
@@ -472,7 +472,7 @@ module Partitioned
472
472
 
473
473
  it "returns 'employees_child_10000000'" do
474
474
  dsl.part_name('#{model.table_name}_child_#{model.partition_normalize_key_value(field_value)}')
475
- reader.part_name(10000000).should == "employees_child_10000000"
475
+ expect(reader.part_name(10000000)).to eq("employees_child_10000000")
476
476
  end
477
477
 
478
478
  end # when part_name value is set by string
@@ -487,7 +487,7 @@ module Partitioned
487
487
 
488
488
  it "returns 'employees_child_10000000'" do
489
489
  dsl.part_name lmd
490
- reader.part_name(10000000).should == "employees_child_10000000"
490
+ expect(reader.part_name(10000000)).to eq("employees_child_10000000")
491
491
  end
492
492
 
493
493
  end # when part_name value is set by proc
@@ -500,7 +500,7 @@ module Partitioned
500
500
 
501
501
  it "returns 'tablename desc'" do
502
502
  dsl.order('tablename desc')
503
- reader.last_partitions_order_by_clause.should == "tablename desc"
503
+ expect(reader.last_partitions_order_by_clause).to eq("tablename desc")
504
504
  end
505
505
 
506
506
  end # when order value is set by value
@@ -510,4 +510,4 @@ module Partitioned
510
510
  end # Reader
511
511
  end # Configurator
512
512
  end # PartitionedBase
513
- end # Partitioned
513
+ end # Partitioned
@@ -90,14 +90,14 @@ module Partitioned
90
90
  WHERE specific_schema NOT IN ('pg_catalog', 'information_schema')
91
91
  AND type_udt_name != 'trigger';
92
92
  SQL
93
- result.values.first.should == ["always_fail_on_insert"]
93
+ expect(result.values.first).to eq ["always_fail_on_insert"]
94
94
  end
95
95
  end # ensure_always_fail_on_insert_exists
96
96
 
97
97
  describe "create_partition_schema" do
98
98
  it "created schema" do
99
99
  sql_adapter.create_partition_schema
100
- check_existence_schema.values.should_not be_blank
100
+ expect(check_existence_schema.values).not_to be_blank
101
101
  end
102
102
  end # create_partition_schema
103
103
 
@@ -105,7 +105,7 @@ module Partitioned
105
105
 
106
106
  context "when partition table don't exist" do
107
107
  it "returns false" do
108
- sql_adapter.partition_exists?(1).should be_false
108
+ expect(sql_adapter.partition_exists?(1)).to be false
109
109
  end
110
110
  end # when partition table don't exist
111
111
 
@@ -113,7 +113,7 @@ module Partitioned
113
113
  it "returns true" do
114
114
  create_new_schema
115
115
  create_new_partition_table
116
- sql_adapter.partition_exists?(1).should be_true
116
+ expect(sql_adapter.partition_exists?(1)).to be true
117
117
  end
118
118
  end # when partition table exist
119
119
  end # partition_exists?
@@ -122,7 +122,7 @@ module Partitioned
122
122
 
123
123
  context "when partition table don't exist" do
124
124
  it "returns empty array" do
125
- sql_adapter.last_n_partition_names.should == []
125
+ expect(sql_adapter.last_n_partition_names).to be_empty
126
126
  end
127
127
  end # when partition table don't exist
128
128
 
@@ -130,7 +130,7 @@ module Partitioned
130
130
  it "returns partition table name" do
131
131
  create_new_schema
132
132
  create_new_partition_table
133
- sql_adapter.last_n_partition_names.should == ["p1"]
133
+ expect(sql_adapter.last_n_partition_names).to eq ["p1"]
134
134
  end
135
135
  end # when partition table exist
136
136
  end
@@ -139,10 +139,10 @@ module Partitioned
139
139
  context "when try to insert row into table with rules" do
140
140
  it "raises ActiveRecord::StatementInvalid" do
141
141
  sql_adapter.add_parent_table_rules
142
- lambda { ActiveRecord::Base.connection.execute <<-SQL
142
+ expect(lambda { ActiveRecord::Base.connection.execute <<-SQL
143
143
  insert into employee (name) values ('name');
144
144
  SQL
145
- }.should raise_error(ActiveRecord::StatementInvalid)
145
+ }).to raise_error(ActiveRecord::StatementInvalid)
146
146
  end
147
147
  end # when try to insert row into table with rules
148
148
  end # add_parent_table_rules
@@ -150,10 +150,10 @@ module Partitioned
150
150
  describe "create_partition_table" do
151
151
  it "created partition table" do
152
152
  create_new_schema
153
- lambda {
153
+ expect(lambda {
154
154
  sql_adapter.create_partition_table(1)
155
- }.should_not raise_error
156
- check_existence_table.values.sort.should == [["employees"], ["p1"]].sort
155
+ }).not_to raise_error
156
+ expect(check_existence_table.values.sort).to eq [["employees"], ["p1"]].sort
157
157
  end
158
158
  end # create_partition_table
159
159
 
@@ -162,7 +162,7 @@ module Partitioned
162
162
  create_new_schema
163
163
  sql_adapter.create_partition_table(1)
164
164
  sql_adapter.drop_partition_table(1)
165
- check_existence_table.values.should == [["employees"]]
165
+ expect(check_existence_table.values).to eq [["employees"]]
166
166
  end
167
167
  end # drop_partition_table
168
168
 
@@ -175,7 +175,7 @@ module Partitioned
175
175
  SELECT count(*) FROM pg_class
176
176
  where relname = 'p1_id_udx'
177
177
  SQL
178
- result.values.should == [["1"]]
178
+ expect(result.values).to eq [["1"]]
179
179
  end
180
180
  end # add_partition_table_index
181
181
 
@@ -195,10 +195,10 @@ module Partitioned
195
195
  SELECT constraint_type FROM information_schema.table_constraints
196
196
  WHERE table_name = 'p1' AND constraint_name = 'p1_company_id_fkey';
197
197
  SQL
198
- result.values.first.should == ["FOREIGN KEY"]
198
+ expect(result.values.first).to eq ["FOREIGN KEY"]
199
199
  end
200
200
  end # add_references_to_partition_table
201
201
 
202
202
  end # SqlAdapter
203
203
  end # PartitionedBase
204
- end # Partitioned
204
+ end # Partitioned
@@ -17,7 +17,7 @@ module Partitioned
17
17
  describe "model is abstract class" do
18
18
 
19
19
  it "returns true" do
20
- class_partitioned_base.abstract_class.should be_true
20
+ expect(class_partitioned_base.abstract_class).to be_truthy
21
21
  end
22
22
 
23
23
  end # model is abstract class
@@ -31,7 +31,7 @@ module Partitioned
31
31
  context "checks data in the schema_name" do
32
32
 
33
33
  it "returns schema_name" do
34
- data.schema_name.call(Employee).should == "employees_partitions"
34
+ expect(data.schema_name.call(Employee)).to eq("employees_partitions")
35
35
  end
36
36
 
37
37
  end # checks data in the schema_name
@@ -39,7 +39,7 @@ module Partitioned
39
39
  context "checks data in the parent_table_name" do
40
40
 
41
41
  it "returns parent_table_name" do
42
- data.parent_table_name.call(Employee).should == "employees"
42
+ expect(data.parent_table_name.call(Employee)).to eq("employees")
43
43
  end
44
44
 
45
45
  end # checks data in the parent_table_name
@@ -47,7 +47,7 @@ module Partitioned
47
47
  context "checks data in the parent_table_schema_name" do
48
48
 
49
49
  it "returns parent_table_schema_name" do
50
- data.parent_table_schema_name.call(Employee).should == "public"
50
+ expect(data.parent_table_schema_name.call(Employee)).to eq("public")
51
51
  end
52
52
 
53
53
  end # checks data in the parent_table_schema_name
@@ -55,7 +55,7 @@ module Partitioned
55
55
  context "checks data in the name_prefix" do
56
56
 
57
57
  it "returns name_prefix" do
58
- data.name_prefix.call(Employee).should == "p"
58
+ expect(data.name_prefix.call(Employee)).to eq("p")
59
59
  end
60
60
 
61
61
  end # checks data in the name_prefix
@@ -63,7 +63,7 @@ module Partitioned
63
63
  context "checks data in the part_name" do
64
64
 
65
65
  it "returns part_name" do
66
- data.part_name.call(Employee, 1).should == "p1"
66
+ expect(data.part_name.call(Employee, 1)).to eq("p1")
67
67
  end
68
68
 
69
69
  end # checks data in the part_name
@@ -71,7 +71,7 @@ module Partitioned
71
71
  context "checks data in the table_name" do
72
72
 
73
73
  it "returns table_name" do
74
- data.table_name.call(Employee, 1).should == "employees_partitions.p1"
74
+ expect(data.table_name.call(Employee, 1)).to eq("employees_partitions.p1")
75
75
  end
76
76
 
77
77
  end # checks data in the table_name
@@ -79,7 +79,7 @@ module Partitioned
79
79
  context "checks data in the base_name" do
80
80
 
81
81
  it "returns base_name" do
82
- data.base_name.call(Employee, 1).should == "1"
82
+ expect(data.base_name.call(Employee, 1)).to eq("1")
83
83
  end
84
84
 
85
85
  end # checks data in the base_name
@@ -88,13 +88,13 @@ module Partitioned
88
88
  context "#partition_key_values" do
89
89
 
90
90
  before do
91
- class_partitioned_base.stub!(:partition_keys).and_return([:id])
91
+ allow(class_partitioned_base).to receive(:partition_keys).and_return([:id])
92
92
  end
93
93
 
94
94
  context "call method with key that represented as a string" do
95
95
 
96
96
  it "returns values" do
97
- class_partitioned_base.partition_key_values( "id" => 1 ).should == [1]
97
+ expect(class_partitioned_base.partition_key_values( "id" => 1 )).to eq([1])
98
98
  end
99
99
 
100
100
  end # call method with key that represented as a string
@@ -102,7 +102,7 @@ module Partitioned
102
102
  context "call method with key that represented as a symbol" do
103
103
 
104
104
  it "returns values" do
105
- class_partitioned_base.partition_key_values( :id => 2 ).should == [2]
105
+ expect(class_partitioned_base.partition_key_values( :id => 2 )).to eq([2])
106
106
  end
107
107
 
108
108
  end # call method with key that represented as a symbol
@@ -120,7 +120,7 @@ module Partitioned
120
120
  name text not null
121
121
  );
122
122
  SQL
123
- Employee.stub!(:partition_keys).and_return([:id])
123
+ allow(Employee).to receive(:partition_keys).and_return([:id])
124
124
  @employee = Employee.new
125
125
  end
126
126
 
@@ -129,8 +129,8 @@ module Partitioned
129
129
  context "call method with attributes key that represented as a string" do
130
130
 
131
131
  it "returns employees_partitions.p1" do
132
- @employee.stub!(:attributes).and_return("id" => 1)
133
- @employee.partition_table_name.should == "employees_partitions.p1"
132
+ allow(@employee).to receive(:attributes).and_return("id" => 1)
133
+ expect(@employee.partition_table_name).to eq("employees_partitions.p1")
134
134
  end
135
135
 
136
136
  end # call method with attributes key that represented as a string
@@ -138,8 +138,8 @@ module Partitioned
138
138
  context "call method with attributes key that represented as a symbol" do
139
139
 
140
140
  it "returns employees_partitions.p2" do
141
- @employee.stub!(:attributes).and_return(:id => 2)
142
- @employee.partition_table_name.should == "employees_partitions.p2"
141
+ allow(@employee).to receive(:attributes).and_return(:id => 2)
142
+ expect(@employee.partition_table_name).to eq("employees_partitions.p2")
143
143
  end
144
144
 
145
145
  end # call method with attributes key that represented as a symbol
@@ -151,8 +151,8 @@ module Partitioned
151
151
  context "call method with attributes key that represented as a string" do
152
152
 
153
153
  it "returns arel table name employees_partitions.p1" do
154
- @employee.stub!(:attributes).and_return("id" => 1)
155
- @employee.dynamic_arel_table.name.should == "employees_partitions.p1"
154
+ allow(@employee).to receive(:attributes).and_return("id" => 1)
155
+ expect(@employee.dynamic_arel_table.name).to eq("employees_partitions.p1")
156
156
  end
157
157
 
158
158
  end # call method with attributes key that represented as a string
@@ -160,8 +160,8 @@ module Partitioned
160
160
  context "call method with attributes key that represented as a symbol" do
161
161
 
162
162
  it "returns arel table name employees_partitions.p2" do
163
- @employee.stub!(:attributes).and_return(:id => 2)
164
- @employee.dynamic_arel_table.name.should == "employees_partitions.p2"
163
+ allow(@employee).to receive(:attributes).and_return(:id => 2)
164
+ expect(@employee.dynamic_arel_table.name).to eq("employees_partitions.p2")
165
165
  end
166
166
 
167
167
  end # call method with attributes key that represented as a symbol
data/spec/spec_helper.rb CHANGED
@@ -2,7 +2,6 @@
2
2
  ENV["RAILS_ENV"] ||= 'test'
3
3
  require File.expand_path("../dummy/config/environment", __FILE__)
4
4
  require 'rspec/rails'
5
- require 'rspec/autorun'
6
5
 
7
6
  # Requires supporting ruby files with custom matchers and macros, etc,
8
7
  # in spec/support/ and its subdirectories.
@@ -29,4 +28,15 @@ RSpec.configure do |config|
29
28
  # automatically. This will be the default behavior in future versions of
30
29
  # rspec-rails.
31
30
  config.infer_base_class_for_anonymous_controllers = false
31
+
32
+ # rspec-rails 3 will no longer automatically infer an example group's spec type
33
+ # from the file location. You can explicitly opt-in to the feature using this
34
+ # config option.
35
+ # To explicitly tag specs without using automatic inference, set the `:type`
36
+ # metadata manually:
37
+ #
38
+ # describe ThingsController, :type => :controller do
39
+ # # Equivalent to being in spec/controllers
40
+ # end
41
+ config.infer_spec_type_from_file_location!
32
42
  end