sequel 4.22.0 → 4.23.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (214) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGELOG +22 -0
  3. data/README.rdoc +6 -0
  4. data/Rakefile +59 -81
  5. data/doc/migration.rdoc +2 -0
  6. data/doc/release_notes/4.23.0.txt +65 -0
  7. data/doc/sharding.rdoc +16 -14
  8. data/doc/testing.rdoc +61 -77
  9. data/lib/sequel/adapters/jdbc.rb +1 -0
  10. data/lib/sequel/adapters/mock.rb +0 -1
  11. data/lib/sequel/adapters/postgres.rb +1 -0
  12. data/lib/sequel/adapters/postgresql.rb +1 -0
  13. data/lib/sequel/adapters/shared/postgres.rb +3 -3
  14. data/lib/sequel/connection_pool/sharded_threaded.rb +5 -0
  15. data/lib/sequel/connection_pool/threaded.rb +9 -1
  16. data/lib/sequel/database/connecting.rb +1 -1
  17. data/lib/sequel/database/transactions.rb +2 -1
  18. data/lib/sequel/dataset/prepared_statements.rb +1 -1
  19. data/lib/sequel/extensions/constraint_validations.rb +12 -12
  20. data/lib/sequel/extensions/date_arithmetic.rb +0 -4
  21. data/lib/sequel/extensions/pagination.rb +14 -2
  22. data/lib/sequel/extensions/pg_enum.rb +2 -2
  23. data/lib/sequel/extensions/pg_hstore.rb +1 -1
  24. data/lib/sequel/extensions/pg_json_ops.rb +2 -2
  25. data/lib/sequel/plugins/csv_serializer.rb +2 -0
  26. data/lib/sequel/plugins/delay_add_association.rb +50 -0
  27. data/lib/sequel/plugins/list.rb +2 -2
  28. data/lib/sequel/plugins/nested_attributes.rb +8 -28
  29. data/lib/sequel/plugins/update_refresh.rb +50 -0
  30. data/lib/sequel/plugins/validate_associated.rb +55 -0
  31. data/lib/sequel/version.rb +1 -1
  32. data/spec/adapters/db2_spec.rb +29 -29
  33. data/spec/adapters/firebird_spec.rb +97 -103
  34. data/spec/adapters/informix_spec.rb +25 -25
  35. data/spec/adapters/mssql_spec.rb +156 -172
  36. data/spec/adapters/mysql_spec.rb +334 -359
  37. data/spec/adapters/oracle_spec.rb +67 -69
  38. data/spec/adapters/postgres_spec.rb +1298 -1249
  39. data/spec/adapters/spec_helper.rb +2 -35
  40. data/spec/adapters/sqlanywhere_spec.rb +39 -39
  41. data/spec/adapters/sqlite_spec.rb +203 -200
  42. data/spec/bin_spec.rb +57 -59
  43. data/spec/core/connection_pool_spec.rb +402 -401
  44. data/spec/core/database_spec.rb +953 -944
  45. data/spec/core/dataset_spec.rb +2178 -2168
  46. data/spec/core/deprecated_spec.rb +19 -19
  47. data/spec/core/expression_filters_spec.rb +415 -415
  48. data/spec/core/mock_adapter_spec.rb +212 -212
  49. data/spec/core/object_graph_spec.rb +73 -73
  50. data/spec/core/placeholder_literalizer_spec.rb +71 -71
  51. data/spec/core/schema_generator_spec.rb +44 -44
  52. data/spec/core/schema_spec.rb +470 -472
  53. data/spec/core/spec_helper.rb +5 -20
  54. data/spec/core/version_spec.rb +2 -2
  55. data/spec/core_extensions_spec.rb +320 -320
  56. data/spec/extensions/accessed_columns_spec.rb +12 -12
  57. data/spec/extensions/active_model_spec.rb +3 -3
  58. data/spec/extensions/after_initialize_spec.rb +2 -2
  59. data/spec/extensions/arbitrary_servers_spec.rb +23 -23
  60. data/spec/extensions/association_dependencies_spec.rb +34 -34
  61. data/spec/extensions/association_pks_spec.rb +98 -98
  62. data/spec/extensions/association_proxies_spec.rb +33 -33
  63. data/spec/extensions/auto_validations_spec.rb +46 -46
  64. data/spec/extensions/blacklist_security_spec.rb +19 -18
  65. data/spec/extensions/blank_spec.rb +36 -36
  66. data/spec/extensions/boolean_readers_spec.rb +36 -36
  67. data/spec/extensions/caching_spec.rb +82 -82
  68. data/spec/extensions/class_table_inheritance_spec.rb +72 -72
  69. data/spec/extensions/column_conflicts_spec.rb +19 -14
  70. data/spec/extensions/column_select_spec.rb +19 -19
  71. data/spec/extensions/columns_introspection_spec.rb +43 -43
  72. data/spec/extensions/composition_spec.rb +64 -64
  73. data/spec/extensions/connection_validator_spec.rb +92 -90
  74. data/spec/extensions/constraint_validations_plugin_spec.rb +92 -92
  75. data/spec/extensions/constraint_validations_spec.rb +80 -80
  76. data/spec/extensions/core_refinements_spec.rb +220 -220
  77. data/spec/extensions/csv_serializer_spec.rb +44 -44
  78. data/spec/extensions/current_datetime_timestamp_spec.rb +8 -8
  79. data/spec/extensions/dataset_associations_spec.rb +65 -65
  80. data/spec/extensions/dataset_source_alias_spec.rb +16 -16
  81. data/spec/extensions/date_arithmetic_spec.rb +51 -58
  82. data/spec/extensions/defaults_setter_spec.rb +19 -19
  83. data/spec/extensions/delay_add_association_spec.rb +52 -0
  84. data/spec/extensions/dirty_spec.rb +51 -51
  85. data/spec/extensions/eager_each_spec.rb +8 -8
  86. data/spec/extensions/empty_array_ignore_nulls_spec.rb +10 -10
  87. data/spec/extensions/error_splitter_spec.rb +2 -2
  88. data/spec/extensions/error_sql_spec.rb +4 -4
  89. data/spec/extensions/eval_inspect_spec.rb +3 -3
  90. data/spec/extensions/filter_having_spec.rb +8 -8
  91. data/spec/extensions/force_encoding_spec.rb +30 -30
  92. data/spec/extensions/from_block_spec.rb +7 -7
  93. data/spec/extensions/graph_each_spec.rb +19 -19
  94. data/spec/extensions/hash_aliases_spec.rb +5 -5
  95. data/spec/extensions/hook_class_methods_spec.rb +100 -100
  96. data/spec/extensions/inflector_spec.rb +54 -54
  97. data/spec/extensions/input_transformer_spec.rb +10 -10
  98. data/spec/extensions/insert_returning_select_spec.rb +8 -8
  99. data/spec/extensions/instance_filters_spec.rb +26 -26
  100. data/spec/extensions/instance_hooks_spec.rb +85 -85
  101. data/spec/extensions/json_serializer_spec.rb +68 -68
  102. data/spec/extensions/lazy_attributes_spec.rb +49 -49
  103. data/spec/extensions/list_spec.rb +77 -75
  104. data/spec/extensions/looser_typecasting_spec.rb +16 -16
  105. data/spec/extensions/many_through_many_spec.rb +627 -627
  106. data/spec/extensions/meta_def_spec.rb +7 -7
  107. data/spec/extensions/migration_spec.rb +217 -217
  108. data/spec/extensions/modification_detection_spec.rb +20 -20
  109. data/spec/extensions/mssql_optimistic_locking_spec.rb +21 -21
  110. data/spec/extensions/named_timezones_spec.rb +18 -18
  111. data/spec/extensions/nested_attributes_spec.rb +107 -107
  112. data/spec/extensions/null_dataset_spec.rb +24 -24
  113. data/spec/extensions/optimistic_locking_spec.rb +21 -21
  114. data/spec/extensions/pagination_spec.rb +52 -52
  115. data/spec/extensions/pg_array_associations_spec.rb +273 -273
  116. data/spec/extensions/pg_array_ops_spec.rb +52 -52
  117. data/spec/extensions/pg_array_spec.rb +152 -152
  118. data/spec/extensions/pg_enum_spec.rb +13 -13
  119. data/spec/extensions/pg_hstore_ops_spec.rb +63 -63
  120. data/spec/extensions/pg_hstore_spec.rb +84 -84
  121. data/spec/extensions/pg_inet_spec.rb +15 -15
  122. data/spec/extensions/pg_interval_spec.rb +29 -29
  123. data/spec/extensions/pg_json_ops_spec.rb +86 -84
  124. data/spec/extensions/pg_json_spec.rb +104 -104
  125. data/spec/extensions/pg_loose_count_spec.rb +6 -6
  126. data/spec/extensions/pg_range_ops_spec.rb +24 -24
  127. data/spec/extensions/pg_range_spec.rb +143 -143
  128. data/spec/extensions/pg_row_ops_spec.rb +14 -14
  129. data/spec/extensions/pg_row_plugin_spec.rb +12 -12
  130. data/spec/extensions/pg_row_spec.rb +118 -118
  131. data/spec/extensions/pg_static_cache_updater_spec.rb +28 -28
  132. data/spec/extensions/pg_typecast_on_load_spec.rb +21 -21
  133. data/spec/extensions/prepared_statements_associations_spec.rb +42 -42
  134. data/spec/extensions/prepared_statements_safe_spec.rb +18 -18
  135. data/spec/extensions/prepared_statements_spec.rb +28 -28
  136. data/spec/extensions/prepared_statements_with_pk_spec.rb +11 -11
  137. data/spec/extensions/pretty_table_spec.rb +16 -16
  138. data/spec/extensions/query_literals_spec.rb +37 -37
  139. data/spec/extensions/query_spec.rb +32 -32
  140. data/spec/extensions/rcte_tree_spec.rb +141 -141
  141. data/spec/extensions/round_timestamps_spec.rb +21 -21
  142. data/spec/extensions/schema_caching_spec.rb +8 -8
  143. data/spec/extensions/schema_dumper_spec.rb +78 -78
  144. data/spec/extensions/schema_spec.rb +31 -27
  145. data/spec/extensions/scissors_spec.rb +3 -3
  146. data/spec/extensions/select_remove_spec.rb +14 -14
  147. data/spec/extensions/sequel_3_dataset_methods_spec.rb +28 -28
  148. data/spec/extensions/serialization_modification_detection_spec.rb +33 -33
  149. data/spec/extensions/serialization_spec.rb +79 -78
  150. data/spec/extensions/server_block_spec.rb +17 -17
  151. data/spec/extensions/set_overrides_spec.rb +30 -30
  152. data/spec/extensions/sharding_spec.rb +65 -65
  153. data/spec/extensions/shared_caching_spec.rb +29 -29
  154. data/spec/extensions/single_table_inheritance_spec.rb +79 -79
  155. data/spec/extensions/skip_create_refresh_spec.rb +3 -3
  156. data/spec/extensions/spec_helper.rb +4 -29
  157. data/spec/extensions/split_array_nil_spec.rb +9 -9
  158. data/spec/extensions/split_values_spec.rb +7 -7
  159. data/spec/extensions/sql_expr_spec.rb +32 -32
  160. data/spec/extensions/static_cache_spec.rb +123 -123
  161. data/spec/extensions/string_date_time_spec.rb +34 -34
  162. data/spec/extensions/string_stripper_spec.rb +15 -15
  163. data/spec/extensions/subclasses_spec.rb +31 -31
  164. data/spec/extensions/table_select_spec.rb +15 -15
  165. data/spec/extensions/tactical_eager_loading_spec.rb +23 -23
  166. data/spec/extensions/thread_local_timezones_spec.rb +13 -13
  167. data/spec/extensions/timestamps_spec.rb +40 -40
  168. data/spec/extensions/to_dot_spec.rb +34 -34
  169. data/spec/extensions/touch_spec.rb +52 -52
  170. data/spec/extensions/tree_spec.rb +72 -72
  171. data/spec/extensions/typecast_on_load_spec.rb +25 -25
  172. data/spec/extensions/unlimited_update_spec.rb +2 -2
  173. data/spec/extensions/update_or_create_spec.rb +36 -36
  174. data/spec/extensions/update_primary_key_spec.rb +35 -35
  175. data/spec/extensions/update_refresh_spec.rb +41 -0
  176. data/spec/extensions/validate_associated_spec.rb +52 -0
  177. data/spec/extensions/validation_class_methods_spec.rb +314 -317
  178. data/spec/extensions/validation_helpers_spec.rb +195 -195
  179. data/spec/extensions/xml_serializer_spec.rb +48 -48
  180. data/spec/guards_helper.rb +55 -0
  181. data/spec/integration/associations_test.rb +1089 -1088
  182. data/spec/integration/database_test.rb +29 -29
  183. data/spec/integration/dataset_test.rb +661 -661
  184. data/spec/integration/eager_loader_test.rb +147 -147
  185. data/spec/integration/migrator_test.rb +122 -122
  186. data/spec/integration/model_test.rb +70 -70
  187. data/spec/integration/plugin_test.rb +682 -640
  188. data/spec/integration/prepared_statement_test.rb +172 -172
  189. data/spec/integration/schema_test.rb +245 -245
  190. data/spec/integration/spec_helper.rb +1 -64
  191. data/spec/integration/timezone_test.rb +17 -17
  192. data/spec/integration/transaction_test.rb +87 -87
  193. data/spec/integration/type_test.rb +33 -33
  194. data/spec/model/association_reflection_spec.rb +130 -121
  195. data/spec/model/associations_spec.rb +1112 -1113
  196. data/spec/model/base_spec.rb +197 -196
  197. data/spec/model/class_dataset_methods_spec.rb +118 -118
  198. data/spec/model/dataset_methods_spec.rb +49 -49
  199. data/spec/model/eager_loading_spec.rb +705 -702
  200. data/spec/model/hooks_spec.rb +169 -168
  201. data/spec/model/inflector_spec.rb +5 -5
  202. data/spec/model/model_spec.rb +287 -297
  203. data/spec/model/plugins_spec.rb +47 -47
  204. data/spec/model/record_spec.rb +534 -535
  205. data/spec/model/spec_helper.rb +3 -21
  206. data/spec/model/validations_spec.rb +72 -70
  207. data/spec/spec_config.rb +8 -0
  208. metadata +41 -9
  209. data/lib/sequel/adapters/fdbsql.rb +0 -286
  210. data/lib/sequel/adapters/jdbc/fdbsql.rb +0 -66
  211. data/lib/sequel/adapters/openbase.rb +0 -54
  212. data/lib/sequel/adapters/shared/fdbsql.rb +0 -550
  213. data/spec/adapters/fdbsql_spec.rb +0 -429
  214. data/spec/rspec_helper.rb +0 -22
