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.
Files changed (65) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGELOG +14 -0
  3. data/README.rdoc +0 -1
  4. data/doc/mssql_stored_procedures.rdoc +43 -0
  5. data/doc/release_notes/3.18.0.txt +2 -3
  6. data/doc/release_notes/3.9.0.txt +1 -1
  7. data/doc/release_notes/4.6.0.txt +30 -0
  8. data/doc/security.rdoc +7 -0
  9. data/lib/sequel/adapters/jdbc/h2.rb +4 -4
  10. data/lib/sequel/adapters/jdbc/postgresql.rb +4 -0
  11. data/lib/sequel/adapters/oracle.rb +1 -0
  12. data/lib/sequel/adapters/shared/mssql.rb +94 -1
  13. data/lib/sequel/adapters/shared/mysql.rb +4 -4
  14. data/lib/sequel/adapters/shared/postgres.rb +4 -4
  15. data/lib/sequel/adapters/tinytds.rb +22 -4
  16. data/lib/sequel/adapters/utils/emulate_offset_with_row_number.rb +8 -2
  17. data/lib/sequel/database/dataset_defaults.rb +1 -1
  18. data/lib/sequel/model/associations.rb +1 -1
  19. data/lib/sequel/version.rb +1 -1
  20. data/spec/adapters/mssql_spec.rb +35 -0
  21. data/spec/adapters/oracle_spec.rb +4 -4
  22. data/spec/adapters/postgres_spec.rb +93 -93
  23. data/spec/adapters/spec_helper.rb +3 -1
  24. data/spec/bin_spec.rb +2 -0
  25. data/spec/core/database_spec.rb +22 -22
  26. data/spec/core/dataset_spec.rb +8 -8
  27. data/spec/core/expression_filters_spec.rb +1 -1
  28. data/spec/core/mock_adapter_spec.rb +2 -2
  29. data/spec/core/schema_generator_spec.rb +3 -3
  30. data/spec/core/spec_helper.rb +3 -1
  31. data/spec/core_extensions_spec.rb +3 -1
  32. data/spec/extensions/auto_validations_spec.rb +17 -17
  33. data/spec/extensions/caching_spec.rb +4 -4
  34. data/spec/extensions/error_splitter_spec.rb +1 -1
  35. data/spec/extensions/hook_class_methods_spec.rb +6 -6
  36. data/spec/extensions/migration_spec.rb +53 -53
  37. data/spec/extensions/pagination_spec.rb +9 -9
  38. data/spec/extensions/pg_array_associations_spec.rb +2 -2
  39. data/spec/extensions/pg_array_spec.rb +2 -2
  40. data/spec/extensions/pg_hstore_spec.rb +15 -15
  41. data/spec/extensions/pg_interval_spec.rb +3 -3
  42. data/spec/extensions/pg_range_spec.rb +20 -20
  43. data/spec/extensions/pg_row_spec.rb +1 -1
  44. data/spec/extensions/schema_caching_spec.rb +3 -3
  45. data/spec/extensions/spec_helper.rb +3 -1
  46. data/spec/extensions/static_cache_spec.rb +16 -16
  47. data/spec/extensions/tree_spec.rb +8 -8
  48. data/spec/extensions/validation_class_methods_spec.rb +10 -10
  49. data/spec/integration/database_test.rb +3 -3
  50. data/spec/integration/dataset_test.rb +6 -0
  51. data/spec/integration/migrator_test.rb +67 -67
  52. data/spec/integration/model_test.rb +2 -2
  53. data/spec/integration/schema_test.rb +1 -1
  54. data/spec/integration/spec_helper.rb +3 -1
  55. data/spec/integration/transaction_test.rb +2 -2
  56. data/spec/model/association_reflection_spec.rb +4 -4
  57. data/spec/model/associations_spec.rb +1 -1
  58. data/spec/model/class_dataset_methods_spec.rb +1 -1
  59. data/spec/model/eager_loading_spec.rb +7 -0
  60. data/spec/model/model_spec.rb +4 -4
  61. data/spec/model/record_spec.rb +20 -20
  62. data/spec/model/spec_helper.rb +2 -1
  63. data/spec/model/validations_spec.rb +1 -1
  64. data/spec/rspec_helper.rb +18 -0
  65. metadata +8 -3
@@ -39,7 +39,7 @@ describe "Dataset" do
39
39
  ds._fetch = {:x=>1}
40
40
  called = false
41
41
  ds.each{|a| called = true; a.should == {:x=>1}}
42
- called.should be_true
42
+ called.should == true
43
43
  end
44
44
 
45
45
  specify "should get quote_identifiers default from database" do
@@ -4327,11 +4327,11 @@ end
4327
4327
 
4328
4328
  describe "Dataset feature defaults" do
4329
4329
  it "should not require aliases for recursive CTEs by default" do
4330
- Sequel::Database.new.dataset.recursive_cte_requires_column_aliases?.should be_false
4330
+ Sequel::Database.new.dataset.recursive_cte_requires_column_aliases?.should == false
4331
4331
  end
4332
4332
 
4333
4333
  it "should not require placeholder type specifiers by default" do
4334
- Sequel::Database.new.dataset.requires_placeholder_type_specifiers?.should be_false
4334
+ Sequel::Database.new.dataset.requires_placeholder_type_specifiers?.should == false
4335
4335
  end
