postgres_ext 1.0.0 → 2.0.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (72) hide show
  1. checksums.yaml +4 -4
  2. data/Gemfile +1 -1
  3. data/README.md +6 -47
  4. data/lib/postgres_ext/active_record/relation/predicate_builder.rb +36 -55
  5. data/lib/postgres_ext/active_record/relation/query_methods.rb +0 -14
  6. data/lib/postgres_ext/active_record.rb +0 -3
  7. data/lib/postgres_ext/version.rb +1 -1
  8. data/postgres_ext.gemspec +6 -5
  9. data/spec/arel/arel_spec.rb +0 -1
  10. data/spec/dummy/app/models/person.rb +0 -1
  11. data/spec/dummy/config/application.rb +0 -3
  12. data/spec/dummy/config/environments/development.rb +2 -7
  13. data/spec/dummy/config/environments/production.rb +1 -0
  14. data/spec/dummy/config/environments/test.rb +1 -5
  15. data/spec/dummy/db/migrate/20120501163758_create_people.rb +3 -3
  16. data/spec/dummy/db/schema.rb +15 -12
  17. data/spec/queries/sanity_spec.rb +1 -1
  18. data/spec/spec_helper.rb +1 -2
  19. metadata +21 -105
  20. data/docs/indexes.md +0 -28
  21. data/docs/migrations.md +0 -92
  22. data/docs/type_casting.md +0 -70
  23. data/lib/postgres_ext/active_record/connection_adapters/postgres_adapter.rb +0 -537
  24. data/lib/postgres_ext/active_record/connection_adapters.rb +0 -1
  25. data/lib/postgres_ext/active_record/sanitization.rb +0 -30
  26. data/lib/postgres_ext/active_record/schema_dumper.rb +0 -157
  27. data/spec/columns/array_spec.rb +0 -119
  28. data/spec/columns/inet_spec.rb +0 -25
  29. data/spec/columns/ranges/daterange_spec.rb +0 -37
  30. data/spec/columns/ranges/int4range_spec.rb +0 -38
  31. data/spec/columns/ranges/int8range_spec.rb +0 -38
  32. data/spec/columns/ranges/numrange_spec.rb +0 -37
  33. data/spec/columns/ranges/tsrange_spec.rb +0 -37
  34. data/spec/migrations/active_record_migration_spec.rb +0 -29
  35. data/spec/migrations/array_spec.rb +0 -214
  36. data/spec/migrations/cidr_spec.rb +0 -26
  37. data/spec/migrations/citext_spec.rb +0 -32
  38. data/spec/migrations/ean13_spec.rb +0 -27
  39. data/spec/migrations/index_spec.rb +0 -67
  40. data/spec/migrations/inet_spec.rb +0 -26
  41. data/spec/migrations/macaddr_spec.rb +0 -26
  42. data/spec/migrations/ranges/daterange_spec.rb +0 -27
  43. data/spec/migrations/ranges/int4range_spec.rb +0 -27
  44. data/spec/migrations/ranges/int8range_spec.rb +0 -27
  45. data/spec/migrations/ranges/numrange_spec.rb +0 -27
  46. data/spec/migrations/ranges/tsrange_spec.rb +0 -27
  47. data/spec/migrations/ranges/tstzrange_spec.rb +0 -27
  48. data/spec/migrations/uuid_spec.rb +0 -26
  49. data/spec/models/array_spec.rb +0 -285
  50. data/spec/models/ean13_spec.rb +0 -57
  51. data/spec/models/inet_spec.rb +0 -88
  52. data/spec/models/ranges/daterange_spec.rb +0 -88
  53. data/spec/models/ranges/int4range_spec.rb +0 -85
  54. data/spec/models/ranges/int8range_spec.rb +0 -85
  55. data/spec/models/ranges/numrange_spec.rb +0 -85
  56. data/spec/models/ranges/tsrange_spec.rb +0 -89
  57. data/spec/models/ranges/tstzrange_spec.rb +0 -89
  58. data/spec/schema_dumper/array_spec.rb +0 -17
  59. data/spec/schema_dumper/cidr_spec.rb +0 -17
  60. data/spec/schema_dumper/citext_spec.rb +0 -17
  61. data/spec/schema_dumper/ean13_spec.rb +0 -17
  62. data/spec/schema_dumper/extension_spec.rb +0 -14
  63. data/spec/schema_dumper/index_spec.rb +0 -46
  64. data/spec/schema_dumper/inet_spec.rb +0 -17
  65. data/spec/schema_dumper/macaddr_spec.rb +0 -17
  66. data/spec/schema_dumper/ranges/daterange_spec.rb +0 -18
  67. data/spec/schema_dumper/ranges/int4range_spec.rb +0 -18
  68. data/spec/schema_dumper/ranges/int8range_spec.rb +0 -18
  69. data/spec/schema_dumper/ranges/numrange_spec.rb +0 -18
  70. data/spec/schema_dumper/ranges/tsrange_spec.rb +0 -18
  71. data/spec/schema_dumper/ranges/tstzrange_spec.rb +0 -17
  72. data/spec/schema_dumper/uuid_spec.rb +0 -17