@@ -1,21 +1,21 @@
1
1
  require File.join(File.dirname(File.expand_path(__FILE__)), "spec_helper")
2
2
 
3
3
  describe "Sequel::Metaprogramming" do
4
- specify "should add meta_def method to Database, Dataset, and Model classes and instances" do
4
+ it "should add meta_def method to Database, Dataset, and Model classes and instances" do
5
5
  Sequel::Database.meta_def(:foo){1}
6
- Sequel::Database.foo.should == 1
6
+ Sequel::Database.foo.must_equal 1
7
7
  Sequel::Dataset.meta_def(:foo){2}
8
- Sequel::Dataset.foo.should == 2
8
+ Sequel::Dataset.foo.must_equal 2
9
9
  Sequel::Model.meta_def(:foo){3}
10
- Sequel::Model.foo.should == 3
10
+ Sequel::Model.foo.must_equal 3
11
11
  o = Sequel::Database.new
12
12
  o.meta_def(:foo){4}
13
- o.foo.should == 4
13
+ o.foo.must_equal 4
14
14
  o = o[:a]
15
15
  o.meta_def(:foo){5}
16
- o.foo.should == 5
16
+ o.foo.must_equal 5
17
17
  o = Sequel::Model.new
18
18
  o.meta_def(:foo){6}
19
- o.foo.should == 6
19
+ o.foo.must_equal 6
20
20
  end
21
21
  end
@@ -7,26 +7,26 @@ describe "Migration.descendants" do
7
7
  Sequel::Migration.descendants.clear
8
8
  end
9
9
 
10
- specify "should include Migration subclasses" do
10
+ it "should include Migration subclasses" do
11
11
  @class = Class.new(Sequel::Migration)
12
12
 
13
- Sequel::Migration.descendants.should == [@class]
13
+ Sequel::Migration.descendants.must_equal [@class]
14
14
  end
15
15
 
16
- specify "should include Migration subclasses in order of creation" do
16
+ it "should include Migration subclasses in order of creation" do
17
17
  @c1 = Class.new(Sequel::Migration)
18
18
  @c2 = Class.new(Sequel::Migration)
19
19
  @c3 = Class.new(Sequel::Migration)
20
20
 
21
- Sequel::Migration.descendants.should == [@c1, @c2, @c3]
21
+ Sequel::Migration.descendants.must_equal [@c1, @c2, @c3]
22
22
  end
23
23
 
24
- specify "should include SimpleMigration instances created by migration DSL" do
24
+ it "should include SimpleMigration instances created by migration DSL" do
25
25
  i1 = Sequel.migration{}
26
26
  i2 = Sequel.migration{}
27
27
  i3 = Sequel.migration{}
28
28
 
29
- Sequel::Migration.descendants.should == [i1, i2, i3]
29
+ Sequel::Migration.descendants.must_equal [i1, i2, i3]
30
30
  end
31
31
  end
32
32
 
@@ -39,29 +39,29 @@ describe "Migration.apply" do
39
39
  @db = @c.new
40
40
  end
41
41
 
42
- specify "should raise for an invalid direction" do
43
- proc {Sequel::Migration.apply(@db, :hahaha)}.should raise_error(ArgumentError)
42
+ it "should raise for an invalid direction" do
43
+ proc {Sequel::Migration.apply(@db, :hahaha)}.must_raise(ArgumentError)
44
44
  end
45
45
 
46
- specify "should apply the up and down directions correctly" do
46
+ it "should apply the up and down directions correctly" do
47
47
  m = Class.new(Sequel::Migration) do
48
48
  define_method(:up) {one(3333)}
49
49
  define_method(:down) {two(4444)}
50
50
  end
51
- m.apply(@db, :up).should == [1111, 3333]
52
- m.apply(@db, :down).should == [2222, 4444]
51
+ m.apply(@db, :up).must_equal [1111, 3333]
52
+ m.apply(@db, :down).must_equal [2222, 4444]
53
53
  end
54
54
 
55
- specify "should have default up and down actions that do nothing" do
55
+ it "should have default up and down actions that do nothing" do
56
56
  m = Class.new(Sequel::Migration)
57
- m.apply(@db, :up).should == nil
58
- m.apply(@db, :down).should == nil
57
+ m.apply(@db, :up).must_equal nil
58
+ m.apply(@db, :down).must_equal nil
59
59
  end
60
60
 
61
- specify "should respond to the methods the database responds to" do
61
+ it "should respond to the methods the database responds to" do
62
62
  m = Sequel::Migration.new(Sequel.mock)
63
- m.respond_to?(:foo).should == false
64
- m.respond_to?(:execute).should == true
63
+ m.respond_to?(:foo).must_equal false
64
+ m.respond_to?(:execute).must_equal true
65
65
  end if RUBY_VERSION >= '1.9'