4336
4336
  end
4337
4337
 
@@ -4363,13 +4363,13 @@ describe "Dataset extensions" do
4363
4363
  specify "should be able to register an extension with a block and Database#extension call the block" do
4364
4364
  @ds.quote_identifiers = false
4365
4365
  Sequel::Dataset.register_extension(:foo){|db| db.quote_identifiers = true}
4366
- @ds.extension(:foo).quote_identifiers?.should be_true
4366
+ @ds.extension(:foo).quote_identifiers?.should == true
4367
4367
  end
4368
4368
 
4369
4369
  specify "should be able to register an extension with a callable and Database#extension call the callable" do
4370
4370
  @ds.quote_identifiers = false
4371
4371
  Sequel::Dataset.register_extension(:foo, proc{|db| db.quote_identifiers = true})
4372
- @ds.extension(:foo).quote_identifiers?.should be_true
4372
+ @ds.extension(:foo).quote_identifiers?.should == true
4373
4373
  end
4374
4374
 
4375
4375
  specify "should be able to load multiple extensions in the same call" do
@@ -4378,7 +4378,7 @@ describe "Dataset extensions" do
4378
4378
  Sequel::Dataset.register_extension(:foo, proc{|ds| ds.quote_identifiers = true})
4379
4379
  Sequel::Dataset.register_extension(:bar, proc{|ds| ds.identifier_input_method = nil})
4380
4380
  ds = @ds.extension(:foo, :bar)
4381
- ds.quote_identifiers?.should be_true
4381
+ ds.quote_identifiers?.should == true
4382
4382
  ds.identifier_input_method.should be_nil
4383
4383
  end
4384
4384
 
@@ -4576,13 +4576,13 @@ end
4576
4576
 
4577
4577
  describe "Dataset#supports_replace?" do
4578
4578
  it "should be false by default" do
4579
- Sequel::Dataset.new(nil).supports_replace?.should be_false
4579
+ Sequel::Dataset.new(nil).supports_replace?.should == false
4580
4580
  end
4581
4581
  end
4582
4582
 
4583
4583
  describe "Dataset#supports_lateral_subqueries?" do
4584
4584
  it "should be false by default" do
4585
- Sequel::Dataset.new(nil).supports_lateral_subqueries?.should be_false
4585
+ Sequel::Dataset.new(nil).supports_lateral_subqueries?.should == false
4586
4586
  end
4587
4587
  end
4588
4588
 
@@ -1066,6 +1066,6 @@ end
1066
1066
 
1067
1067
  describe "Sequel core extensions" do
1068
1068
  specify "should have Sequel.core_extensions? be false by default" do
1069
- Sequel.core_extensions?.should be_false
1069
+ Sequel.core_extensions?.should == false
1070
1070
  end
1071
1071
  end
@@ -14,7 +14,7 @@ describe "Sequel Mock Adapter" do
14
14
  specify "should each not return any rows by default" do
15
15
  called = false
16
16
  Sequel.mock[:t].each{|r| called = true}
17
- called.should be_false
17
+ called.should == false
18
18
  end
19
19
 
20
20
  specify "should return 0 for update/delete/with_sql_delete/execute_dui by default" do
@@ -299,7 +299,7 @@ describe "Sequel Mock Adapter" do
299
299
  end
300
300
 
301
301
  specify "should not quote identifiers by default" do
302
- Sequel.mock.send(:quote_identifiers_default).should be_false
302
+ Sequel.mock.send(:quote_identifiers_default).should == false
303
303
  end
304
304
 
305
305
  specify "should allow overriding of server_version" do
@@ -20,7 +20,7 @@ describe Sequel::Schema::Generator do
20
20
  end
21
21
 
22
22
  it "should respond to everything" do
23
- @generator.respond_to?(:foo).should be_true
23
+ @generator.respond_to?(:foo).should == true
24
24
  end if RUBY_VERSION >= '1.9'
25
25
 
26
26
  it "should primary key column first" do
@@ -68,9 +68,9 @@ describe Sequel::Schema::Generator do
68
68
 
69
69
  it "finds columns" do
70
70
  [:title, :body, :parent_id, :id].each do |col|
71
- @generator.has_column?(col).should be_true
71
+ @generator.has_column?(col).should == true
72
72
  end
73
- @generator.has_column?(:foo).should_not be_true
73
+ @generator.has_column?(:foo).should_not == true
74
74
  end
75
75
 
76
76
  it "creates constraints" do
@@ -11,7 +11,9 @@ unless Object.const_defined?('Sequel')
11
11
  end
12
12
  Sequel::Deprecation.backtrace_filter = lambda{|line, lineno| lineno < 4 || line =~ /_spec\.rb/}
13
13
 
14
- (defined?(RSpec) ? RSpec::Core::ExampleGroup : Spec::Example::ExampleGroup).class_eval do
14
+ require File.join(File.dirname(File.expand_path(__FILE__)), "../rspec_helper.rb")
15
+
16
+ RSPEC_EXAMPLE_GROUP.class_eval do
15
17
  def meta_def(obj, name, &block)
16
18
  (class << obj; self end).send(:define_method, name, &block)
