sequel 4.5.0 → 4.6.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/CHANGELOG +14 -0
- data/README.rdoc +0 -1
- data/doc/mssql_stored_procedures.rdoc +43 -0
- data/doc/release_notes/3.18.0.txt +2 -3
- data/doc/release_notes/3.9.0.txt +1 -1
- data/doc/release_notes/4.6.0.txt +30 -0
- data/doc/security.rdoc +7 -0
- data/lib/sequel/adapters/jdbc/h2.rb +4 -4
- data/lib/sequel/adapters/jdbc/postgresql.rb +4 -0
- data/lib/sequel/adapters/oracle.rb +1 -0
- data/lib/sequel/adapters/shared/mssql.rb +94 -1
- data/lib/sequel/adapters/shared/mysql.rb +4 -4
- data/lib/sequel/adapters/shared/postgres.rb +4 -4
- data/lib/sequel/adapters/tinytds.rb +22 -4
- data/lib/sequel/adapters/utils/emulate_offset_with_row_number.rb +8 -2
- data/lib/sequel/database/dataset_defaults.rb +1 -1
- data/lib/sequel/model/associations.rb +1 -1
- data/lib/sequel/version.rb +1 -1
- data/spec/adapters/mssql_spec.rb +35 -0
- data/spec/adapters/oracle_spec.rb +4 -4
- data/spec/adapters/postgres_spec.rb +93 -93
- data/spec/adapters/spec_helper.rb +3 -1
- data/spec/bin_spec.rb +2 -0
- data/spec/core/database_spec.rb +22 -22
- data/spec/core/dataset_spec.rb +8 -8
- data/spec/core/expression_filters_spec.rb +1 -1
- data/spec/core/mock_adapter_spec.rb +2 -2
- data/spec/core/schema_generator_spec.rb +3 -3
- data/spec/core/spec_helper.rb +3 -1
- data/spec/core_extensions_spec.rb +3 -1
- data/spec/extensions/auto_validations_spec.rb +17 -17
- data/spec/extensions/caching_spec.rb +4 -4
- data/spec/extensions/error_splitter_spec.rb +1 -1
- data/spec/extensions/hook_class_methods_spec.rb +6 -6
- data/spec/extensions/migration_spec.rb +53 -53
- data/spec/extensions/pagination_spec.rb +9 -9
- data/spec/extensions/pg_array_associations_spec.rb +2 -2
- data/spec/extensions/pg_array_spec.rb +2 -2
- data/spec/extensions/pg_hstore_spec.rb +15 -15
- data/spec/extensions/pg_interval_spec.rb +3 -3
- data/spec/extensions/pg_range_spec.rb +20 -20
- data/spec/extensions/pg_row_spec.rb +1 -1
- data/spec/extensions/schema_caching_spec.rb +3 -3
- data/spec/extensions/spec_helper.rb +3 -1
- data/spec/extensions/static_cache_spec.rb +16 -16
- data/spec/extensions/tree_spec.rb +8 -8
- data/spec/extensions/validation_class_methods_spec.rb +10 -10
- data/spec/integration/database_test.rb +3 -3
- data/spec/integration/dataset_test.rb +6 -0
- data/spec/integration/migrator_test.rb +67 -67
- data/spec/integration/model_test.rb +2 -2
- data/spec/integration/schema_test.rb +1 -1
- data/spec/integration/spec_helper.rb +3 -1
- data/spec/integration/transaction_test.rb +2 -2
- data/spec/model/association_reflection_spec.rb +4 -4
- data/spec/model/associations_spec.rb +1 -1
- data/spec/model/class_dataset_methods_spec.rb +1 -1
- data/spec/model/eager_loading_spec.rb +7 -0
- data/spec/model/model_spec.rb +4 -4
- data/spec/model/record_spec.rb +20 -20
- data/spec/model/spec_helper.rb +2 -1
- data/spec/model/validations_spec.rb +1 -1
- data/spec/rspec_helper.rb +18 -0
- metadata +8 -3
@@ -62,20 +62,20 @@ describe "A paginated dataset" do
|
|
62
62
|
end
|
63
63
|
|
64
64
|
specify "should know if current page is last page" do
|
65
|
-
@paginated.last_page?.should
|
66
|
-
@d.paginate(2, 20).last_page?.should
|
67
|
-
@d.paginate(5, 30).last_page?.should
|
68
|
-
@d.paginate(6, 30).last_page?.should
|
65
|
+
@paginated.last_page?.should == false
|
66
|
+
@d.paginate(2, 20).last_page?.should == false
|
67
|
+
@d.paginate(5, 30).last_page?.should == false
|
68
|
+
@d.paginate(6, 30).last_page?.should == true
|
69
69
|
|
70
70
|
@d.meta_def(:count) {0}
|
71
|
-
@d.paginate(1, 30).last_page?.should
|
72
|
-
@d.paginate(2, 30).last_page?.should
|
71
|
+
@d.paginate(1, 30).last_page?.should == true
|
72
|
+
@d.paginate(2, 30).last_page?.should == false
|
73
73
|
end
|
74
74
|
|
75
75
|
specify "should know if current page is first page" do
|
76
|
-
@paginated.first_page?.should
|
77
|
-
@d.paginate(1, 20).first_page?.should
|
78
|
-
@d.paginate(2, 20).first_page?.should
|
76
|
+
@paginated.first_page?.should == true
|
77
|
+
@d.paginate(1, 20).first_page?.should == true
|
78
|
+
@d.paginate(2, 20).first_page?.should == false
|
79
79
|
end
|
80
80
|
|
81
81
|
specify "should work with fixed sql" do
|
@@ -225,8 +225,8 @@ describe Sequel::Model, "pg_array_associations" do
|
|
225
225
|
end
|
226
226
|
|
227
227
|
it "reflection remove_before_destroy? should return correct values" do
|
228
|
-
@c1.association_reflection(:tags).remove_before_destroy?.should
|
229
|
-
@c2.association_reflection(:artists).remove_before_destroy?.should
|
228
|
+
@c1.association_reflection(:tags).remove_before_destroy?.should == true
|
229
|
+
@c2.association_reflection(:artists).remove_before_destroy?.should == false
|
230
230
|
end
|
231
231
|
|
232
232
|
it "reflection reciprocal should be correct" do
|
@@ -327,7 +327,7 @@ describe "pg_array extension" do
|
|
327
327
|
@db.fetch = [{:name=>'id', :db_type=>'banana[]'}]
|
328
328
|
@db.schema(:items).map{|e| e[1][:type]}.should == [:banana_array]
|
329
329
|
@db.conversion_procs.should have_key(7865)
|
330
|
-
@db.respond_to?(:typecast_value_banana_array, true).should
|
330
|
+
@db.respond_to?(:typecast_value_banana_array, true).should == true
|
331
331
|
|
332
332
|
db = Sequel.connect('mock://postgres', :quote_identifiers=>false)
|
333
333
|
db.extend_datasets(Module.new{def supports_timestamp_timezones?; false; end; def supports_timestamp_usecs?; false; end})
|
@@ -335,7 +335,7 @@ describe "pg_array extension" do
|
|
335
335
|
db.fetch = [{:name=>'id', :db_type=>'banana[]'}]
|
336
336
|
db.schema(:items).map{|e| e[1][:type]}.should == [nil]
|
337
337
|
db.conversion_procs.should_not have_key(7865)
|
338
|
-
db.respond_to?(:typecast_value_banana_array, true).should
|
338
|
+
db.respond_to?(:typecast_value_banana_array, true).should == false
|
339
339
|
end
|
340
340
|
|
341
341
|
it "should automatically look up the array and scalar oids when registering per-Database types" do
|
@@ -78,14 +78,14 @@ describe "pg_hstore extension" do
|
|
78
78
|
Sequel.hstore('foo2'=>'bar').fetch(:foo){|key| k = key }.should == 'foo'
|
79
79
|
k.should == 'foo'
|
80
80
|
|
81
|
-
Sequel.hstore('foo'=>'bar').has_key?(:foo).should
|
82
|
-
Sequel.hstore('foo'=>'bar').has_key?(:bar).should
|
83
|
-
Sequel.hstore('foo'=>'bar').key?(:foo).should
|
84
|
-
Sequel.hstore('foo'=>'bar').key?(:bar).should
|
85
|
-
Sequel.hstore('foo'=>'bar').member?(:foo).should
|
86
|
-
Sequel.hstore('foo'=>'bar').member?(:bar).should
|
87
|
-
Sequel.hstore('foo'=>'bar').include?(:foo).should
|
88
|
-
Sequel.hstore('foo'=>'bar').include?(:bar).should
|
81
|
+
Sequel.hstore('foo'=>'bar').has_key?(:foo).should == true
|
82
|
+
Sequel.hstore('foo'=>'bar').has_key?(:bar).should == false
|
83
|
+
Sequel.hstore('foo'=>'bar').key?(:foo).should == true
|
84
|
+
Sequel.hstore('foo'=>'bar').key?(:bar).should == false
|
85
|
+
Sequel.hstore('foo'=>'bar').member?(:foo).should == true
|
86
|
+
Sequel.hstore('foo'=>'bar').member?(:bar).should == false
|
87
|
+
Sequel.hstore('foo'=>'bar').include?(:foo).should == true
|
88
|
+
Sequel.hstore('foo'=>'bar').include?(:bar).should == false
|
89
89
|
|
90
90
|
Sequel.hstore('foo'=>'bar', '1'=>'2').values_at(:foo3, :foo, :foo2, 1).should == [nil, 'bar', nil, '2']
|
91
91
|
|
@@ -96,16 +96,16 @@ describe "pg_hstore extension" do
|
|
96
96
|
end
|
97
97
|
|
98
98
|
it "should convert has_value?/value? lookups to string" do
|
99
|
-
Sequel.hstore('foo'=>'bar').has_value?(:bar).should
|
100
|
-
Sequel.hstore('foo'=>'bar').has_value?(:foo).should
|
101
|
-
Sequel.hstore('foo'=>'bar').value?(:bar).should
|
102
|
-
Sequel.hstore('foo'=>'bar').value?(:foo).should
|
99
|
+
Sequel.hstore('foo'=>'bar').has_value?(:bar).should == true
|
100
|
+
Sequel.hstore('foo'=>'bar').has_value?(:foo).should == false
|
101
|
+
Sequel.hstore('foo'=>'bar').value?(:bar).should == true
|
102
|
+
Sequel.hstore('foo'=>'bar').value?(:foo).should == false
|
103
103
|
end
|
104
104
|
|
105
105
|
it "should handle nil values in has_value?/value? lookups" do
|
106
|
-
Sequel.hstore('foo'=>'').has_value?('').should
|
107
|
-
Sequel.hstore('foo'=>'').has_value?(nil).should
|
108
|
-
Sequel.hstore('foo'=>nil).has_value?(nil).should
|
106
|
+
Sequel.hstore('foo'=>'').has_value?('').should == true
|
107
|
+
Sequel.hstore('foo'=>'').has_value?(nil).should == false
|
108
|
+
Sequel.hstore('foo'=>nil).has_value?(nil).should == true
|
109
109
|
end
|
110
110
|
|
111
111
|
it "should have underlying hash convert lookups by key to string" do
|
@@ -49,18 +49,18 @@ describe "pg_interval extension" do
|
|
49
49
|
d = ActiveSupport::Duration.new(31557600 + 2*86400*30 + 3*86400*7 + 4*86400 + 5*3600 + 6*60 + 7, [[:years, 1], [:months, 2], [:days, 25], [:seconds, 18367]])
|
50
50
|
@db.typecast_value(:interval, d).object_id.should == d.object_id
|
51
51
|
|
52
|
-
@db.typecast_value(:interval, "1 year 2 mons 25 days 05:06:07").is_a?(ActiveSupport::Duration).should
|
52
|
+
@db.typecast_value(:interval, "1 year 2 mons 25 days 05:06:07").is_a?(ActiveSupport::Duration).should == true
|
53
53
|
@db.typecast_value(:interval, "1 year 2 mons 25 days 05:06:07").should == d
|
54
54
|
@db.typecast_value(:interval, "1 year 2 mons 25 days 05:06:07").parts.sort_by{|k,v| k.to_s}.should == d.parts.sort_by{|k,v| k.to_s}
|
55
55
|
@db.typecast_value(:interval, "1 year 2 mons 25 days 05:06:07.0").parts.sort_by{|k,v| k.to_s}.should == d.parts.sort_by{|k,v| k.to_s}
|
56
56
|
|
57
|
-
@db.typecast_value(:interval, "1 year 2 mons 25 days 5 hours 6 mins 7 secs").is_a?(ActiveSupport::Duration).should
|
57
|
+
@db.typecast_value(:interval, "1 year 2 mons 25 days 5 hours 6 mins 7 secs").is_a?(ActiveSupport::Duration).should == true
|
58
58
|
@db.typecast_value(:interval, "1 year 2 mons 25 days 5 hours 6 mins 7 secs").should == d
|
59
59
|
@db.typecast_value(:interval, "1 year 2 mons 25 days 5 hours 6 mins 7 secs").parts.sort_by{|k,v| k.to_s}.should == d.parts.sort_by{|k,v| k.to_s}
|
60
60
|
@db.typecast_value(:interval, "1 year 2 mons 25 days 5 hours 6 mins 7.0 secs").parts.sort_by{|k,v| k.to_s}.should == d.parts.sort_by{|k,v| k.to_s}
|
61
61
|
|
62
62
|
d2 = ActiveSupport::Duration.new(1, [[:seconds, 1]])
|
63
|
-
@db.typecast_value(:interval, 1).is_a?(ActiveSupport::Duration).should
|
63
|
+
@db.typecast_value(:interval, 1).is_a?(ActiveSupport::Duration).should == true
|
64
64
|
@db.typecast_value(:interval, 1).should == d2
|
65
65
|
@db.typecast_value(:interval, 1).parts.sort_by{|k,v| k.to_s}.should == d2.parts.sort_by{|k,v| k.to_s}
|
66
66
|
|
@@ -285,8 +285,8 @@ describe "pg_range extension" do
|
|
285
285
|
|
286
286
|
it "should quack like a range" do
|
287
287
|
if RUBY_VERSION >= '1.9'
|
288
|
-
@r1.cover?(1.5).should
|
289
|
-
@r1.cover?(2.5).should
|
288
|
+
@r1.cover?(1.5).should == true
|
289
|
+
@r1.cover?(2.5).should == false
|
290
290
|
@r1.first(1).should == [1]
|
291
291
|
@r1.last(1).should == [2]
|
292
292
|
end
|
@@ -357,12 +357,12 @@ describe "pg_range extension" do
|
|
357
357
|
end
|
358
358
|
|
359
359
|
it "should have #exclude_begin? and #exclude_end indicate whether the beginning or ending of the range is excluded" do
|
360
|
-
@r1.exclude_begin?.should
|
361
|
-
@r1.exclude_end?.should
|
362
|
-
@r2.exclude_begin?.should
|
363
|
-
@r2.exclude_end?.should
|
364
|
-
@r3.exclude_begin?.should
|
365
|
-
@r3.exclude_end?.should
|
360
|
+
@r1.exclude_begin?.should == false
|
361
|
+
@r1.exclude_end?.should == false
|
362
|
+
@r2.exclude_begin?.should == true
|
363
|
+
@r2.exclude_end?.should == false
|
364
|
+
@r3.exclude_begin?.should == false
|
365
|
+
@r3.exclude_end?.should == true
|
366
366
|
end
|
367
367
|
|
368
368
|
it "should have #to_range raise an exception if the PGRange cannot be represented by a Range" do
|
@@ -381,24 +381,24 @@ describe "pg_range extension" do
|
|
381
381
|
end
|
382
382
|
|
383
383
|
it "should have #unbounded_begin? and #unbounded_end indicate whether the beginning or ending of the range is unbounded" do
|
384
|
-
@r1.unbounded_begin?.should
|
385
|
-
@r1.unbounded_end?.should
|
386
|
-
@r2.unbounded_begin?.should
|
387
|
-
@r2.unbounded_end?.should
|
388
|
-
@r3.unbounded_begin?.should
|
389
|
-
@r3.unbounded_end?.should
|
384
|
+
@r1.unbounded_begin?.should == false
|
385
|
+
@r1.unbounded_end?.should == false
|
386
|
+
@r2.unbounded_begin?.should == false
|
387
|
+
@r2.unbounded_end?.should == true
|
388
|
+
@r3.unbounded_begin?.should == true
|
389
|
+
@r3.unbounded_end?.should == false
|
390
390
|
end
|
391
391
|
|
392
392
|
it "should have #valid_ruby_range? return true if the PGRange can be represented as a Range" do
|
393
|
-
@r1.valid_ruby_range?.should
|
394
|
-
@R.new(1, 2, :exclude_end=>true).valid_ruby_range?.should
|
393
|
+
@r1.valid_ruby_range?.should == true
|
394
|
+
@R.new(1, 2, :exclude_end=>true).valid_ruby_range?.should == true
|
395
395
|
end
|
396
396
|
|
397
397
|
it "should have #valid_ruby_range? return false if the PGRange cannot be represented as a Range" do
|
398
|
-
@R.new(nil, 1).valid_ruby_range?.should
|
399
|
-
@R.new(1, nil).valid_ruby_range?.should
|
400
|
-
@R.new(0, 1, :exclude_begin=>true).valid_ruby_range?.should
|
401
|
-
@R.empty.valid_ruby_range?.should
|
398
|
+
@R.new(nil, 1).valid_ruby_range?.should == false
|
399
|
+
@R.new(1, nil).valid_ruby_range?.should == false
|
400
|
+
@R.new(0, 1, :exclude_begin=>true).valid_ruby_range?.should == false
|
401
|
+
@R.empty.valid_ruby_range?.should == false
|
402
402
|
end
|
403
403
|
end
|
404
404
|
end
|
@@ -272,7 +272,7 @@ describe "pg_row extension" do
|
|
272
272
|
@db.conversion_procs[4] = proc{|s| called = true; s}
|
273
273
|
@db.register_row_type(:foo)
|
274
274
|
@db.conversion_procs[1].call('()').should == {:bar=>nil}
|
275
|
-
called.should
|
275
|
+
called.should == false
|
276
276
|
end
|
277
277
|
|
278
278
|
it "should registering array type for row type if type has an array oid" do
|
@@ -12,9 +12,9 @@ describe "schema_caching extension" do
|
|
12
12
|
end
|
13
13
|
|
14
14
|
it "Database#dump_schema_cache should dump cached schema to the given file" do
|
15
|
-
File.exist?(@filename).should
|
15
|
+
File.exist?(@filename).should == false
|
16
16
|
@db.dump_schema_cache(@filename)
|
17
|
-
File.exist?(@filename).should
|
17
|
+
File.exist?(@filename).should == true
|
18
18
|
File.size(@filename).should > 0
|
19
19
|
end
|
20
20
|
|
@@ -34,7 +34,7 @@ describe "schema_caching extension" do
|
|
34
34
|
|
35
35
|
it "Database#load_schema_cache? should load cached schema from the given file if it exists" do
|
36
36
|
db = Sequel::Database.new.extension(:schema_caching)
|
37
|
-
File.exist?(@filename).should
|
37
|
+
File.exist?(@filename).should == false
|
38
38
|
db.load_schema_cache?(@filename)
|
39
39
|
db.instance_variable_get(:@schemas).should == {}
|
40
40
|
end
|
@@ -37,7 +37,9 @@ def skip_warn(s)
|
|
37
37
|
warn "Skipping test of #{s}" if ENV["SKIPPED_TEST_WARN"]
|
38
38
|
end
|
39
39
|
|
40
|
-
(
|
40
|
+
require File.join(File.dirname(File.expand_path(__FILE__)), "../rspec_helper.rb")
|
41
|
+
|
42
|
+
RSPEC_EXAMPLE_GROUP.class_eval do
|
41
43
|
if ENV['SEQUEL_DEPRECATION_WARNINGS']
|
42
44
|
class << self
|
43
45
|
alias qspecify specify
|
@@ -78,7 +78,7 @@ describe "Sequel::Plugins::StaticCache with :frozen=>false option" do
|
|
78
78
|
end
|
79
79
|
|
80
80
|
it "should have map without a block not return a frozen object" do
|
81
|
-
@c.map.frozen?.should
|
81
|
+
@c.map.frozen?.should == false
|
82
82
|
end
|
83
83
|
|
84
84
|
it "should have map with a block and argument raise" do
|
@@ -100,7 +100,7 @@ describe "Sequel::Plugins::StaticCache with :frozen=>false option" do
|
|
100
100
|
end
|
101
101
|
|
102
102
|
it "should have all not return a frozen object" do
|
103
|
-
@c.all.frozen?.should
|
103
|
+
@c.all.frozen?.should == false
|
104
104
|
end
|
105
105
|
|
106
106
|
it "should have all return things in dataset order" do
|
@@ -135,7 +135,7 @@ describe "Sequel::Plugins::StaticCache with :frozen=>false option" do
|
|
135
135
|
end
|
136
136
|
|
137
137
|
it "should have to_hash not return a frozen object" do
|
138
|
-
@c.to_hash.frozen?.should
|
138
|
+
@c.to_hash.frozen?.should == false
|
139
139
|
end
|
140
140
|
|
141
141
|
it "should have to_hash_groups without arguments return the cached objects without a query" do
|
@@ -201,7 +201,7 @@ describe "Sequel::Plugins::StaticCache with :frozen=>false option" do
|
|
201
201
|
end
|
202
202
|
|
203
203
|
it "all of the static cache values (model instances) should be frozen" do
|
204
|
-
@c.all.all?{|o| o.frozen?}.should
|
204
|
+
@c.all.all?{|o| o.frozen?}.should == true
|
205
205
|
end
|
206
206
|
|
207
207
|
it "should make .[] method with primary key return cached instances" do
|
@@ -286,47 +286,47 @@ describe "Sequel::Plugins::StaticCache with :frozen=>false option" do
|
|
286
286
|
it_should_behave_like "Sequel::Plugins::StaticCache"
|
287
287
|
|
288
288
|
it "record retrieved by primary key should not be frozen" do
|
289
|
-
@c[1].frozen?.should
|
290
|
-
@c.cache_get_pk(1).frozen?.should
|
289
|
+
@c[1].frozen?.should == false
|
290
|
+
@c.cache_get_pk(1).frozen?.should == false
|
291
291
|
end
|
292
292
|
|
293
293
|
it "none of values returned in #all should be frozen" do
|
294
|
-
@c.all.all?{|o| !o.frozen?}.should
|
294
|
+
@c.all.all?{|o| !o.frozen?}.should == true
|
295
295
|
end
|
296
296
|
|
297
297
|
it "none of values yielded by each should be frozen" do
|
298
298
|
a = []
|
299
299
|
@c.each{|o| a << o}
|
300
|
-
a.all?{|o| !o.frozen?}.should
|
300
|
+
a.all?{|o| !o.frozen?}.should == true
|
301
301
|
end
|
302
302
|
|
303
303
|
it "none of values yielded by Enumerable method should be frozen" do
|
304
|
-
@c.sort_by{|o| o.id}.all?{|o| !o.frozen?}.should
|
304
|
+
@c.sort_by{|o| o.id}.all?{|o| !o.frozen?}.should == true
|
305
305
|
end
|
306
306
|
|
307
307
|
it "none of values returned by map without an argument or block should be frozen" do
|
308
|
-
@c.map{|o| o}.all?{|o| !o.frozen?}.should
|
309
|
-
@c.map.all?{|o| !o.frozen?}.should
|
308
|
+
@c.map{|o| o}.all?{|o| !o.frozen?}.should == true
|
309
|
+
@c.map.all?{|o| !o.frozen?}.should == true
|
310
310
|
end
|
311
311
|
|
312
312
|
it "none of values in the hash returned by to_hash without an argument should be frozen" do
|
313
|
-
@c.to_hash.values.all?{|o| !o.frozen?}.should
|
313
|
+
@c.to_hash.values.all?{|o| !o.frozen?}.should == true
|
314
314
|
end
|
315
315
|
|
316
316
|
it "none of values in the hash returned by to_hash with a single argument should be frozen" do
|
317
|
-
@c.to_hash(:id).values.all?{|o| !o.frozen?}.should
|
317
|
+
@c.to_hash(:id).values.all?{|o| !o.frozen?}.should == true
|
318
318
|
end
|
319
319
|
|
320
320
|
it "none of values in the hash returned by to_hash with a single array argument should be frozen" do
|
321
|
-
@c.to_hash([:id, :id]).values.all?{|o| !o.frozen?}.should
|
321
|
+
@c.to_hash([:id, :id]).values.all?{|o| !o.frozen?}.should == true
|
322
322
|
end
|
323
323
|
|
324
324
|
it "none of values in the hash returned by to_hash_groups with a single argument should be frozen" do
|
325
|
-
@c.to_hash_groups(:id).values.flatten.all?{|o| !o.frozen?}.should
|
325
|
+
@c.to_hash_groups(:id).values.flatten.all?{|o| !o.frozen?}.should == true
|
326
326
|
end
|
327
327
|
|
328
328
|
it "none of values in the hash returned by to_hash_groups with a single array argument should be frozen" do
|
329
|
-
@c.to_hash_groups([:id, :id]).values.flatten.all?{|o| !o.frozen?}.should
|
329
|
+
@c.to_hash_groups([:id, :id]).values.flatten.all?{|o| !o.frozen?}.should == true
|
330
330
|
end
|
331
331
|
|
332
332
|
it "should not automatically update the cache when creating new model objects" do
|
@@ -89,12 +89,12 @@ describe Sequel::Model, "tree plugin" do
|
|
89
89
|
end
|
90
90
|
|
91
91
|
it "should have root? return true for a root node and false for a child node" do
|
92
|
-
@c.load(:parent_id => nil).root?.should
|
93
|
-
@c.load(:parent_id => 1).root?.should
|
92
|
+
@c.load(:parent_id => nil).root?.should == true
|
93
|
+
@c.load(:parent_id => 1).root?.should == false
|
94
94
|
end
|
95
95
|
|
96
96
|
it "should have root? return false for an new node" do
|
97
|
-
@c.new.root?.should
|
97
|
+
@c.new.root?.should == false
|
98
98
|
end
|
99
99
|
|
100
100
|
it "should have self_and_siblings return the children of the current node's parent" do
|
@@ -207,14 +207,14 @@ describe Sequel::Model, "tree plugin with composite keys" do
|
|
207
207
|
end
|
208
208
|
|
209
209
|
it "should have root? return true for a root node and false for a child node" do
|
210
|
-
@c.load(:parent_id => nil, :parent_id2=>nil).root?.should
|
211
|
-
@c.load(:parent_id => 1, :parent_id2=>nil).root?.should
|
212
|
-
@c.load(:parent_id => nil, :parent_id2=>2).root?.should
|
213
|
-
@c.load(:parent_id => 1, :parent_id2=>2).root?.should
|
210
|
+
@c.load(:parent_id => nil, :parent_id2=>nil).root?.should == true
|
211
|
+
@c.load(:parent_id => 1, :parent_id2=>nil).root?.should == true
|
212
|
+
@c.load(:parent_id => nil, :parent_id2=>2).root?.should == true
|
213
|
+
@c.load(:parent_id => 1, :parent_id2=>2).root?.should == false
|
214
214
|
end
|
215
215
|
|
216
216
|
it "should have root? return false for an new node" do
|
217
|
-
@c.new.root?.should
|
217
|
+
@c.new.root?.should == false
|
218
218
|
end
|
219
219
|
|
220
220
|
it "should have self_and_siblings return the children of the current node's parent" do
|
@@ -142,9 +142,9 @@ describe Sequel::Model do
|
|
142
142
|
specify "should have the validates block have appropriate respond_to?" do
|
143
143
|
c = nil
|
144
144
|
@c.validates{c = respond_to?(:foo)}
|
145
|
-
c.should
|
145
|
+
c.should == false
|
146
146
|
@c.validates{c = respond_to?(:length_of)}
|
147
|
-
c.should
|
147
|
+
c.should == true
|
148
148
|
end if RUBY_VERSION >= '1.9'
|
149
149
|
end
|
150
150
|
|
@@ -616,7 +616,7 @@ describe "Superclass validations" do
|
|
616
616
|
o.errors.full_messages.should == ['value is too short', 'value is invalid']
|
617
617
|
|
618
618
|
o.value = 'abcde'
|
619
|
-
o.valid?.should
|
619
|
+
o.valid?.should == true
|
620
620
|
end
|
621
621
|
|
622
622
|
specify "should have skip_superclass_validations? return whether superclass validations were skipped" do
|
@@ -630,14 +630,14 @@ describe "Superclass validations" do
|
|
630
630
|
|
631
631
|
o = @c2.new
|
632
632
|
o.value = 'ab'
|
633
|
-
o.valid?.should
|
633
|
+
o.valid?.should == true
|
634
634
|
|
635
635
|
o.value = '12'
|
636
636
|
o.valid?.should == false
|
637
637
|
o.errors.full_messages.should == ['value is invalid']
|
638
638
|
|
639
639
|
o.value = 'abcde'
|
640
|
-
o.valid?.should
|
640
|
+
o.valid?.should == true
|
641
641
|
end
|
642
642
|
end
|
643
643
|
|
@@ -733,9 +733,9 @@ describe Sequel::Model, "Validations" do
|
|
733
733
|
end
|
734
734
|
|
735
735
|
@person = Person.new :first_name => "Lancelot99"
|
736
|
-
@person.valid?.should
|
736
|
+
@person.valid?.should == false
|
737
737
|
@person = Person.new :first_name => "Anita"
|
738
|
-
@person.valid?.should
|
738
|
+
@person.valid?.should == true
|
739
739
|
end
|
740
740
|
|
741
741
|
it "should validate length of column" do
|
@@ -943,10 +943,10 @@ describe Sequel::Model, "Validations" do
|
|
943
943
|
Person.validations[:first_name].size.should == 2
|
944
944
|
|
945
945
|
@person = Person.new :first_name => "Lancelot99"
|
946
|
-
@person.valid?.should
|
946
|
+
@person.valid?.should == false
|
947
947
|
|
948
948
|
@person2 = Person.new :first_name => "Wayne"
|
949
|
-
@person2.valid?.should
|
949
|
+
@person2.valid?.should == true
|
950
950
|
end
|
951
951
|
|
952
952
|
it "should allow 'longhand' validations direcly within the model." do
|
@@ -1008,7 +1008,7 @@ describe "Model#save" do
|
|
1008
1008
|
|
1009
1009
|
@m.x = 7
|
1010
1010
|
@m.should be_valid
|
1011
|
-
@m.save.should_not
|
1011
|
+
@m.save.should_not == false
|
1012
1012
|
DB.sqls.should == ['UPDATE people SET x = 7 WHERE (id = 4)']
|
1013
1013
|
end
|
1014
1014
|
|
@@ -78,7 +78,7 @@ describe Sequel::Database do
|
|
78
78
|
@db << "SELECT"
|
79
79
|
rescue Sequel::DatabaseError=>e
|
80
80
|
if defined?(Java::JavaLang::Exception)
|
81
|
-
(e.wrapped_exception.is_a?(Exception) || e.wrapped_exception.is_a?(Java::JavaLang::Exception)).should
|
81
|
+
(e.wrapped_exception.is_a?(Exception) || e.wrapped_exception.is_a?(Java::JavaLang::Exception)).should == true
|
82
82
|
else
|
83
83
|
e.wrapped_exception.should be_a_kind_of(Exception)
|
84
84
|
end
|
@@ -98,8 +98,8 @@ describe Sequel::Database do
|
|
98
98
|
|
99
99
|
cspecify "should provide ability to check connections for validity", [:do, :postgres] do
|
100
100
|
conn = @db.synchronize{|c| c}
|
101
|
-
@db.valid_connection?(conn).should
|
101
|
+
@db.valid_connection?(conn).should == true
|
102
102
|
@db.disconnect
|
103
|
-
@db.valid_connection?(conn).should
|
103
|
+
@db.valid_connection?(conn).should == false
|
104
104
|
end
|
105
105
|
end
|