66
66
  end
67
67
 
@@ -74,23 +74,23 @@ describe "SimpleMigration#apply" do
74
74
  @db = @c.new
75
75
  end
76
76
 
77
- specify "should raise for an invalid direction" do
78
- proc {Sequel.migration{}.apply(@db, :hahaha)}.should raise_error(ArgumentError)
77
+ it "should raise for an invalid direction" do
78
+ proc {Sequel.migration{}.apply(@db, :hahaha)}.must_raise(ArgumentError)
79
79
  end
80
80
 
81
- specify "should apply the up and down directions correctly" do
81
+ it "should apply the up and down directions correctly" do
82
82
  m = Sequel.migration do
83
83
  up{one(3333)}
84
84
  down{two(4444)}
85
85
  end
86
- m.apply(@db, :up).should == [1111, 3333]
87
- m.apply(@db, :down).should == [2222, 4444]
86
+ m.apply(@db, :up).must_equal [1111, 3333]
87
+ m.apply(@db, :down).must_equal [2222, 4444]
88
88
  end
89
89
 
90
- specify "should have default up and down actions that do nothing" do
90
+ it "should have default up and down actions that do nothing" do
91
91
  m = Sequel.migration{}
92
- m.apply(@db, :up).should == nil
93
- m.apply(@db, :down).should == nil
92
+ m.apply(@db, :up).must_equal nil
93
+ m.apply(@db, :down).must_equal nil
94
94
  end
95
95
  end
96
96
 
@@ -143,10 +143,10 @@ describe "Reversible Migrations with Sequel.migration{change{}}" do
143
143
  end
144
144
  end
145
145
 
146
- specify "should apply up with normal actions in normal order" do
146
+ it "should apply up with normal actions in normal order" do
147
147
  p = @p
148
148
  Sequel.migration{change(&p)}.apply(@db, :up)