17
19
  end
@@ -22,9 +22,11 @@ if RUBY_VERSION < '1.9.0'
22
22
  Sequel.extension :ruby18_symbol_extensions
23
23
  end
24
24
 
25
+ require File.join(File.dirname(File.expand_path(__FILE__)), "rspec_helper.rb")
26
+
25
27
  describe "Sequel core extensions" do
26
28
  specify "should have Sequel.core_extensions? be true if enabled" do
27
- Sequel.core_extensions?.should be_true
29
+ Sequel.core_extensions?.should == true
28
30
  end
29
31
  end
30
32
 
@@ -27,19 +27,19 @@ describe "Sequel::Plugins::AutoValidations" do
27
27
  end
28
28
 
29
29
  it "should have automatically created validations" do
30
- @m.valid?.should be_false
30
+ @m.valid?.should == false
31
31
  @m.errors.should == {:d=>["is not present"], :name=>["is not present"]}
32
32
 
33
33
  @m.name = ''
34
- @m.valid?.should be_false
34
+ @m.valid?.should == false
35
35
  @m.errors.should == {:d=>["is not present"]}
36
36
 
37
37
  @m.set(:d=>'/', :num=>'a', :name=>'1')
38
- @m.valid?.should be_false
38
+ @m.valid?.should == false
39
39
  @m.errors.should == {:d=>["is not a valid date"], :num=>["is not a valid integer"]}
40
40
 
41
41
  @m.set(:d=>Date.today, :num=>1)
42
- @m.valid?.should be_false
42
+ @m.valid?.should == false
43
43
  @m.errors.should == {[:name, :num]=>["is already taken"]}
44
44
  end
45
45
 
@@ -47,20 +47,20 @@ describe "Sequel::Plugins::AutoValidations" do
47
47
  def (@m.db).supports_index_parsing?() false end
48
48
  @m.model.send(:setup_auto_validations)
49
49
  @m.set(:d=>Date.today, :num=>1, :name=>'1')
50
- @m.valid?.should be_true
50
+ @m.valid?.should == true
51
51
  end
52
52
 
53
53
  it "should support :not_null=>:presence option" do
54
54
  @c.plugin :auto_validations, :not_null=>:presence
55
55
  @m.set(:d=>Date.today, :num=>'')
56
- @m.valid?.should be_false
56
+ @m.valid?.should == false
57
57
  @m.errors.should == {:name=>["is not present"]}
58
58
  end
59
59
 
60
60
  it "should automatically validate explicit nil values for columns with not nil defaults" do
61
61
  @m.set(:d=>Date.today, :name=>1, :nnd=>nil)
62
62
  @m.id = nil
63
- @m.valid?.should be_false
63
+ @m.valid?.should == false
64
64
  @m.errors.should == {:id=>["is not present"], :nnd=>["is not present"]}
65
65
  end
66
66
 
@@ -68,46 +68,46 @@ describe "Sequel::Plugins::AutoValidations" do
68
68
  @c = Class.new(@c)
69
69
  @m = @c.new
70
70
  @c.skip_auto_validations(:not_null)
71
- @m.valid?.should be_true
71
+ @m.valid?.should == true
72
72
 
73
73
  @m.set(:d=>'/', :num=>'a', :name=>'1')
74
- @m.valid?.should be_false
74
+ @m.valid?.should == false
75
75
  @m.errors.should == {:d=>["is not a valid date"], :num=>["is not a valid integer"]}
76
76
 
77
77
  @c.skip_auto_validations(:types)
78
- @m.valid?.should be_false
78
+ @m.valid?.should == false
79
79
  @m.errors.should == {[:name, :num]=>["is already taken"]}
80
80
 
81
81
  @c.skip_auto_validations(:unique)
82
- @m.valid?.should be_true
82
+ @m.valid?.should == true
83
83
  end
84
84
 
85
85
  it "should allow skipping all auto validations" do
86
86
  @c = Class.new(@c)
87
87
  @m = @c.new
88
88
  @c.skip_auto_validations(:all)
89
- @m.valid?.should be_true
89
+ @m.valid?.should == true
90
90
  @m.set(:d=>'/', :num=>'a', :name=>'1')
91
- @m.valid?.should be_true
91
+ @m.valid?.should == true
92
92
  end
93
93
 
94
94
  it "should work correctly in subclasses" do
95
95
  @c = Class.new(@c)
96
96
  @m = @c.new
97
- @m.valid?.should be_false
97
+ @m.valid?.should == false
98
98
  @m.errors.should == {:d=>["is not present"], :name=>["is not present"]}
99
99
 
100
100
  @m.set(:d=>'/', :num=>'a', :name=>'1')
101
- @m.valid?.should be_false
101
+ @m.valid?.should == false
102
102
  @m.errors.should == {:d=>["is not a valid date"], :num=>["is not a valid integer"]}
103
103
 
104
104
  @m.set(:d=>Date.today, :num=>1)
105
- @m.valid?.should be_false
105
+ @m.valid?.should == false
106
106
  @m.errors.should == {[:name, :num]=>["is already taken"]}
107
107
  end
108
108
 
109
109
  it "should work correctly when changing the dataset" do
110
110
  @c.set_dataset(@c.db[:foo])