@@ -1,285 +0,0 @@
1
- require 'spec_helper'
2
-
3
- describe 'Models with array columns' do
4
- let!(:adapter) { ActiveRecord::Base.connection }
5
-
6
- context 'no default value, string array' do
7
- before do
8
- adapter.create_table :users, :force => true do |t|
9
- t.string :nick_names, :array => true
10
- t.integer :favorite_numbers, :array => true
11
-
12
- t.timestamps
13
- end
14
-
15
- class User < ActiveRecord::Base
16
- attr_accessible :nick_names, :favorite_numbers
17
- end
18
- end
19
-
20
- after do
21
- adapter.drop_table :users
22
- Object.send(:remove_const, :User)
23
- end
24
-
25
- context 'no default value, string array' do
26
- describe '#create' do
27
- it 'creates a user when there is no array assignment' do
28
- u = User.create()
29
- u.reload
30
- u.nick_names.should eq nil
31
- end
32
-
33
- it 'creates a user with an empty array' do
34
- u = User.create(:nick_names => [])
35
- u.reload
36
- u.nick_names.should eq []
37
- end
38
-
39
- it 'creates a user with an array of some values' do
40
- u = User.create(:nick_names => ['some', 'things'])
41
- u.reload
42
- u.nick_names.should eq ['some', 'things']
43
- end
44
-
45
- it 'creates a user with an int array of some values' do
46
- u = User.create(:favorite_numbers => [2,3,5])
47
- u.reload
48
- u.favorite_numbers.should eq [2,3,5]
49
- end
50
-
51
- it 'creates a user with an int array of string values' do
52
- u = User.create(:favorite_numbers => ['2','3','5'])
53
- u.reload
54
- u.favorite_numbers.should eq [2,3,5]
55
- end
56
- end
57
- end
58
-
59
- context 'Setting values' do
60
- it 'returns the value set when the record is retrieved' do
61
- u = User.create(:nick_names => ['some', 'things'])
62
- u.reload
63
-
64
- u.nick_names = ['different', 'values']
65
- u.save
66
-
67
- u.reload
68
- u.nick_names.should eq ['different', 'values']
69
- end
70
-
71
- it 'creates a user with an int array of some values' do
72
- u = User.create(:favorite_numbers => [2,3,5])
73
- u.reload
74
-
75
- u.favorite_numbers = [1,2,3]
76
- u.save
77
-
78
- u.reload
79
- u.favorite_numbers.should eq [1,2,3]
80
- end
81
- end
82
-
83
- context '#update_attribute' do
84
- describe 'setting a value via update_attribute' do
85
- it 'returns the value set when the record is retrieved' do
86
- user = User.create(:nick_names => [])
87
- user.reload
88
-
89
- user.update_attribute(:nick_names, ['some', 'values'])
90
- user.save
91
-
92
- user.reload
93
- user.nick_names.should eq ['some', 'values']
94
- end
95
- end
96
- end
97
-
98
- context '#<column>? do' do
99
- describe 'checking a value via <attribute_name>? 'do
100
- it 'returns false if it\'s an empty array' do
101
- user = User.create(:nick_names => [], :favorite_numbers => [])
102
- user.reload
103
-
104
- user.nick_names?.should be_false
105
- user.favorite_numbers?.should be_false
106
- end
107
-
108
- it 'returns false if it\'s an empty array' do
109
- user = User.create(:nick_names => ['bob'], :favorite_numbers => [0])
110
- user.reload
111
-
112
- user.nick_names?.should be_true
113
- user.favorite_numbers?.should be_true
114
- end
115
- end
116
- end
117
-
118
- context '#update_column' do
119
- describe 'setting a value via update_column' do
120
- it 'returns the value set when the record is retrieved' do
121
- user = User.create(:nick_names => [])
122
- user.reload
123
-
124
- user.update_column(:nick_names, ['some', 'values'])
125
- user.save
126
-
127
- user.reload
128
- user.nick_names.should eq ['some', 'values']
129
- end
130
- end
131
- end
132
-
133
- context '#update_attributes' do
134
- describe 'setting a value via update_attributes' do
135
- it 'returns the value set when the record is retrieved' do
136
- user = User.create(:nick_names => [])
137
- user.reload
138
-
139
- user.update_attributes(:nick_names => ['some', 'values'])
140
- user.save
141
-
142
- user.reload
143
- user.nick_names.should eq ['some', 'values']
144
- end
145
- end
146
- end
147
-
148
- describe 'strings contain special characters' do
149
- context '#save' do
150
- it 'contains: \'' do
151
- data = ['some\'thing']
152
- u = User.create
153
- u.nick_names = data
154
- u.save!
155
- u.reload
156
- u.nick_names.should eq data
157
- end
158
-
159
- it 'contains: {' do
160
- data = ['some{thing']
161
- u = User.create
162
- u.nick_names = data
163
- u.save!
164
- u.reload
165
- u.nick_names.should eq data
166
- end
167
-
168
- it 'contains: }' do
169
- data = ['some}thing']
170
- u = User.create
171
- u.nick_names = data
172
- u.save!
173
- u.reload
174
- u.nick_names.should eq data
175
- end
176
-
177
- it 'contains: backslash' do
178
- data = ['some\\thing']
179
- u = User.create
180
- u.nick_names = data
181
- u.save!
182
- u.reload
183
- u.nick_names.should eq data
184
- end
185
-
186
- it 'contains: "' do
187
- data = ['some"thing']
188
- u = User.create
189
- u.nick_names = data
190
- u.save!
191
- u.reload
192
- u.nick_names.should eq data
193
- end
194
- end
195
-
196
- context '#create' do
197
- it 'contains: \'' do
198
- data = ['some\'thing']
199
- u = User.create(:nick_names => data)
200
- u.reload
201
- u.nick_names.should eq data
202
- end
203
-
204
- it 'contains: {' do
205
- data = ['some{thing']
206
- u = User.create(:nick_names => data)
207
- u.reload
208
- u.nick_names.should eq data
209
- end
210
-
211
- it 'contains: }' do
212
- data = ['some}thing']
213
- u = User.create(:nick_names => data)
214
- u.reload
215
- u.nick_names.should eq data
216
- end
217
-
218
- it 'contains: backslash' do
219
- data = ['some\\thing']
220
- u = User.create(:nick_names => data)
221
- u.reload
222
- u.nick_names.should eq data
223
- end
224
-
225
- it 'contains: "' do
226
- data = ['some"thing']
227
- u = User.create(:nick_names => data)
228
- u.reload
229
- u.nick_names.should eq data
230
- end
231
- end
232
- end
233
-
234
- describe 'overlap' do
235
- it "works" do
236
- arel = User.arel_table
237
- User.create(:nick_names => ['this'])
238
- x = User.create
239
- x.nick_names = ["s'o{m}e", 'thing']
240
- x.save
241
- u = User.where(arel[:nick_names].overlap(["s'o{m}e"]))
242
- u.first.should_not be_nil
243
- u.first.nick_names.should eq ["s'o{m}e", 'thing']
244
- end
245
- end
246
- end
247
-
248
- context 'default values' do
249
- before do
250
- adapter.create_table :defaulted_users, :force => true do |t|
251
- t.string :nick_names, :array => true, :default => '{}'
252
- end
253
- class DefaultedUser < ActiveRecord::Base
254
- attr_accessible :nick_names
255
- end
256
- end
257
-
258
- after do
259
- adapter.drop_table :defaulted_users
260
- Object.send(:remove_const, :DefaultedUser)
261
- end
262
-
263
- context 'model creation' do
264
- describe '#create' do
265
- it 'creates a user when there is no array assignment' do
266
- u = DefaultedUser.create()
267
- u.reload
268
- u.nick_names.should eq []
269
- end
270
-
271
- it 'creates a user with an nil' do
272
- u = DefaultedUser.create(:nick_names => nil)
273
- u.reload
274
- u.nick_names.should eq nil
275
- end
276
-
277
- it 'creates a user with an array of some values' do
278
- u = DefaultedUser.create(:nick_names => ['some', 'things'])
279
- u.reload
280
- u.nick_names.should eq ['some', 'things']
281
- end
282
- end
283
- end
284
- end
285
- end
@@ -1,57 +0,0 @@
1
- require 'spec_helper'
2
-
3
- describe 'Models with ean13 columns' do
4
- let!(:adapter) { ActiveRecord::Base.connection }
5
-
6
- context 'no default value, ean' do
7
- before do
8
- adapter.create_table :books, :force => true do |t|
9
- t.ean13 :ean
10
- end
11
-
12
- class Book < ActiveRecord::Base
13
- attr_accessible :ean
14
- end
15
- end
16
-
17
- after do
18
- adapter.drop_table :books
19
- Object.send(:remove_const, :Book)
20
- end
21
-
22
- context 'no default value, ean' do
23
- describe '#create' do
24
- it 'create a book when there is no ean assignment' do
25
- book = Book.create()
26
- book.reload
27
- book.ean.should eq nil
28
- end
29
-
30
- it 'creates a book with an ean string' do
31
- book = Book.create(:ean => '9780312174910')
32
- book.reload
33
- book.ean.should eq '978-0-312-17491-0'
34
- end
35
- end
36
-
37
- describe 'ean assignment' do
38
- it 'updates a book with an ean string' do
39
- book = Book.create(:ean => '9783037781265')
40
- book.ean = '9780312174910'
41
- book.save
42
-
43
- book.reload
44
- book.ean.should eq '978-0-312-17491-0'
45
- end
46
- end
47
-
48
- describe 'find_by_ean' do
49
- let!(:ean) { Book.create(:ean => '9783037781265') }
50
-
51
- it 'finds book using string value' do
52
- Book.find_by_ean('9783037781265').should eq ean
53
- end
54
- end
55
- end
56
- end
57
- end
@@ -1,88 +0,0 @@
1
- require 'spec_helper'
2
-
3
- describe 'Models with inet columns' do
4
- let!(:adapter) { ActiveRecord::Base.connection }
5
-
6
- context 'no default value, inet' do
7
- before do
8
- adapter.create_table :addresses, :force => true do |t|
9
- t.inet :ip_address
10
- end
11
- class Address < ActiveRecord::Base
12
- attr_accessible :ip_address
13
- end
14
- end
15
-
16
- after do
17
- adapter.drop_table :addresses
18
- Object.send(:remove_const, :Address)
19
- end
20
-
21
- context 'no default value, inet' do
22
- describe '#create' do
23
- it 'creates an address when there is no assignment' do
24
- address = Address.create()
25
- address.reload
26
- address.ip_address.should eq nil
27
- end
28
-
29
- it 'creates an address with an address string' do
30
- address = Address.create( :ip_address => '192.168.0.1')
31
- address.reload
32
- address.ip_address.should eq IPAddr.new('192.168.0.1')
33
- end
34
-
35
- it 'creates an address with an IPAddr' do
36
- ip_addr = IPAddr.new('192.168.0.1')
37
- address = Address.create( :ip_address => ip_addr)
38
- address.reload
39
- address.ip_address.should eq ip_addr
40
- end
41
- end
42
-
43
- describe 'inet assignment' do
44
- it 'updates an address with an address string' do
45
- address = Address.create( :ip_address => '192.168.0.1')
46
- address.ip_address = '192.168.1.2'
47
- address.save
48
-
49
- address.reload
50
- address.ip_address.should eq IPAddr.new('192.168.1.2')
51
- end
52
-
53
- it 'converts empty strings to nil' do
54
- address = Address.create
55
- address.ip_address = ''
56
- address.save
57
-
58
- address.reload
59
- address.ip_address.should eq nil
60
- end
61
-
62
- it 'updates an address with an IPAddr' do
63
- ip_addr_1 = IPAddr.new('192.168.0.1')
64
- ip_addr_2 = IPAddr.new('192.168.1.2')
65
- address = Address.create( :ip_address => ip_addr_1)
66
- address.ip_address = ip_addr_2
67
- address.save
68
-
69
- address.reload
70
- address.ip_address.should eq ip_addr_2
71
- end
72
- end
73
-
74
- describe 'find_by_inet' do
75
- let!(:address) { Address.create(:ip_address => '192.168.0.1') }
76
-
77
- it 'finds address using string value' do
78
- Address.find_by_ip_address('192.168.0.1').should eq address
79
- end
80
-
81
- it 'finds address using IPAddr' do
82
- ip_addr = IPAddr.new '192.168.0.1'
83
- Address.find_by_ip_address(ip_addr).should eq address
84
- end
85
- end
86
- end
87
- end
88
- end
@@ -1,88 +0,0 @@
1
- require 'spec_helper'
2
-
3
- describe 'Models with daterange columns' do
4
- let!(:adapter) { ActiveRecord::Base.connection }
5
-
6
- context 'no default value, range' do
7
- before do
8
- adapter.create_table :date_rangers, :force => true do |t|
9
- t.daterange :best_estimate
10
- end
11
- class DateRanger < ActiveRecord::Base
12
- attr_accessible :best_estimate
13
- end
14
- end
15
-
16
- after do
17
- adapter.drop_table :date_rangers
18
- Object.send(:remove_const, :DateRanger)
19
- end
20
-
21
- describe '#create' do
22
- it 'creates an record when there is no assignment' do
23
- range = DateRanger.create()
24
- range.reload
25
- range.best_estimate.should eq nil
26
- end
27
-
28
- it 'creates an record with a range' do
29
- date_range = Date.new(2011, 01, 01)..Date.new(2012, 01, 31)
30
- range = DateRanger.create( :best_estimate => date_range)
31
- range.reload
32
- range.best_estimate.should eq Date.new(2011, 01, 01)...Date.new(2012, 02, 01)
33
- end
34
- end
35
-
36
- describe 'range assignment' do
37
- it 'updates an record with an range string' do
38
- date_range = Date.new(2011, 01, 01)..Date.new(2012, 01, 31)
39
- new_date_range = Date.new(2012, 01, 01)...Date.new(2012, 02, 01)
40
- range = DateRanger.create( :best_estimate => date_range)
41
- range.best_estimate = new_date_range
42
- range.save
43
-
44
- range.reload
45
- range.best_estimate.should eq new_date_range
46
- end
47
-
48
- it 'converts empty strings to nil' do
49
- range = DateRanger.create
50
- range.best_estimate = ''
51
- range.save
52
-
53
- range.reload
54
- range.best_estimate.should eq nil
55
- end
56
- end
57
- end
58
-
59
- context 'default value, date range' do
60
- before do
61
- adapter.create_table :date_default_rangers, :force => true do |t|
62
- t.daterange :best_estimate, :default => Date.new(2011, 01, 01)..Date.new(2011, 01, 31)
63
- end
64
- class DateDefaultRanger < ActiveRecord::Base
65
- attr_accessible :best_estimate
66
- end
67
- end
68
-
69
- after do
70
- adapter.drop_table :date_default_rangers
71
- Object.send(:remove_const, :DateDefaultRanger)
72
- end
73
-
74
- describe '#create' do
75
- it 'creates an record when there is no assignment' do
76
- range = DateDefaultRanger.create()
77
- range.reload
78
- range.best_estimate.should eq Date.new(2011, 01, 01)...Date.new(2011, 02, 01)
79
- end
80
-
81
- it 'creates an record with a range' do
82
- range = DateDefaultRanger.create(:best_estimate => Date.new(2012, 01, 01)..Date.new(2012, 12, 31))
83
- range.reload
84
- range.best_estimate.should eq Date.new(2012, 01, 01)...Date.new(2013, 01, 01)
85
- end
86
- end
87
- end
88
- end
@@ -1,85 +0,0 @@
1
- require 'spec_helper'
2
-
3
- describe 'Models with int4range range columns' do
4
- let!(:adapter) { ActiveRecord::Base.connection }
5
-
6
- context 'no default value, range' do
7
- before do
8
- adapter.create_table :int4_rangers, :force => true do |t|
9
- t.int4range :best_estimate
10
- end
11
- class Int4Ranger < ActiveRecord::Base
12
- attr_accessible :best_estimate
13
- end
14
- end
15
-
16
- after do
17
- adapter.drop_table :int4_rangers
18
- Object.send(:remove_const, :Int4Ranger)
19
- end
20
-
21
- describe '#create' do
22
- it 'creates an record when there is no assignment' do
23
- range = Int4Ranger.create()
24
- range.reload
25
- range.best_estimate.should eq nil
26
- end
27
-
28
- it 'creates an record with a range' do
29
- range = Int4Ranger.create( :best_estimate => 0..4)
30
- range.reload
31
- range.best_estimate.should eq 0...5
32
- end
33
- end
34
-
35
- describe 'range assignment' do
36
- it 'updates an record with an range string' do
37
- range = Int4Ranger.create( :best_estimate => 0..4)
38
- range.best_estimate = 0...9
39
- range.save
40
-
41
- range.reload
42
- range.best_estimate.should eq 0...9
43
- end
44
-
45
- it 'converts empty strings to nil' do
46
- range = Int4Ranger.create
47
- range.best_estimate = ''
48
- range.save
49
-
50
- range.reload
51
- range.best_estimate.should eq nil
52
- end
53
- end
54
- end
55
-
56
- context 'default value, int4 range' do
57
- before do
58
- adapter.create_table :int4_default_rangers, :force => true do |t|
59
- t.int4range :best_estimate, :default => 0..5
60
- end
61
- class Int4DefaultRanger < ActiveRecord::Base
62
- attr_accessible :best_estimate
63
- end
64
- end
65
-
66
- after do
67
- adapter.drop_table :int4_default_rangers
68
- Object.send(:remove_const, :Int4DefaultRanger)
69
- end
70
-
71
- describe '#create' do
72
- it 'creates an record when there is no assignment' do
73
- range = Int4DefaultRanger.create()
74
- range.reload
75
- range.best_estimate.should eq 0...6
76
- end
77
-
78
- it 'creates an record with a range' do
79
- range = Int4DefaultRanger.create( :best_estimate => 0..4)
80
- range.reload
81
- range.best_estimate.should eq 0...5
82
- end
83
- end
84
- end
85
- end
@@ -1,85 +0,0 @@
1
- require 'spec_helper'
2
-
3
- describe 'Models with int8range columns' do
4
- let!(:adapter) { ActiveRecord::Base.connection }
5
-
6
- context 'no default value, range' do
7
- before do
8
- adapter.create_table :int8_rangers, :force => true do |t|
9
- t.int8range :best_estimate
10
- end
11
- class Int8Ranger < ActiveRecord::Base
12
- attr_accessible :best_estimate
13
- end
14
- end
15
-
16
- after do
17
- adapter.drop_table :int8_rangers
18
- Object.send(:remove_const, :Int8Ranger)
19
- end
20
-
21
- describe '#create' do
22
- it 'creates an record when there is no assignment' do
23
- range = Int8Ranger.create()
24
- range.reload
25
- range.best_estimate.should eq nil
26
- end
27
-
28
- it 'creates an record with a range' do
29
- range = Int8Ranger.create( :best_estimate => 0..4)
30
- range.reload
31
- range.best_estimate.should eq 0...5
32
- end
33
- end
34
-
35
- describe 'range assignment' do
36
- it 'updates an record with an range string' do
37
- range = Int8Ranger.create( :best_estimate => 0..4)
38
- range.best_estimate = 0...9
39
- range.save
40
-
41
- range.reload
42
- range.best_estimate.should eq 0...9
43
- end
44
-
45
- it 'converts empty strings to nil' do
46
- range = Int8Ranger.create
47
- range.best_estimate = ''
48
- range.save
49
-
50
- range.reload
51
- range.best_estimate.should eq nil
52
- end
53
- end
54
- end
55
-
56
- context 'default value, int8 range' do
57
- before do
58
- adapter.create_table :int8_default_rangers, :force => true do |t|
59
- t.int8range :best_estimate, :default => 0..5
60
- end
61
- class Int8DefaultRanger < ActiveRecord::Base
62
- attr_accessible :best_estimate
63
- end
64
- end
65
-
66
- after do
67
- adapter.drop_table :int8_default_rangers
68
- Object.send(:remove_const, :Int8DefaultRanger)
69
- end
70
-
71
- describe '#create' do
72
- it 'creates an record when there is no assignment' do
73
- range = Int8DefaultRanger.create()
74
- range.reload
75
- range.best_estimate.should eq 0...6
76
- end
77
-
78
- it 'creates an record with a range' do
79
- range = Int8DefaultRanger.create( :best_estimate => 0..4)
80
- range.reload
81
- range.best_estimate.should eq 0...5
82
- end
83
- end
84
- end
85
- end