149
- @db.actions.should == [[:create_table, :a, {:foo=>:bar}],
149
+ @db.actions.must_equal [[:create_table, :a, {:foo=>:bar}],
150
150
  [:add_column, :a, :b, String],
151
151
  [:add_index, :a, :b],
152
152
  [:rename_column, :a, :b, :c],
@@ -167,10 +167,10 @@ describe "Reversible Migrations with Sequel.migration{change{}}" do
167
167
  [:create_join_table, {:cat_id=>:cats, :dog_id=>:dogs}]]
168
168
  end
169
169
 
170
- specify "should execute down with reversing actions in reverse order" do
170
+ it "should execute down with reversing actions in reverse order" do
171
171
  p = @p
172
172
  Sequel.migration{change(&p)}.apply(@db, :down)
173
- @db.actions.should == [
173
+ @db.actions.must_equal [
174
174
  [:drop_join_table, {:cat_id=>:cats, :dog_id=>:dogs}],
175
175
  [:drop_view, :c, {:foo=>:bar}],
176
176
  [:alter_table, [
@@ -192,37 +192,37 @@ describe "Reversible Migrations with Sequel.migration{change{}}" do
192
192
  [:drop_table, :a, {:foo=>:bar}]]
193
193
  end
194
194
 
195
- specify "should raise in the down direction if migration uses unsupported method" do
195
+ it "should raise in the down direction if migration uses unsupported method" do
196
196
  m = Sequel.migration{change{run 'SQL'}}
197
- proc{m.apply(@db, :up)}.should_not raise_error
198
- proc{m.apply(@db, :down)}.should raise_error(Sequel::Error)
197
+ m.apply(@db, :up)
198
+ proc{m.apply(@db, :down)}.must_raise(Sequel::Error)
199
199
  end
200
200
 
201
- specify "should raise in the down direction if migration uses add_primary_key with an array" do
201
+ it "should raise in the down direction if migration uses add_primary_key with an array" do
202
202
  m = Sequel.migration{change{alter_table(:a){add_primary_key [:b]}}}
203
- proc{m.apply(@db, :up)}.should_not raise_error
204
- proc{m.apply(@db, :down)}.should raise_error(Sequel::Error)
203
+ m.apply(@db, :up)
204
+ proc{m.apply(@db, :down)}.must_raise(Sequel::Error)
205
205
  end
206
206
 
207
- specify "should raise in the down direction if migration uses add_foreign_key with an array" do
207
+ it "should raise in the down direction if migration uses add_foreign_key with an array" do
208
208
  m = Sequel.migration{change{alter_table(:a){add_foreign_key [:b]}}}
209
- proc{m.apply(@db, :up)}.should_not raise_error
210
- proc{m.apply(@db, :down)}.should raise_error(Sequel::Error)
209
+ m.apply(@db, :up)
210
+ proc{m.apply(@db, :down)}.must_raise(Sequel::Error)
211
211
  end
212
212
  end
213
213
 
214
214
  describe "Sequel::Migrator.migrator_class" do
215
- specify "should return IntegerMigrator if not using timestamp migrations" do
216
- Sequel::Migrator.migrator_class("spec/files/integer_migrations").should == Sequel::IntegerMigrator
215
+ it "should return IntegerMigrator if not using timestamp migrations" do
216
+ Sequel::Migrator.migrator_class("spec/files/integer_migrations").must_equal Sequel::IntegerMigrator
217
217
  end
218
218
 
219
- specify "should return TimestampMigrator if using timestamp migrations" do
220
- Sequel::Migrator.migrator_class('spec/files/timestamped_migrations').should == Sequel::TimestampMigrator
219
+ it "should return TimestampMigrator if using timestamp migrations" do
220
+ Sequel::Migrator.migrator_class('spec/files/timestamped_migrations').must_equal Sequel::TimestampMigrator
221
221
  end
222
222
 
223
- specify "should return self if run on a subclass" do
224
- Sequel::IntegerMigrator.migrator_class("spec/files/timestamped_migrations").should == Sequel::IntegerMigrator
225
- Sequel::TimestampMigrator.migrator_class("spec/files/integer_migrations").should == Sequel::TimestampMigrator
223
+ it "should return self if run on a subclass" do
224
+ Sequel::IntegerMigrator.migrator_class("spec/files/timestamped_migrations").must_equal Sequel::IntegerMigrator
225
+ Sequel::TimestampMigrator.migrator_class("spec/files/integer_migrations").must_equal Sequel::TimestampMigrator
226
226
  end
227
227
  end
228
228
 
@@ -273,126 +273,126 @@ describe "Sequel::IntegerMigrator" do
273
273
  Object.send(:remove_const, "CreateSessions") if Object.const_defined?("CreateSessions")
274
274
  end
275
275
 
276
- specify "should raise and error if there is a missing integer migration version" do
277
- proc{Sequel::Migrator.apply(@db, "spec/files/missing_integer_migrations")}.should raise_error(Sequel::Migrator::Error)
276
+ it "should raise and error if there is a missing integer migration version" do
277
+ proc{Sequel::Migrator.apply(@db, "spec/files/missing_integer_migrations")}.must_raise(Sequel::Migrator::Error)
278
278
  end
279
279
 
280
- specify "should not raise and error if there is a missing integer migration version and allow_missing_migration_files is true" do
280
+ it "should not raise and error if there is a missing integer migration version and allow_missing_migration_files is true" do
281
281
  Sequel::Migrator.run(@db, "spec/files/missing_integer_migrations", :allow_missing_migration_files => true)
282
- @db.sqls.last.should == "UPDATE schema_info SET version = 3"
282
+ @db.sqls.last.must_equal "UPDATE schema_info SET version = 3"
283
283
  Sequel::Migrator.run(@db, "spec/files/missing_integer_migrations", :allow_missing_migration_files => true, :target=>0)
284
- @db.sqls.last.should == "UPDATE schema_info SET version = 0"
284
+ @db.sqls.last.must_equal "UPDATE schema_info SET version = 0"
285
285
  end
286
286
 
287
- specify "should raise and error if there is a duplicate integer migration version" do
288
- proc{Sequel::Migrator.apply(@db, "spec/files/duplicate_integer_migrations")}.should raise_error(Sequel::Migrator::Error)
287
+ it "should raise and error if there is a duplicate integer migration version" do
288
+ proc{Sequel::Migrator.apply(@db, "spec/files/duplicate_integer_migrations")}.must_raise(Sequel::Migrator::Error)
289
289
  end
290
290
 
291
- specify "should add a column name if it doesn't already exist in the schema_info table" do
291
+ it "should add a column name if it doesn't already exist in the schema_info table" do
292
292
  @db.create_table(:schema_info){Integer :v}
293
- @db.should_receive(:alter_table).with('schema_info')
293
+ def @db.alter_table(*); end
294
294
  Sequel::Migrator.apply(@db, @dirname)
295
295
  end
296
296
 
297
- specify "should automatically create the schema_info table with the version column" do
298
- @db.table_exists?(:schema_info).should == false
297
+ it "should automatically create the schema_info table with the version column" do
298
+ @db.table_exists?(:schema_info).must_equal false
299
299
  Sequel::Migrator.run(@db, @dirname, :target=>0)
300
- @db.table_exists?(:schema_info).should == true
301
- @db.dataset.columns.should == [:version]
300
+ @db.table_exists?(:schema_info).must_equal true
301
+ @db.dataset.columns.must_equal [:version]
302
302
  end
303
303
 
304
- specify "should allow specifying the table and columns" do
305
- @db.table_exists?(:si).should == false
304
+ it "should allow specifying the table and columns" do
305
+ @db.table_exists?(:si).must_equal false
306
306
  Sequel::Migrator.run(@db, @dirname, :target=>0, :table=>:si, :column=>:sic)
307
- @db.table_exists?(:si).should == true
308
- @db.dataset.columns.should == [:sic]
307
+ @db.table_exists?(:si).must_equal true
308
+ @db.dataset.columns.must_equal [:sic]
309
309
  end
310
310
 
311
- specify "should apply migrations correctly in the up direction if no target is given" do
311
+ it "should apply migrations correctly in the up direction if no target is given" do
312
312
  Sequel::Migrator.apply(@db, @dirname)
313
- @db.creates.should == [1111, 2222, 3333]
314
- @db.version.should == 3
315
- @db.sqls.map{|x| x =~ /\AUPDATE.*(\d+)/ ? $1.to_i : nil}.compact.should == [1, 2, 3]
313
+ @db.creates.must_equal [1111, 2222, 3333]
314
+ @db.version.must_equal 3
315
+ @db.sqls.map{|x| x =~ /\AUPDATE.*(\d+)/ ? $1.to_i : nil}.compact.must_equal [1, 2, 3]
316
316
  end
317
317
 
318
- specify "should be able to tell whether there are outstanding migrations" do
319
- Sequel::Migrator.is_current?(@db, @dirname).should == false
318
+ it "should be able to tell whether there are outstanding migrations" do
319
+ Sequel::Migrator.is_current?(@db, @dirname).must_equal false
320
320
  Sequel::Migrator.apply(@db, @dirname)
321
- Sequel::Migrator.is_current?(@db, @dirname).should == true
321
+ Sequel::Migrator.is_current?(@db, @dirname).must_equal true
322
322
  end
323
323
 
324
- specify "should have #check_current raise an exception if the migrator is not current" do
325
- proc{Sequel::Migrator.check_current(@db, @dirname)}.should raise_error(Sequel::Migrator::NotCurrentError)
324
+ it "should have #check_current raise an exception if the migrator is not current" do
325
+ proc{Sequel::Migrator.check_current(@db, @dirname)}.must_raise(Sequel::Migrator::NotCurrentError)
326
326
  Sequel::Migrator.apply(@db, @dirname)
327
- proc{Sequel::Migrator.check_current(@db, @dirname)}.should_not raise_error
327
+ Sequel::Migrator.check_current(@db, @dirname)
328
328
  end
329
329
 
330
- specify "should apply migrations correctly in the up direction with target" do
330
+ it "should apply migrations correctly in the up direction with target" do
331
331
  Sequel::Migrator.apply(@db, @dirname, 2)
332
- @db.creates.should == [1111, 2222]
333
- @db.version.should == 2
334
- @db.sqls.map{|x| x =~ /\AUPDATE.*(\d+)/ ? $1.to_i : nil}.compact.should == [1, 2]
332
+ @db.creates.must_equal [1111, 2222]
333
+ @db.version.must_equal 2
334
+ @db.sqls.map{|x| x =~ /\AUPDATE.*(\d+)/ ? $1.to_i : nil}.compact.must_equal [1, 2]
335
335
  end
336
336
 
337
- specify "should apply migrations correctly in the up direction with target and existing" do
337
+ it "should apply migrations correctly in the up direction with target and existing" do
338
338
  Sequel::Migrator.apply(@db, @dirname, 2, 1)
339
- @db.creates.should == [2222]
340
- @db.version.should == 2
341
- @db.sqls.map{|x| x =~ /\AUPDATE.*(\d+)/ ? $1.to_i : nil}.compact.should == [2]
339
+ @db.creates.must_equal [2222]
340
+ @db.version.must_equal 2
341
+ @db.sqls.map{|x| x =~ /\AUPDATE.*(\d+)/ ? $1.to_i : nil}.compact.must_equal [2]
342
342
  end
343
343
 
344
- specify "should apply migrations correctly in the down direction with target" do
344
+ it "should apply migrations correctly in the down direction with target" do
345
345
  @db.create_table(:schema_info){Integer :version, :default=>0}
346
346
  @db[:schema_info].insert(:version=>3)
347
- @db.version.should == 3
347
+ @db.version.must_equal 3
348
348
  Sequel::Migrator.apply(@db, @dirname, 0)
349
- @db.drops.should == [3333, 2222, 1111]
350
- @db.version.should == 0
351
- @db.sqls.map{|x| x =~ /\AUPDATE.*(\d+)/ ? $1.to_i : nil}.compact.should == [2, 1, 0]
349
+ @db.drops.must_equal [3333, 2222, 1111]
350
+ @db.version.must_equal 0
351
+ @db.sqls.map{|x| x =~ /\AUPDATE.*(\d+)/ ? $1.to_i : nil}.compact.must_equal [2, 1, 0]
352
352
  end
353
353
 
354
- specify "should apply migrations correctly in the down direction with target and existing" do
354
+ it "should apply migrations correctly in the down direction with target and existing" do
355
355
  Sequel::Migrator.apply(@db, @dirname, 1, 2)
356
- @db.drops.should == [2222]
357
- @db.version.should == 1
358
- @db.sqls.map{|x| x =~ /\AUPDATE.*(\d+)/ ? $1.to_i : nil}.compact.should == [1]
356
+ @db.drops.must_equal [2222]
357
+ @db.version.must_equal 1
358
+ @db.sqls.map{|x| x =~ /\AUPDATE.*(\d+)/ ? $1.to_i : nil}.compact.must_equal [1]
359
359
  end
360
360
 
361
- specify "should return the target version" do
362
- Sequel::Migrator.apply(@db, @dirname, 3, 2).should == 3
363
- Sequel::Migrator.apply(@db, @dirname, 0).should == 0
364
- Sequel::Migrator.apply(@db, @dirname).should == 3
361
+ it "should return the target version" do
362
+ Sequel::Migrator.apply(@db, @dirname, 3, 2).must_equal 3
363
+ Sequel::Migrator.apply(@db, @dirname, 0).must_equal 0
364
+ Sequel::Migrator.apply(@db, @dirname).must_equal 3
365
365
  end
366
366
 
367
- specify "should use IntegerMigrator if IntegerMigrator.apply called, even for timestamped migration directory" do
368
- proc{Sequel::IntegerMigrator.apply(@db, "spec/files/timestamped_migrations")}.should raise_error(Sequel::Migrator::Error)
367
+ it "should use IntegerMigrator if IntegerMigrator.apply called, even for timestamped migration directory" do
368
+ proc{Sequel::IntegerMigrator.apply(@db, "spec/files/timestamped_migrations")}.must_raise(Sequel::Migrator::Error)
369
369
  end
370
370
 
371
- specify "should not use transactions by default" do
371
+ it "should not use transactions by default" do
372
372
  Sequel::Migrator.apply(@db, "spec/files/transaction_unspecified_migrations")
373
- @db.sqls.should == ["CREATE TABLE schema_info (version integer DEFAULT 0 NOT NULL)", "SELECT 1 AS one FROM schema_info LIMIT 1", "INSERT INTO schema_info (version) VALUES (0)", "SELECT version FROM schema_info LIMIT 1", "CREATE TABLE sm11111 (smc1 integer)", "UPDATE schema_info SET version = 1", "CREATE TABLE sm (smc1 integer)", "UPDATE schema_info SET version = 2"]
373
+ @db.sqls.must_equal ["CREATE TABLE schema_info (version integer DEFAULT 0 NOT NULL)", "SELECT 1 AS one FROM schema_info LIMIT 1", "INSERT INTO schema_info (version) VALUES (0)", "SELECT version FROM schema_info LIMIT 1", "CREATE TABLE sm11111 (smc1 integer)", "UPDATE schema_info SET version = 1", "CREATE TABLE sm (smc1 integer)", "UPDATE schema_info SET version = 2"]
374
374
  end
375
375
 
376
- specify "should use transactions by default if the database supports transactional ddl" do
376
+ it "should use transactions by default if the database supports transactional ddl" do
377
377
  @db.meta_def(:supports_transactional_ddl?){true}
378
378
  Sequel::Migrator.apply(@db, "spec/files/transaction_unspecified_migrations")
379
- @db.sqls.should == ["CREATE TABLE schema_info (version integer DEFAULT 0 NOT NULL)", "SELECT 1 AS one FROM schema_info LIMIT 1", "INSERT INTO schema_info (version) VALUES (0)", "SELECT version FROM schema_info LIMIT 1", "BEGIN", "CREATE TABLE sm11111 (smc1 integer)", "UPDATE schema_info SET version = 1", "COMMIT", "BEGIN", "CREATE TABLE sm (smc1 integer)", "UPDATE schema_info SET version = 2", "COMMIT"]
379
+ @db.sqls.must_equal ["CREATE TABLE schema_info (version integer DEFAULT 0 NOT NULL)", "SELECT 1 AS one FROM schema_info LIMIT 1", "INSERT INTO schema_info (version) VALUES (0)", "SELECT version FROM schema_info LIMIT 1", "BEGIN", "CREATE TABLE sm11111 (smc1 integer)", "UPDATE schema_info SET version = 1", "COMMIT", "BEGIN", "CREATE TABLE sm (smc1 integer)", "UPDATE schema_info SET version = 2", "COMMIT"]
380
380
  end
381
381
 
382
- specify "should respect transaction use on a per migration basis" do
382
+ it "should respect transaction use on a per migration basis" do
383
383
  @db.meta_def(:supports_transactional_ddl?){true}
384
384
  Sequel::Migrator.apply(@db, "spec/files/transaction_specified_migrations")
385
- @db.sqls.should == ["CREATE TABLE schema_info (version integer DEFAULT 0 NOT NULL)", "SELECT 1 AS one FROM schema_info LIMIT 1", "INSERT INTO schema_info (version) VALUES (0)", "SELECT version FROM schema_info LIMIT 1", "BEGIN", "CREATE TABLE sm11111 (smc1 integer)", "UPDATE schema_info SET version = 1", "COMMIT", "CREATE TABLE sm (smc1 integer)", "UPDATE schema_info SET version = 2"]
385
+ @db.sqls.must_equal ["CREATE TABLE schema_info (version integer DEFAULT 0 NOT NULL)", "SELECT 1 AS one FROM schema_info LIMIT 1", "INSERT INTO schema_info (version) VALUES (0)", "SELECT version FROM schema_info LIMIT 1", "BEGIN", "CREATE TABLE sm11111 (smc1 integer)", "UPDATE schema_info SET version = 1", "COMMIT", "CREATE TABLE sm (smc1 integer)", "UPDATE schema_info SET version = 2"]
386
386
  end
387
387
 
388
- specify "should force transactions if enabled in the migrator" do
388
+ it "should force transactions if enabled in the migrator" do
389
389
  Sequel::Migrator.run(@db, "spec/files/transaction_specified_migrations", :use_transactions=>true)
390
- @db.sqls.should == ["CREATE TABLE schema_info (version integer DEFAULT 0 NOT NULL)", "SELECT 1 AS one FROM schema_info LIMIT 1", "INSERT INTO schema_info (version) VALUES (0)", "SELECT version FROM schema_info LIMIT 1", "BEGIN", "CREATE TABLE sm11111 (smc1 integer)", "UPDATE schema_info SET version = 1", "COMMIT", "BEGIN", "CREATE TABLE sm (smc1 integer)", "UPDATE schema_info SET version = 2", "COMMIT"]
390
+ @db.sqls.must_equal ["CREATE TABLE schema_info (version integer DEFAULT 0 NOT NULL)", "SELECT 1 AS one FROM schema_info LIMIT 1", "INSERT INTO schema_info (version) VALUES (0)", "SELECT version FROM schema_info LIMIT 1", "BEGIN", "CREATE TABLE sm11111 (smc1 integer)", "UPDATE schema_info SET version = 1", "COMMIT", "BEGIN", "CREATE TABLE sm (smc1 integer)", "UPDATE schema_info SET version = 2", "COMMIT"]
391
391
  end
392
392
 
393
- specify "should not use transactions if disabled in the migrator" do
393
+ it "should not use transactions if disabled in the migrator" do
394
394
  Sequel::Migrator.run(@db, "spec/files/transaction_unspecified_migrations", :use_transactions=>false)
395
- @db.sqls.should == ["CREATE TABLE schema_info (version integer DEFAULT 0 NOT NULL)", "SELECT 1 AS one FROM schema_info LIMIT 1", "INSERT INTO schema_info (version) VALUES (0)", "SELECT version FROM schema_info LIMIT 1", "CREATE TABLE sm11111 (smc1 integer)", "UPDATE schema_info SET version = 1", "CREATE TABLE sm (smc1 integer)", "UPDATE schema_info SET version = 2"]
395
+ @db.sqls.must_equal ["CREATE TABLE schema_info (version integer DEFAULT 0 NOT NULL)", "SELECT 1 AS one FROM schema_info LIMIT 1", "INSERT INTO schema_info (version) VALUES (0)", "SELECT version FROM schema_info LIMIT 1", "CREATE TABLE sm11111 (smc1 integer)", "UPDATE schema_info SET version = 1", "CREATE TABLE sm (smc1 integer)", "UPDATE schema_info SET version = 2"]
396
396
  end
397
397
  end
398
398
 
@@ -474,239 +474,239 @@ describe "Sequel::TimestampMigrator" do
474
474
  Object.send(:remove_const, "CreateAlbums") if Object.const_defined?("CreateAlbums")
475
475
  end
476
476
 
477
- specify "should handle migrating up or down all the way" do
477
+ it "should handle migrating up or down all the way" do
478
478
  @dir = 'spec/files/timestamped_migrations'
479
479
  @m.apply(@db, @dir)
480
- [:schema_migrations, :sm1111, :sm2222, :sm3333].each{|n| @db.table_exists?(n).should == true}
481
- @db[:schema_migrations].select_order_map(:filename).should == %w'1273253849_create_sessions.rb 1273253851_create_nodes.rb 1273253853_3_create_users.rb'
480
+ [:schema_migrations, :sm1111, :sm2222, :sm3333].each{|n| @db.table_exists?(n).must_equal true}
481
+ @db[:schema_migrations].select_order_map(:filename).must_equal %w'1273253849_create_sessions.rb 1273253851_create_nodes.rb 1273253853_3_create_users.rb'
482
482
  @m.apply(@db, @dir, 0)
483
- [:sm1111, :sm2222, :sm3333].each{|n| @db.table_exists?(n).should == false}
484
- @db[:schema_migrations].select_order_map(:filename).should == []
483
+ [:sm1111, :sm2222, :sm3333].each{|n| @db.table_exists?(n).must_equal false}
484
+ @db[:schema_migrations].select_order_map(:filename).must_equal []
485
485
  end
486
486
 
487
- specify "should handle migrating up or down to specific timestamps" do
487
+ it "should handle migrating up or down to specific timestamps" do
488
488
  @dir = 'spec/files/timestamped_migrations'
489
489
  @m.apply(@db, @dir, 1273253851)
490
- [:schema_migrations, :sm1111, :sm2222].each{|n| @db.table_exists?(n).should == true}
491
- @db.table_exists?(:sm3333).should == false
492
- @db[:schema_migrations].select_order_map(:filename).should == %w'1273253849_create_sessions.rb 1273253851_create_nodes.rb'
490
+ [:schema_migrations, :sm1111, :sm2222].each{|n| @db.table_exists?(n).must_equal true}
491
+ @db.table_exists?(:sm3333).must_equal false
492
+ @db[:schema_migrations].select_order_map(:filename).must_equal %w'1273253849_create_sessions.rb 1273253851_create_nodes.rb'
493
493
  @m.apply(@db, @dir, 1273253849)
494
- [:sm2222, :sm3333].each{|n| @db.table_exists?(n).should == false}
495
- @db.table_exists?(:sm1111).should == true
496
- @db[:schema_migrations].select_order_map(:filename).should == %w'1273253849_create_sessions.rb'
494
+ [:sm2222, :sm3333].each{|n| @db.table_exists?(n).must_equal false}
495
+ @db.table_exists?(:sm1111).must_equal true
496
+ @db[:schema_migrations].select_order_map(:filename).must_equal %w'1273253849_create_sessions.rb'
497
497
  end
498
498
 
499
- specify "should not be current when there are migrations to apply" do
499
+ it "should not be current when there are migrations to apply" do
500
500
  @dir = 'spec/files/timestamped_migrations'
501
501
  @m.apply(@db, @dir)
502
- @m.is_current?(@db, @dir).should == true
502
+ @m.is_current?(@db, @dir).must_equal true
503
503
  @dir = 'spec/files/interleaved_timestamped_migrations'
504
- @m.is_current?(@db, @dir).should == false
504
+ @m.is_current?(@db, @dir).must_equal false
505
505
  end
506
506
 
507
- specify "should raise an exception if the migrator is not current" do
507
+ it "should raise an exception if the migrator is not current" do
508
508
  @dir = 'spec/files/timestamped_migrations'
509
509
  @m.apply(@db, @dir)
510
- proc{@m.check_current(@db, @dir)}.should_not raise_error
510
+ @m.check_current(@db, @dir)
511
511
  @dir = 'spec/files/interleaved_timestamped_migrations'
512
- proc{@m.check_current(@db, @dir)}.should raise_error(Sequel::Migrator::NotCurrentError)
512
+ proc{@m.check_current(@db, @dir)}.must_raise(Sequel::Migrator::NotCurrentError)
513
513
  end
514
514
 
515
- specify "should apply all missing files when migrating up" do
515
+ it "should apply all missing files when migrating up" do
516
516
  @dir = 'spec/files/timestamped_migrations'
517
517
  @m.apply(@db, @dir)
518
518
  @dir = 'spec/files/interleaved_timestamped_migrations'
519
519
  @m.apply(@db, @dir)
520
- [:schema_migrations, :sm1111, :sm1122, :sm2222, :sm2233, :sm3333].each{|n| @db.table_exists?(n).should == true}
521
- @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'
520
+ [:schema_migrations, :sm1111, :sm1122, :sm2222, :sm2233, :sm3333].each{|n| @db.table_exists?(n).must_equal true}
521
+ @db[:schema_migrations].select_order_map(:filename).must_equal %w'1273253849_create_sessions.rb 1273253850_create_artists.rb 1273253851_create_nodes.rb 1273253852_create_albums.rb 1273253853_3_create_users.rb'
522
522
  end
523
523
 
524
- specify "should not apply down action to migrations where up action hasn't been applied" do
524
+ it "should not apply down action to migrations where up action hasn't been applied" do
525
525
  @dir = 'spec/files/timestamped_migrations'
526
526
  @m.apply(@db, @dir)
527
527
  @dir = 'spec/files/interleaved_timestamped_migrations'
528
528
  @m.apply(@db, @dir, 0)
529
- [:sm1111, :sm1122, :sm2222, :sm2233, :sm3333].each{|n| @db.table_exists?(n).should == false}
530
- @db[:schema_migrations].select_order_map(:filename).should == []
529
+ [:sm1111, :sm1122, :sm2222, :sm2233, :sm3333].each{|n| @db.table_exists?(n).must_equal false}
530
+ @db[:schema_migrations].select_order_map(:filename).must_equal []
531
531
  end
532
532
 
533
- specify "should handle updating to a specific timestamp when interleaving migrations" do
533
+ it "should handle updating to a specific timestamp when interleaving migrations" do
534
534
  @dir = 'spec/files/timestamped_migrations'
535
535
  @m.apply(@db, @dir)
536
536
  @dir = 'spec/files/interleaved_timestamped_migrations'
537
537
  @m.apply(@db, @dir, 1273253851)
538
- [:schema_migrations, :sm1111, :sm1122, :sm2222].each{|n| @db.table_exists?(n).should == true}
539
- [:sm2233, :sm3333].each{|n| @db.table_exists?(n).should == false}
540
- @db[:schema_migrations].select_order_map(:filename).should == %w'1273253849_create_sessions.rb 1273253850_create_artists.rb 1273253851_create_nodes.rb'
538
+ [:schema_migrations, :sm1111, :sm1122, :sm2222].each{|n| @db.table_exists?(n).must_equal true}
539
+ [:sm2233, :sm3333].each{|n| @db.table_exists?(n).must_equal false}
540
+ @db[:schema_migrations].select_order_map(:filename).must_equal %w'1273253849_create_sessions.rb 1273253850_create_artists.rb 1273253851_create_nodes.rb'
541
541
  end
542
542
 
543
- specify "should correctly update schema_migrations table when an error occurs when migrating up or down" do
543
+ it "should correctly update schema_migrations table when an error occurs when migrating up or down" do
544
544
  @dir = 'spec/files/bad_timestamped_migrations'
545
- proc{@m.apply(@db, @dir)}.should raise_error
546
- [:schema_migrations, :sm1111, :sm2222].each{|n| @db.table_exists?(n).should == true}
547
- @db.table_exists?(:sm3333).should == false
548
- @db[:schema_migrations].select_order_map(:filename).should == %w'1273253849_create_sessions.rb 1273253851_create_nodes.rb'
549
- proc{@m.apply(@db, @dir, 0)}.should raise_error
550
- [:sm2222, :sm3333].each{|n| @db.table_exists?(n).should == false}
551
- @db.table_exists?(:sm1111).should == true
552
- @db[:schema_migrations].select_order_map(:filename).should == %w'1273253849_create_sessions.rb'
545
+ proc{@m.apply(@db, @dir)}.must_raise NoMethodError
546
+ [:schema_migrations, :sm1111, :sm2222].each{|n| @db.table_exists?(n).must_equal true}
547
+ @db.table_exists?(:sm3333).must_equal false
548
+ @db[:schema_migrations].select_order_map(:filename).must_equal %w'1273253849_create_sessions.rb 1273253851_create_nodes.rb'
549
+ proc{@m.apply(@db, @dir, 0)}.must_raise NoMethodError
550
+ [:sm2222, :sm3333].each{|n| @db.table_exists?(n).must_equal false}
551
+ @db.table_exists?(:sm1111).must_equal true
552
+ @db[:schema_migrations].select_order_map(:filename).must_equal %w'1273253849_create_sessions.rb'
553
553
  end
554
554
 
555
- specify "should handle multiple migrations with the same timestamp correctly" do
555
+ it "should handle multiple migrations with the same timestamp correctly" do
556
556
  @dir = 'spec/files/duplicate_timestamped_migrations'
557
557
  @m.apply(@db, @dir)
558
- [:schema_migrations, :sm1111, :sm2222, :sm3333].each{|n| @db.table_exists?(n).should == true}
559
- @db[:schema_migrations].select_order_map(:filename).should == %w'1273253849_create_sessions.rb 1273253853_create_nodes.rb 1273253853_create_users.rb'
558
+ [:schema_migrations, :sm1111, :sm2222, :sm3333].each{|n| @db.table_exists?(n).must_equal true}
559
+ @db[:schema_migrations].select_order_map(:filename).must_equal %w'1273253849_create_sessions.rb 1273253853_create_nodes.rb 1273253853_create_users.rb'
560
560
  @m.apply(@db, @dir, 1273253853)
561
- [:sm1111, :sm2222, :sm3333].each{|n| @db.table_exists?(n).should == true}
562
- @db[:schema_migrations].select_order_map(:filename).should == %w'1273253849_create_sessions.rb 1273253853_create_nodes.rb 1273253853_create_users.rb'
561
+ [:sm1111, :sm2222, :sm3333].each{|n| @db.table_exists?(n).must_equal true}
562
+ @db[:schema_migrations].select_order_map(:filename).must_equal %w'1273253849_create_sessions.rb 1273253853_create_nodes.rb 1273253853_create_users.rb'
563
563
  @m.apply(@db, @dir, 1273253849)
564
- [:sm1111].each{|n| @db.table_exists?(n).should == true}
565
- [:sm2222, :sm3333].each{|n| @db.table_exists?(n).should == false}
566
- @db[:schema_migrations].select_order_map(:filename).should == %w'1273253849_create_sessions.rb'
564
+ [:sm1111].each{|n| @db.table_exists?(n).must_equal true}
565
+ [:sm2222, :sm3333].each{|n| @db.table_exists?(n).must_equal false}
566
+ @db[:schema_migrations].select_order_map(:filename).must_equal %w'1273253849_create_sessions.rb'
567
567
  @m.apply(@db, @dir, 1273253848)
568
- [:sm1111, :sm2222, :sm3333].each{|n| @db.table_exists?(n).should == false}
569
- @db[:schema_migrations].select_order_map(:filename).should == []
568
+ [:sm1111, :sm2222, :sm3333].each{|n| @db.table_exists?(n).must_equal false}
569
+ @db[:schema_migrations].select_order_map(:filename).must_equal []
570
570
  end
571
571
 
572
- specify "should convert schema_info table to schema_migrations table" do
572
+ it "should convert schema_info table to schema_migrations table" do
573
573
  @dir = 'spec/files/integer_migrations'
574
574
  @m.apply(@db, @dir)
575
- [:schema_info, :sm1111, :sm2222, :sm3333].each{|n| @db.table_exists?(n).should == true}
576
- [:schema_migrations, :sm1122, :sm2233].each{|n| @db.table_exists?(n).should == false}
575
+ [:schema_info, :sm1111, :sm2222, :sm3333].each{|n| @db.table_exists?(n).must_equal true}
576
+ [:schema_migrations, :sm1122, :sm2233].each{|n| @db.table_exists?(n).must_equal false}
577
577
 
578
578
  @dir = 'spec/files/convert_to_timestamp_migrations'
579
579
  @m.apply(@db, @dir)
580
- [:schema_info, :sm1111, :sm2222, :sm3333, :schema_migrations, :sm1122, :sm2233].each{|n| @db.table_exists?(n).should == true}
581
- @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'
580
+ [:schema_info, :sm1111, :sm2222, :sm3333, :schema_migrations, :sm1122, :sm2233].each{|n| @db.table_exists?(n).must_equal true}
581
+ @db[:schema_migrations].select_order_map(:filename).must_equal %w'001_create_sessions.rb 002_create_nodes.rb 003_3_create_users.rb 1273253850_create_artists.rb 1273253852_create_albums.rb'
582
582
 
583
583
  @m.apply(@db, @dir, 4)
584
- [:schema_info, :schema_migrations, :sm1111, :sm2222, :sm3333].each{|n| @db.table_exists?(n).should == true}
585
- [:sm1122, :sm2233].each{|n| @db.table_exists?(n).should == false}
586
- @db[:schema_migrations].select_order_map(:filename).should == %w'001_create_sessions.rb 002_create_nodes.rb 003_3_create_users.rb'
584
+ [:schema_info, :schema_migrations, :sm1111, :sm2222, :sm3333].each{|n| @db.table_exists?(n).must_equal true}
585
+ [:sm1122, :sm2233].each{|n| @db.table_exists?(n).must_equal false}
586
+ @db[:schema_migrations].select_order_map(:filename).must_equal %w'001_create_sessions.rb 002_create_nodes.rb 003_3_create_users.rb'
587
587
 
588
588
  @m.apply(@db, @dir, 0)
589
- [:schema_info, :schema_migrations].each{|n| @db.table_exists?(n).should == true}
590
- [:sm1111, :sm2222, :sm3333, :sm1122, :sm2233].each{|n| @db.table_exists?(n).should == false}
591
- @db[:schema_migrations].select_order_map(:filename).should == []
589
+ [:schema_info, :schema_migrations].each{|n| @db.table_exists?(n).must_equal true}
590
+ [:sm1111, :sm2222, :sm3333, :sm1122, :sm2233].each{|n| @db.table_exists?(n).must_equal false}
591
+ @db[:schema_migrations].select_order_map(:filename).must_equal []
592
592
  end
593
593
 
594
- specify "should handle unapplied migrations when migrating schema_info table to schema_migrations table" do
594
+ it "should handle unapplied migrations when migrating schema_info table to schema_migrations table" do
595
595
  @dir = 'spec/files/integer_migrations'
596
596
  @m.apply(@db, @dir, 2)
597
- [:schema_info, :sm1111, :sm2222].each{|n| @db.table_exists?(n).should == true}
598
- [:schema_migrations, :sm3333, :sm1122, :sm2233].each{|n| @db.table_exists?(n).should == false}
597
+ [:schema_info, :sm1111, :sm2222].each{|n| @db.table_exists?(n).must_equal true}
598
+ [:schema_migrations, :sm3333, :sm1122, :sm2233].each{|n| @db.table_exists?(n).must_equal false}
599
599
 
600
600
  @dir = 'spec/files/convert_to_timestamp_migrations'
601
601
  @m.apply(@db, @dir, 1273253850)
602
- [:schema_info, :sm1111, :sm2222, :sm3333, :schema_migrations, :sm1122].each{|n| @db.table_exists?(n).should == true}
603
- [:sm2233].each{|n| @db.table_exists?(n).should == false}
604
- @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
+ [:schema_info, :sm1111, :sm2222, :sm3333, :schema_migrations, :sm1122].each{|n| @db.table_exists?(n).must_equal true}
603
+ [:sm2233].each{|n| @db.table_exists?(n).must_equal false}
604
+ @db[:schema_migrations].select_order_map(:filename).must_equal %w'001_create_sessions.rb 002_create_nodes.rb 003_3_create_users.rb 1273253850_create_artists.rb'
605
605
  end
606
606
 
607
- specify "should handle unapplied migrations when migrating schema_info table to schema_migrations table and target is less than last integer migration version" do
607
+ it "should handle unapplied migrations when migrating schema_info table to schema_migrations table and target is less than last integer migration version" do
608
608
  @dir = 'spec/files/integer_migrations'
609
609
  @m.apply(@db, @dir, 1)
610
- [:schema_info, :sm1111].each{|n| @db.table_exists?(n).should == true}
611
- [:schema_migrations, :sm2222, :sm3333, :sm1122, :sm2233].each{|n| @db.table_exists?(n).should == false}
610
+ [:schema_info, :sm1111].each{|n| @db.table_exists?(n).must_equal true}
611
+ [:schema_migrations, :sm2222, :sm3333, :sm1122, :sm2233].each{|n| @db.table_exists?(n).must_equal false}
612
612
 
613
613
  @dir = 'spec/files/convert_to_timestamp_migrations'
614
614
  @m.apply(@db, @dir, 2)
615
- [:schema_info, :sm1111, :sm2222, :schema_migrations].each{|n| @db.table_exists?(n).should == true}
616
- [:sm3333, :sm1122, :sm2233].each{|n| @db.table_exists?(n).should == false}
617
- @db[:schema_migrations].select_order_map(:filename).should == %w'001_create_sessions.rb 002_create_nodes.rb'
615
+ [:schema_info, :sm1111, :sm2222, :schema_migrations].each{|n| @db.table_exists?(n).must_equal true}
616
+ [:sm3333, :sm1122, :sm2233].each{|n| @db.table_exists?(n).must_equal false}
617
+ @db[:schema_migrations].select_order_map(:filename).must_equal %w'001_create_sessions.rb 002_create_nodes.rb'
618
618
 
619
619
  @m.apply(@db, @dir)
620
- [:schema_info, :sm1111, :sm2222, :schema_migrations, :sm3333, :sm1122, :sm2233].each{|n| @db.table_exists?(n).should == true}
621
- @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'
620
+ [:schema_info, :sm1111, :sm2222, :schema_migrations, :sm3333, :sm1122, :sm2233].each{|n| @db.table_exists?(n).must_equal true}
621
+ @db[:schema_migrations].select_order_map(:filename).must_equal %w'001_create_sessions.rb 002_create_nodes.rb 003_3_create_users.rb 1273253850_create_artists.rb 1273253852_create_albums.rb'
622
622
  end
623
623
 
624
- specify "should raise error for applied migrations not in file system" do
624
+ it "should raise error for applied migrations not in file system" do
625
625
  @dir = 'spec/files/timestamped_migrations'
626
626
  @m.apply(@db, @dir)
627
- [:schema_migrations, :sm1111, :sm2222, :sm3333].each{|n| @db.table_exists?(n).should == true}
628
- @db[:schema_migrations].select_order_map(:filename).should == %w'1273253849_create_sessions.rb 1273253851_create_nodes.rb 1273253853_3_create_users.rb'
627
+ [:schema_migrations, :sm1111, :sm2222, :sm3333].each{|n| @db.table_exists?(n).must_equal true}
628
+ @db[:schema_migrations].select_order_map(:filename).must_equal %w'1273253849_create_sessions.rb 1273253851_create_nodes.rb 1273253853_3_create_users.rb'
629
629
 
630
630
  @dir = 'spec/files/missing_timestamped_migrations'
631
- proc{@m.apply(@db, @dir, 0)}.should raise_error(Sequel::Migrator::Error)
632
- [:schema_migrations, :sm1111, :sm2222, :sm3333].each{|n| @db.table_exists?(n).should == true}
633
- @db[:schema_migrations].select_order_map(:filename).should == %w'1273253849_create_sessions.rb 1273253851_create_nodes.rb 1273253853_3_create_users.rb'
631
+ proc{@m.apply(@db, @dir, 0)}.must_raise(Sequel::Migrator::Error)
632
+ [:schema_migrations, :sm1111, :sm2222, :sm3333].each{|n| @db.table_exists?(n).must_equal true}
633
+ @db[:schema_migrations].select_order_map(:filename).must_equal %w'1273253849_create_sessions.rb 1273253851_create_nodes.rb 1273253853_3_create_users.rb'
634
634
  end
635
635
 
636
- specify "should not raise error for applied migrations not in file system if :allow_missing_migration_files is true" do
636
+ it "should not raise error for applied migrations not in file system if :allow_missing_migration_files is true" do
637
637
  @dir = 'spec/files/timestamped_migrations'
638
638
  @m.apply(@db, @dir)
639
- [:schema_migrations, :sm1111, :sm2222, :sm3333].each{|n| @db.table_exists?(n).should == true}
640
- @db[:schema_migrations].select_order_map(:filename).should == %w'1273253849_create_sessions.rb 1273253851_create_nodes.rb 1273253853_3_create_users.rb'
639
+ [:schema_migrations, :sm1111, :sm2222, :sm3333].each{|n| @db.table_exists?(n).must_equal true}
640
+ @db[:schema_migrations].select_order_map(:filename).must_equal %w'1273253849_create_sessions.rb 1273253851_create_nodes.rb 1273253853_3_create_users.rb'
641
641
 
642
642
  @dir = 'spec/files/missing_timestamped_migrations'
643
- proc{@m.run(@db, @dir, :allow_missing_migration_files => true)}.should_not raise_error
644
- [:schema_migrations, :sm1111, :sm2222, :sm3333].each{|n| @db.table_exists?(n).should == true}
645
- @db[:schema_migrations].select_order_map(:filename).should == %w'1273253849_create_sessions.rb 1273253851_create_nodes.rb 1273253853_3_create_users.rb'
643
+ @m.run(@db, @dir, :allow_missing_migration_files => true)
644
+ [:schema_migrations, :sm1111, :sm2222, :sm3333].each{|n| @db.table_exists?(n).must_equal true}
645
+ @db[:schema_migrations].select_order_map(:filename).must_equal %w'1273253849_create_sessions.rb 1273253851_create_nodes.rb 1273253853_3_create_users.rb'
646
646
  end
647
647
 
648
- specify "should raise error missing column name in existing schema_migrations table" do
648
+ it "should raise error missing column name in existing schema_migrations table" do
649
649
  @dir = 'spec/files/timestamped_migrations'
650
650
  @m.apply(@db, @dir)
651
- proc{@m.run(@db, @dir, :column=>:fn)}.should raise_error(Sequel::Migrator::Error)
651
+ proc{@m.run(@db, @dir, :column=>:fn)}.must_raise(Sequel::Migrator::Error)
652
652
  end
653
653
 
654
- specify "should handle migration filenames in a case insensitive manner" do
654
+ it "should handle migration filenames in a case insensitive manner" do
655
655
  @dir = 'spec/files/uppercase_timestamped_migrations'
656
656
  @m.apply(@db, @dir)
657
- [:schema_migrations, :sm1111, :sm2222, :sm3333].each{|n| @db.table_exists?(n).should == true}
658
- @db[:schema_migrations].select_order_map(:filename).should == %w'1273253849_create_sessions.rb 1273253851_create_nodes.rb 1273253853_3_create_users.rb'
657
+ [:schema_migrations, :sm1111, :sm2222, :sm3333].each{|n| @db.table_exists?(n).must_equal true}
658
+ @db[:schema_migrations].select_order_map(:filename).must_equal %w'1273253849_create_sessions.rb 1273253851_create_nodes.rb 1273253853_3_create_users.rb'
659
659
  @dir = 'spec/files/timestamped_migrations'
660
660
  @m.apply(@db, @dir, 0)
661
- [:sm1111, :sm2222, :sm3333].each{|n| @db.table_exists?(n).should == false}
662
- @db[:schema_migrations].select_order_map(:filename).should == []
661
+ [:sm1111, :sm2222, :sm3333].each{|n| @db.table_exists?(n).must_equal false}
662
+ @db[:schema_migrations].select_order_map(:filename).must_equal []
663
663
  end
664
664
 
665
- specify "should :table and :column options" do
665
+ it "should :table and :column options" do
666
666
  @dir = 'spec/files/timestamped_migrations'
667
667
  @m.run(@db, @dir, :table=>:sm, :column=>:fn)
668
- [:sm, :sm1111, :sm2222, :sm3333].each{|n| @db.table_exists?(n).should == true}
669
- @db[:sm].select_order_map(:filename).should == %w'1273253849_create_sessions.rb 1273253851_create_nodes.rb 1273253853_3_create_users.rb'
668
+ [:sm, :sm1111, :sm2222, :sm3333].each{|n| @db.table_exists?(n).must_equal true}
669
+ @db[:sm].select_order_map(:filename).must_equal %w'1273253849_create_sessions.rb 1273253851_create_nodes.rb 1273253853_3_create_users.rb'
670
670
  @m.run(@db, @dir, :target=>0, :table=>:sm, :column=>:fn)
671
- [:sm1111, :sm2222, :sm3333].each{|n| @db.table_exists?(n).should == false}
672
- @db[:sm].select_order_map(:fn).should == []
671
+ [:sm1111, :sm2222, :sm3333].each{|n| @db.table_exists?(n).must_equal false}
672
+ @db[:sm].select_order_map(:fn).must_equal []
673
673
  end
674
674
 
675
- specify "should return nil" do
675
+ it "should return nil" do
676
676
  @dir = 'spec/files/timestamped_migrations'
677
- @m.apply(@db, @dir, 1273253850).should == nil
678
- @m.apply(@db, @dir, 0).should == nil
679
- @m.apply(@db, @dir).should == nil
677
+ @m.apply(@db, @dir, 1273253850).must_equal nil
678
+ @m.apply(@db, @dir, 0).must_equal nil
679
+ @m.apply(@db, @dir).must_equal nil
680
680
  end
681
681
 
682
- specify "should use TimestampMigrator if TimestampMigrator.apply is called even for integer migrations directory" do
682
+ it "should use TimestampMigrator if TimestampMigrator.apply is called even for integer migrations directory" do
683
683
  Sequel::TimestampMigrator.apply(@db, "spec/files/integer_migrations")
684
- @db.sqls.should == ["SELECT NULL AS nil FROM schema_migrations LIMIT 1", "CREATE TABLE schema_migrations (filename varchar(255) PRIMARY KEY)", "SELECT NULL AS nil FROM schema_info LIMIT 1", "SELECT filename FROM schema_migrations ORDER BY filename", "CREATE TABLE sm1111 (smc1 integer)", "INSERT INTO schema_migrations (filename) VALUES ('001_create_sessions.rb')", "CREATE TABLE sm2222 (smc2 integer)", "INSERT INTO schema_migrations (filename) VALUES ('002_create_nodes.rb')", "CREATE TABLE sm3333 (smc3 integer)", "INSERT INTO schema_migrations (filename) VALUES ('003_3_create_users.rb')"]
684
+ @db.sqls.must_equal ["SELECT NULL AS nil FROM schema_migrations LIMIT 1", "CREATE TABLE schema_migrations (filename varchar(255) PRIMARY KEY)", "SELECT NULL AS nil FROM schema_info LIMIT 1", "SELECT filename FROM schema_migrations ORDER BY filename", "CREATE TABLE sm1111 (smc1 integer)", "INSERT INTO schema_migrations (filename) VALUES ('001_create_sessions.rb')", "CREATE TABLE sm2222 (smc2 integer)", "INSERT INTO schema_migrations (filename) VALUES ('002_create_nodes.rb')", "CREATE TABLE sm3333 (smc3 integer)", "INSERT INTO schema_migrations (filename) VALUES ('003_3_create_users.rb')"]
685
685
  end
686
686
 
687
- specify "should not use transactions by default" do
687
+ it "should not use transactions by default" do
688
688
  Sequel::TimestampMigrator.apply(@db, "spec/files/transaction_unspecified_migrations")
689
- @db.sqls.should == ["SELECT NULL AS nil FROM schema_migrations LIMIT 1", "CREATE TABLE schema_migrations (filename varchar(255) PRIMARY KEY)", "SELECT NULL AS nil FROM schema_info LIMIT 1", "SELECT filename FROM schema_migrations ORDER BY filename", "CREATE TABLE sm11111 (smc1 integer)", "INSERT INTO schema_migrations (filename) VALUES ('001_create_alt_basic.rb')", "CREATE TABLE sm (smc1 integer)", "INSERT INTO schema_migrations (filename) VALUES ('002_create_basic.rb')"]
689
+ @db.sqls.must_equal ["SELECT NULL AS nil FROM schema_migrations LIMIT 1", "CREATE TABLE schema_migrations (filename varchar(255) PRIMARY KEY)", "SELECT NULL AS nil FROM schema_info LIMIT 1", "SELECT filename FROM schema_migrations ORDER BY filename", "CREATE TABLE sm11111 (smc1 integer)", "INSERT INTO schema_migrations (filename) VALUES ('001_create_alt_basic.rb')", "CREATE TABLE sm (smc1 integer)", "INSERT INTO schema_migrations (filename) VALUES ('002_create_basic.rb')"]
690
690
  end
691
691
 
692
- specify "should use transactions by default if database supports transactional ddl" do
692
+ it "should use transactions by default if database supports transactional ddl" do
693
693
  @db.meta_def(:supports_transactional_ddl?){true}
694
694
  Sequel::TimestampMigrator.apply(@db, "spec/files/transaction_unspecified_migrations")
695
- @db.sqls.should == ["SELECT NULL AS nil FROM schema_migrations LIMIT 1", "CREATE TABLE schema_migrations (filename varchar(255) PRIMARY KEY)", "SELECT NULL AS nil FROM schema_info LIMIT 1", "SELECT filename FROM schema_migrations ORDER BY filename", "BEGIN", "CREATE TABLE sm11111 (smc1 integer)", "INSERT INTO schema_migrations (filename) VALUES ('001_create_alt_basic.rb')", "COMMIT", "BEGIN", "CREATE TABLE sm (smc1 integer)", "INSERT INTO schema_migrations (filename) VALUES ('002_create_basic.rb')", "COMMIT"]
695
+ @db.sqls.must_equal ["SELECT NULL AS nil FROM schema_migrations LIMIT 1", "CREATE TABLE schema_migrations (filename varchar(255) PRIMARY KEY)", "SELECT NULL AS nil FROM schema_info LIMIT 1", "SELECT filename FROM schema_migrations ORDER BY filename", "BEGIN", "CREATE TABLE sm11111 (smc1 integer)", "INSERT INTO schema_migrations (filename) VALUES ('001_create_alt_basic.rb')", "COMMIT", "BEGIN", "CREATE TABLE sm (smc1 integer)", "INSERT INTO schema_migrations (filename) VALUES ('002_create_basic.rb')", "COMMIT"]
696
696
  end
697
697
 
698
- specify "should support transaction use on a per migration basis" do
698
+ it "should support transaction use on a per migration basis" do
699
699
  Sequel::TimestampMigrator.apply(@db, "spec/files/transaction_specified_migrations")
700
- @db.sqls.should == ["SELECT NULL AS nil FROM schema_migrations LIMIT 1", "CREATE TABLE schema_migrations (filename varchar(255) PRIMARY KEY)", "SELECT NULL AS nil FROM schema_info LIMIT 1", "SELECT filename FROM schema_migrations ORDER BY filename", "BEGIN", "CREATE TABLE sm11111 (smc1 integer)", "INSERT INTO schema_migrations (filename) VALUES ('001_create_alt_basic.rb')", "COMMIT", "CREATE TABLE sm (smc1 integer)", "INSERT INTO schema_migrations (filename) VALUES ('002_create_basic.rb')"]
700
+ @db.sqls.must_equal ["SELECT NULL AS nil FROM schema_migrations LIMIT 1", "CREATE TABLE schema_migrations (filename varchar(255) PRIMARY KEY)", "SELECT NULL AS nil FROM schema_info LIMIT 1", "SELECT filename FROM schema_migrations ORDER BY filename", "BEGIN", "CREATE TABLE sm11111 (smc1 integer)", "INSERT INTO schema_migrations (filename) VALUES ('001_create_alt_basic.rb')", "COMMIT", "CREATE TABLE sm (smc1 integer)", "INSERT INTO schema_migrations (filename) VALUES ('002_create_basic.rb')"]
701
701
  end
702
702
 
703
- specify "should force transactions if enabled by the migrator" do
703
+ it "should force transactions if enabled by the migrator" do
704
704
  Sequel::TimestampMigrator.run(@db, "spec/files/transaction_specified_migrations", :use_transactions=>true)
705
- @db.sqls.should == ["SELECT NULL AS nil FROM schema_migrations LIMIT 1", "CREATE TABLE schema_migrations (filename varchar(255) PRIMARY KEY)", "SELECT NULL AS nil FROM schema_info LIMIT 1", "SELECT filename FROM schema_migrations ORDER BY filename", "BEGIN", "CREATE TABLE sm11111 (smc1 integer)", "INSERT INTO schema_migrations (filename) VALUES ('001_create_alt_basic.rb')", "COMMIT", "BEGIN", "CREATE TABLE sm (smc1 integer)", "INSERT INTO schema_migrations (filename) VALUES ('002_create_basic.rb')", "COMMIT"]
705
+ @db.sqls.must_equal ["SELECT NULL AS nil FROM schema_migrations LIMIT 1", "CREATE TABLE schema_migrations (filename varchar(255) PRIMARY KEY)", "SELECT NULL AS nil FROM schema_info LIMIT 1", "SELECT filename FROM schema_migrations ORDER BY filename", "BEGIN", "CREATE TABLE sm11111 (smc1 integer)", "INSERT INTO schema_migrations (filename) VALUES ('001_create_alt_basic.rb')", "COMMIT", "BEGIN", "CREATE TABLE sm (smc1 integer)", "INSERT INTO schema_migrations (filename) VALUES ('002_create_basic.rb')", "COMMIT"]
706
706
  end
707
707
 
708
- specify "should not use transactions if disabled in the migrator" do
708
+ it "should not use transactions if disabled in the migrator" do
709
709
  Sequel::TimestampMigrator.run(@db, "spec/files/transaction_unspecified_migrations", :use_transactions=>false)
710
- @db.sqls.should == ["SELECT NULL AS nil FROM schema_migrations LIMIT 1", "CREATE TABLE schema_migrations (filename varchar(255) PRIMARY KEY)", "SELECT NULL AS nil FROM schema_info LIMIT 1", "SELECT filename FROM schema_migrations ORDER BY filename", "CREATE TABLE sm11111 (smc1 integer)", "INSERT INTO schema_migrations (filename) VALUES ('001_create_alt_basic.rb')", "CREATE TABLE sm (smc1 integer)", "INSERT INTO schema_migrations (filename) VALUES ('002_create_basic.rb')"]
710
+ @db.sqls.must_equal ["SELECT NULL AS nil FROM schema_migrations LIMIT 1", "CREATE TABLE schema_migrations (filename varchar(255) PRIMARY KEY)", "SELECT NULL AS nil FROM schema_info LIMIT 1", "SELECT filename FROM schema_migrations ORDER BY filename", "CREATE TABLE sm11111 (smc1 integer)", "INSERT INTO schema_migrations (filename) VALUES ('001_create_alt_basic.rb')", "CREATE TABLE sm (smc1 integer)", "INSERT INTO schema_migrations (filename) VALUES ('002_create_basic.rb')"]
711
711
  end
712
712
  end