111
- @c.new.valid?.should be_true
111
+ @c.new.valid?.should == true
112
112
  end
113
113
  end
@@ -173,14 +173,14 @@ describe Sequel::Model, "caching" do
173
173
  @cache[m.cache_key].should == m
174
174
  m.name = 'hey'
175
175
  m.save
176
- @cache.has_key?(m.cache_key).should be_false
176
+ @cache.has_key?(m.cache_key).should == false
177
177
  @c.db.sqls.should == ["SELECT * FROM items WHERE id = 1", "UPDATE items SET name = 'hey' WHERE (id = 1)"]
178
178
 
179
179
  m = @c2[1]
180
180
  @cache[m.cache_key].should == m
181
181
  m.name = 'hey'
182
182
  m.save
183
- @cache.has_key?(m.cache_key).should be_false
183
+ @cache.has_key?(m.cache_key).should == false
184
184
  @c.db.sqls.should == ["SELECT * FROM items WHERE id = 1", "UPDATE items SET name = 'hey' WHERE (id = 1)"]
185
185
  end
186
186
 
@@ -188,13 +188,13 @@ describe Sequel::Model, "caching" do
188
188
  m = @c[1]
189
189
  @cache[m.cache_key].should == m
190
190
  m.delete
191
- @cache.has_key?(m.cache_key).should be_false
191
+ @cache.has_key?(m.cache_key).should == false
192
192
  @c.db.sqls.should == ["SELECT * FROM items WHERE id = 1", "DELETE FROM items WHERE id = 1"]
193
193
 
194
194
  m = @c2[1]
195
195
  @cache[m.cache_key].should == m
196
196
  m.delete
197
- @cache.has_key?(m.cache_key).should be_false
197
+ @cache.has_key?(m.cache_key).should == false
198
198
  @c.db.sqls.should == ["SELECT * FROM items WHERE id = 1", "DELETE FROM items WHERE id = 1"]
199
199
  end
200
200
 
@@ -11,7 +11,7 @@ describe "Sequel::Plugins::ErrorSplitter" do
11
11
  end
12
12
 
13
13
  it "should split errors for multiple columns and assign them to each column" do
14
- @m.valid?.should be_false
14
+ @m.valid?.should == false
15
15
  @m.errors.should == {:a=>['is bad'], :b=>['is bad']}
16
16
  end
17
17
  end
@@ -354,17 +354,17 @@ describe "Model.has_hooks?" do
354
354
  end
355
355
 
356
356
  specify "should return false if no hooks are defined" do
357
- @c.has_hooks?(:before_save).should be_false
357
+ @c.has_hooks?(:before_save).should == false
358
358
  end
359
359
 
360
360
  specify "should return true if hooks are defined" do
361
361
  @c.before_save {'blah'}
362
- @c.has_hooks?(:before_save).should be_true
362
+ @c.has_hooks?(:before_save).should == true
363
363
  end
364
364
 
365
365
  specify "should return true if hooks are inherited" do
366
366
  @d = Class.new(@c)
367
- @d.has_hooks?(:before_save).should be_false
367
+ @d.has_hooks?(:before_save).should == false
368
368
  end
369
369
  end
370
370
 
@@ -399,15 +399,15 @@ describe "Model#add_hook_type" do
399
399
  specify "it should return true for bar when before_bar and after_bar hooks are returing true" do
400
400
  a = 1
401
401
  @f.before_bar { a += 1}
402
- @f.new.bar.should be_true
402
+ @f.new.bar.should == true
403
403
  a.should == 2
404
404
  @f.after_bar { a *= 2}
405
- @f.new.bar.should be_true
405
+ @f.new.bar.should == true
406
406
  a.should == 6
407
407
  end
408
408
 
409
409
  specify "it should return nil for bar when before_bar and after_bar hooks are returing false" do
410
- @f.new.bar.should be_true
410
+ @f.new.bar.should == true
411
411
  @f.after_bar { false }
412
412
  @f.new.bar.should == :a
413
413
  @f.before_bar { false }
@@ -60,8 +60,8 @@ describe "Migration.apply" do
60
60
 
61
61
  specify "should respond to the methods the database responds to" do
62
62
  m = Sequel::Migration.new(Sequel.mock)
63
- m.respond_to?(:foo).should be_false
64
- m.respond_to?(:execute).should be_true
63
+ m.respond_to?(:foo).should == false
64
+ m.respond_to?(:execute).should == true
65
65
  end if RUBY_VERSION >= '1.9'
66
66
  end
67
67
 
@@ -292,16 +292,16 @@ describe "Sequel::IntegerMigrator" do
292
292
  end
293
293
 
294
294
  specify "should automatically create the schema_info table with the version column" do
295
- @db.table_exists?(:schema_info).should be_false
295
+ @db.table_exists?(:schema_info).should == false
296
296
  Sequel::Migrator.run(@db, @dirname, :target=>0)
297
- @db.table_exists?(:schema_info).should be_true
297
+ @db.table_exists?(:schema_info).should == true
298
298
  @db.dataset.columns.should == [:version]
299
299
  end
300
300
 
301
301
  specify "should allow specifying the table and columns" do
302
- @db.table_exists?(:si).should be_false
302
+ @db.table_exists?(:si).should == false
303
303
  Sequel::Migrator.run(@db, @dirname, :target=>0, :table=>:si, :column=>:sic)
304
- @db.table_exists?(:si).should be_true
304
+ @db.table_exists?(:si).should == true
305
305
  @db.dataset.columns.should == [:sic]
306
306
  end
307
307
 
@@ -313,9 +313,9 @@ describe "Sequel::IntegerMigrator" do
313
313
  end
314
314
 
315
315
  specify "should be able to tell whether there are outstanding migrations" do
316
- Sequel::Migrator.is_current?(@db, @dirname).should be_false
316
+ Sequel::Migrator.is_current?(@db, @dirname).should == false
317
317
  Sequel::Migrator.apply(@db, @dirname)
318
- Sequel::Migrator.is_current?(@db, @dirname).should be_true
318
+ Sequel::Migrator.is_current?(@db, @dirname).should == true
319
319
  end
320
320
 
321
321
  specify "should have #check_current raise an exception if the migrator is not current" do
@@ -474,31 +474,31 @@ describe "Sequel::TimestampMigrator" do
474
474
  specify "should handle migrating up or down all the way" do
475
475
  @dir = 'spec/files/timestamped_migrations'
476
476
  @m.apply(@db, @dir)
477
- [:schema_migrations, :sm1111, :sm2222, :sm3333].each{|n| @db.table_exists?(n).should be_true}
477
+ [:schema_migrations, :sm1111, :sm2222, :sm3333].each{|n| @db.table_exists?(n).should == true}
478
478
  @db[:schema_migrations].select_order_map(:filename).should == %w'1273253849_create_sessions.rb 1273253851_create_nodes.rb 1273253853_3_create_users.rb'
479
479
  @m.apply(@db, @dir, 0)
480
- [:sm1111, :sm2222, :sm3333].each{|n| @db.table_exists?(n).should be_false}
480
+ [:sm1111, :sm2222, :sm3333].each{|n| @db.table_exists?(n).should == false}
481
481
  @db[:schema_migrations].select_order_map(:filename).should == []
482
482
  end
483
483
 
484
484
  specify "should handle migrating up or down to specific timestamps" do
485
485
  @dir = 'spec/files/timestamped_migrations'
486
486
  @m.apply(@db, @dir, 1273253851)
487
- [:schema_migrations, :sm1111, :sm2222].each{|n| @db.table_exists?(n).should be_true}
488
- @db.table_exists?(:sm3333).should be_false
487
+ [:schema_migrations, :sm1111, :sm2222].each{|n| @db.table_exists?(n).should == true}
488
+ @db.table_exists?(:sm3333).should == false
489
489
  @db[:schema_migrations].select_order_map(:filename).should == %w'1273253849_create_sessions.rb 1273253851_create_nodes.rb'
490
490
  @m.apply(@db, @dir, 1273253849)
491
- [:sm2222, :sm3333].each{|n| @db.table_exists?(n).should be_false}
492
- @db.table_exists?(:sm1111).should be_true
491
+ [:sm2222, :sm3333].each{|n| @db.table_exists?(n).should == false}
492
+ @db.table_exists?(:sm1111).should == true
493
493
  @db[:schema_migrations].select_order_map(:filename).should == %w'1273253849_create_sessions.rb'
494
494
  end
495
495
 
496
496
  specify "should not be current when there are migrations to apply" do
497
497
  @dir = 'spec/files/timestamped_migrations'
498
498
  @m.apply(@db, @dir)
499
- @m.is_current?(@db, @dir).should be_true
499
+ @m.is_current?(@db, @dir).should == true
500
500
  @dir = 'spec/files/interleaved_timestamped_migrations'
501
- @m.is_current?(@db, @dir).should be_false
501
+ @m.is_current?(@db, @dir).should == false
502
502
  end
503
503
 
504
504
  specify "should raise an exception if the migrator is not current" do
@@ -514,7 +514,7 @@ describe "Sequel::TimestampMigrator" do
514
514
  @m.apply(@db, @dir)
515
515
  @dir = 'spec/files/interleaved_timestamped_migrations'
516
516
  @m.apply(@db, @dir)
517
- [:schema_migrations, :sm1111, :sm1122, :sm2222, :sm2233, :sm3333].each{|n| @db.table_exists?(n).should be_true}
517
+ [:schema_migrations, :sm1111, :sm1122, :sm2222, :sm2233, :sm3333].each{|n| @db.table_exists?(n).should == true}
518
518
  @db[:schema_migrations].select_order_map(:filename).should == %w'1273253849_create_sessions.rb 1273253850_create_artists.rb 1273253851_create_nodes.rb 1273253852_create_albums.rb 1273253853_3_create_users.rb'
519
519
  end
520
520
 
@@ -523,7 +523,7 @@ describe "Sequel::TimestampMigrator" do
523
523
  @m.apply(@db, @dir)
524
524
  @dir = 'spec/files/interleaved_timestamped_migrations'
525
525
  @m.apply(@db, @dir, 0)
526
- [:sm1111, :sm1122, :sm2222, :sm2233, :sm3333].each{|n| @db.table_exists?(n).should be_false}
526
+ [:sm1111, :sm1122, :sm2222, :sm2233, :sm3333].each{|n| @db.table_exists?(n).should == false}
527
527
  @db[:schema_migrations].select_order_map(:filename).should == []
528
528
  end
529
529
 
@@ -532,113 +532,113 @@ describe "Sequel::TimestampMigrator" do
532
532
  @m.apply(@db, @dir)
533
533
  @dir = 'spec/files/interleaved_timestamped_migrations'
534
534
  @m.apply(@db, @dir, 1273253851)
535
- [:schema_migrations, :sm1111, :sm1122, :sm2222].each{|n| @db.table_exists?(n).should be_true}
536
- [:sm2233, :sm3333].each{|n| @db.table_exists?(n).should be_false}
535
+ [:schema_migrations, :sm1111, :sm1122, :sm2222].each{|n| @db.table_exists?(n).should == true}
536
+ [:sm2233, :sm3333].each{|n| @db.table_exists?(n).should == false}
537
537
  @db[:schema_migrations].select_order_map(:filename).should == %w'1273253849_create_sessions.rb 1273253850_create_artists.rb 1273253851_create_nodes.rb'
538
538
  end
539
539
 
540
540
  specify "should correctly update schema_migrations table when an error occurs when migrating up or down" do
541
541
  @dir = 'spec/files/bad_timestamped_migrations'
542
542
  proc{@m.apply(@db, @dir)}.should raise_error
543
- [:schema_migrations, :sm1111, :sm2222].each{|n| @db.table_exists?(n).should be_true}
544
- @db.table_exists?(:sm3333).should be_false
543
+ [:schema_migrations, :sm1111, :sm2222].each{|n| @db.table_exists?(n).should == true}
544
+ @db.table_exists?(:sm3333).should == false
545
545
  @db[:schema_migrations].select_order_map(:filename).should == %w'1273253849_create_sessions.rb 1273253851_create_nodes.rb'
546
546
  proc{@m.apply(@db, @dir, 0)}.should raise_error
547
- [:sm2222, :sm3333].each{|n| @db.table_exists?(n).should be_false}
548
- @db.table_exists?(:sm1111).should be_true
547
+ [:sm2222, :sm3333].each{|n| @db.table_exists?(n).should == false}
548
+ @db.table_exists?(:sm1111).should == true
549
549
  @db[:schema_migrations].select_order_map(:filename).should == %w'1273253849_create_sessions.rb'
550
550
  end
551
551
 
552
552
  specify "should handle multiple migrations with the same timestamp correctly" do
553
553
  @dir = 'spec/files/duplicate_timestamped_migrations'
554
554
  @m.apply(@db, @dir)
555
- [:schema_migrations, :sm1111, :sm2222, :sm3333].each{|n| @db.table_exists?(n).should be_true}
555
+ [:schema_migrations, :sm1111, :sm2222, :sm3333].each{|n| @db.table_exists?(n).should == true}
556
556
  @db[:schema_migrations].select_order_map(:filename).should == %w'1273253849_create_sessions.rb 1273253853_create_nodes.rb 1273253853_create_users.rb'
557
557
  @m.apply(@db, @dir, 1273253853)
558
- [:sm1111, :sm2222, :sm3333].each{|n| @db.table_exists?(n).should be_true}
558
+ [:sm1111, :sm2222, :sm3333].each{|n| @db.table_exists?(n).should == true}
559
559
  @db[:schema_migrations].select_order_map(:filename).should == %w'1273253849_create_sessions.rb 1273253853_create_nodes.rb 1273253853_create_users.rb'
560
560
  @m.apply(@db, @dir, 1273253849)
561
- [:sm1111].each{|n| @db.table_exists?(n).should be_true}
562
- [:sm2222, :sm3333].each{|n| @db.table_exists?(n).should be_false}
561
+ [:sm1111].each{|n| @db.table_exists?(n).should == true}
562
+ [:sm2222, :sm3333].each{|n| @db.table_exists?(n).should == false}
563
563
  @db[:schema_migrations].select_order_map(:filename).should == %w'1273253849_create_sessions.rb'
564
564
  @m.apply(@db, @dir, 1273253848)
565
- [:sm1111, :sm2222, :sm3333].each{|n| @db.table_exists?(n).should be_false}
565
+ [:sm1111, :sm2222, :sm3333].each{|n| @db.table_exists?(n).should == false}
566
566
  @db[:schema_migrations].select_order_map(:filename).should == []
567
567
  end
568
568
 
569
569
  specify "should convert schema_info table to schema_migrations table" do
570
570
  @dir = 'spec/files/integer_migrations'
571
571
  @m.apply(@db, @dir)
572
- [:schema_info, :sm1111, :sm2222, :sm3333].each{|n| @db.table_exists?(n).should be_true}
573
- [:schema_migrations, :sm1122, :sm2233].each{|n| @db.table_exists?(n).should be_false}
572
+ [:schema_info, :sm1111, :sm2222, :sm3333].each{|n| @db.table_exists?(n).should == true}
573
+ [:schema_migrations, :sm1122, :sm2233].each{|n| @db.table_exists?(n).should == false}
574
574
 
575
575
  @dir = 'spec/files/convert_to_timestamp_migrations'
576
576
  @m.apply(@db, @dir)
577
- [:schema_info, :sm1111, :sm2222, :sm3333, :schema_migrations, :sm1122, :sm2233].each{|n| @db.table_exists?(n).should be_true}
577
+ [:schema_info, :sm1111, :sm2222, :sm3333, :schema_migrations, :sm1122, :sm2233].each{|n| @db.table_exists?(n).should == true}
578
578
  @db[:schema_migrations].select_order_map(:filename).should == %w'001_create_sessions.rb 002_create_nodes.rb 003_3_create_users.rb 1273253850_create_artists.rb 1273253852_create_albums.rb'
579
579
 
580
580
  @m.apply(@db, @dir, 4)
581
- [:schema_info, :schema_migrations, :sm1111, :sm2222, :sm3333].each{|n| @db.table_exists?(n).should be_true}
582
- [:sm1122, :sm2233].each{|n| @db.table_exists?(n).should be_false}
581
+ [:schema_info, :schema_migrations, :sm1111, :sm2222, :sm3333].each{|n| @db.table_exists?(n).should == true}
582
+ [:sm1122, :sm2233].each{|n| @db.table_exists?(n).should == false}
583
583
  @db[:schema_migrations].select_order_map(:filename).should == %w'001_create_sessions.rb 002_create_nodes.rb 003_3_create_users.rb'
584
584
 
585
585
  @m.apply(@db, @dir, 0)
586
- [:schema_info, :schema_migrations].each{|n| @db.table_exists?(n).should be_true}
587
- [:sm1111, :sm2222, :sm3333, :sm1122, :sm2233].each{|n| @db.table_exists?(n).should be_false}
586
+ [:schema_info, :schema_migrations].each{|n| @db.table_exists?(n).should == true}
587
+ [:sm1111, :sm2222, :sm3333, :sm1122, :sm2233].each{|n| @db.table_exists?(n).should == false}
588
588
  @db[:schema_migrations].select_order_map(:filename).should == []
589
589
  end
590
590
 
591
591
  specify "should handle unapplied migrations when migrating schema_info table to schema_migrations table" do
592
592
  @dir = 'spec/files/integer_migrations'
593
593
  @m.apply(@db, @dir, 2)
594
- [:schema_info, :sm1111, :sm2222].each{|n| @db.table_exists?(n).should be_true}
595
- [:schema_migrations, :sm3333, :sm1122, :sm2233].each{|n| @db.table_exists?(n).should be_false}
594
+ [:schema_info, :sm1111, :sm2222].each{|n| @db.table_exists?(n).should == true}
595
+ [:schema_migrations, :sm3333, :sm1122, :sm2233].each{|n| @db.table_exists?(n).should == false}
596
596
 
597
597
  @dir = 'spec/files/convert_to_timestamp_migrations'
598
598
  @m.apply(@db, @dir, 1273253850)
599
- [:schema_info, :sm1111, :sm2222, :sm3333, :schema_migrations, :sm1122].each{|n| @db.table_exists?(n).should be_true}
600
- [:sm2233].each{|n| @db.table_exists?(n).should be_false}
599
+ [:schema_info, :sm1111, :sm2222, :sm3333, :schema_migrations, :sm1122].each{|n| @db.table_exists?(n).should == true}
600
+ [:sm2233].each{|n| @db.table_exists?(n).should == false}
601
601
  @db[:schema_migrations].select_order_map(:filename).should == %w'001_create_sessions.rb 002_create_nodes.rb 003_3_create_users.rb 1273253850_create_artists.rb'
602
602
  end
603
603
 
604
604
  specify "should handle unapplied migrations when migrating schema_info table to schema_migrations table and target is less than last integer migration version" do
605
605
  @dir = 'spec/files/integer_migrations'
606
606
  @m.apply(@db, @dir, 1)
607
- [:schema_info, :sm1111].each{|n| @db.table_exists?(n).should be_true}
608
- [:schema_migrations, :sm2222, :sm3333, :sm1122, :sm2233].each{|n| @db.table_exists?(n).should be_false}
607
+ [:schema_info, :sm1111].each{|n| @db.table_exists?(n).should == true}
608
+ [:schema_migrations, :sm2222, :sm3333, :sm1122, :sm2233].each{|n| @db.table_exists?(n).should == false}
609
609
 
610
610
  @dir = 'spec/files/convert_to_timestamp_migrations'
611
611
  @m.apply(@db, @dir, 2)
612
- [:schema_info, :sm1111, :sm2222, :schema_migrations].each{|n| @db.table_exists?(n).should be_true}
613
- [:sm3333, :sm1122, :sm2233].each{|n| @db.table_exists?(n).should be_false}
612
+ [:schema_info, :sm1111, :sm2222, :schema_migrations].each{|n| @db.table_exists?(n).should == true}
613
+ [:sm3333, :sm1122, :sm2233].each{|n| @db.table_exists?(n).should == false}
614
614
  @db[:schema_migrations].select_order_map(:filename).should == %w'001_create_sessions.rb 002_create_nodes.rb'
615
615
 
616
616
  @m.apply(@db, @dir)
617
- [:schema_info, :sm1111, :sm2222, :schema_migrations, :sm3333, :sm1122, :sm2233].each{|n| @db.table_exists?(n).should be_true}
617
+ [:schema_info, :sm1111, :sm2222, :schema_migrations, :sm3333, :sm1122, :sm2233].each{|n| @db.table_exists?(n).should == true}
618
618
  @db[:schema_migrations].select_order_map(:filename).should == %w'001_create_sessions.rb 002_create_nodes.rb 003_3_create_users.rb 1273253850_create_artists.rb 1273253852_create_albums.rb'
619
619
  end
620
620
 
621
621
  specify "should raise error for applied migrations not in file system" do
622
622
  @dir = 'spec/files/timestamped_migrations'
623
623
  @m.apply(@db, @dir)
624
- [:schema_migrations, :sm1111, :sm2222, :sm3333].each{|n| @db.table_exists?(n).should be_true}
624
+ [:schema_migrations, :sm1111, :sm2222, :sm3333].each{|n| @db.table_exists?(n).should == true}
625
625
  @db[:schema_migrations].select_order_map(:filename).should == %w'1273253849_create_sessions.rb 1273253851_create_nodes.rb 1273253853_3_create_users.rb'
626
626
 
627
627
  @dir = 'spec/files/missing_timestamped_migrations'
628
628
  proc{@m.apply(@db, @dir, 0)}.should raise_error(Sequel::Migrator::Error)
629
- [:schema_migrations, :sm1111, :sm2222, :sm3333].each{|n| @db.table_exists?(n).should be_true}
629
+ [:schema_migrations, :sm1111, :sm2222, :sm3333].each{|n| @db.table_exists?(n).should == true}
630
630
  @db[:schema_migrations].select_order_map(:filename).should == %w'1273253849_create_sessions.rb 1273253851_create_nodes.rb 1273253853_3_create_users.rb'
631
631
  end
632
632
 
633
633
  specify "should not raise error for applied migrations not in file system if :allow_missing_migration_files is true" do
634
634
  @dir = 'spec/files/timestamped_migrations'
635
635
  @m.apply(@db, @dir)
636
- [:schema_migrations, :sm1111, :sm2222, :sm3333].each{|n| @db.table_exists?(n).should be_true}
636
+ [:schema_migrations, :sm1111, :sm2222, :sm3333].each{|n| @db.table_exists?(n).should == true}
637
637
  @db[:schema_migrations].select_order_map(:filename).should == %w'1273253849_create_sessions.rb 1273253851_create_nodes.rb 1273253853_3_create_users.rb'
638
638
 
639
639
  @dir = 'spec/files/missing_timestamped_migrations'
640
640
  proc{@m.run(@db, @dir, :allow_missing_migration_files => true)}.should_not raise_error
641
- [:schema_migrations, :sm1111, :sm2222, :sm3333].each{|n| @db.table_exists?(n).should be_true}
641
+ [:schema_migrations, :sm1111, :sm2222, :sm3333].each{|n| @db.table_exists?(n).should == true}
642
642
  @db[:schema_migrations].select_order_map(:filename).should == %w'1273253849_create_sessions.rb 1273253851_create_nodes.rb 1273253853_3_create_users.rb'
643
643
  end
644
644
 
@@ -651,21 +651,21 @@ describe "Sequel::TimestampMigrator" do
651
651
  specify "should handle migration filenames in a case insensitive manner" do
652
652
  @dir = 'spec/files/uppercase_timestamped_migrations'
653
653
  @m.apply(@db, @dir)
654
- [:schema_migrations, :sm1111, :sm2222, :sm3333].each{|n| @db.table_exists?(n).should be_true}
654
+ [:schema_migrations, :sm1111, :sm2222, :sm3333].each{|n| @db.table_exists?(n).should == true}
655
655
  @db[:schema_migrations].select_order_map(:filename).should == %w'1273253849_create_sessions.rb 1273253851_create_nodes.rb 1273253853_3_create_users.rb'
656
656
  @dir = 'spec/files/timestamped_migrations'
657
657
  @m.apply(@db, @dir, 0)
658
- [:sm1111, :sm2222, :sm3333].each{|n| @db.table_exists?(n).should be_false}
658
+ [:sm1111, :sm2222, :sm3333].each{|n| @db.table_exists?(n).should == false}
659
659
  @db[:schema_migrations].select_order_map(:filename).should == []
660
660
  end
661
661
 
662
662
  specify "should :table and :column options" do
663
663
  @dir = 'spec/files/timestamped_migrations'
664
664
  @m.run(@db, @dir, :table=>:sm, :column=>:fn)
665
- [:sm, :sm1111, :sm2222, :sm3333].each{|n| @db.table_exists?(n).should be_true}
665
+ [:sm, :sm1111, :sm2222, :sm3333].each{|n| @db.table_exists?(n).should == true}
666
666
  @db[:sm].select_order_map(:filename).should == %w'1273253849_create_sessions.rb 1273253851_create_nodes.rb 1273253853_3_create_users.rb'
667
667
  @m.run(@db, @dir, :target=>0, :table=>:sm, :column=>:fn)
668
- [:sm1111, :sm2222, :sm3333].each{|n| @db.table_exists?(n).should be_false}
668
+ [:sm1111, :sm2222, :sm3333].each{|n| @db.table_exists?(n).should == false}
669
669
  @db[:sm].select_order_map(:fn).should == []
670
670
  end
671
671