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
@@ -74,47 +74,47 @@ describe "Eagerly loading a tree structure" do
74
74
 
75
75
  it "#descendants should get all descendants in one call" do
76
76
  nodes = Node.filter(:id=>1).eager(:descendants).all
77
- nodes.length.should == 1
77
+ nodes.length.must_equal 1
78
78
  node = nodes.first
79
- node.pk.should == 1
80
- node.children.length.should == 2
81
- node.children.collect{|x| x.pk}.sort.should == [2, 3]
82
- node.children.collect{|x| x.parent}.should == [node, node]
79
+ node.pk.must_equal 1
80
+ node.children.length.must_equal 2
81
+ node.children.collect{|x| x.pk}.sort.must_equal [2, 3]
82
+ node.children.collect{|x| x.parent}.must_equal [node, node]
83
83
  node = nodes.first.children.find{|x| x.pk == 2}
84
- node.children.length.should == 1
85
- node.children.first.pk.should == 4
86
- node.children.first.parent.should == node
84
+ node.children.length.must_equal 1
85
+ node.children.first.pk.must_equal 4
86
+ node.children.first.parent.must_equal node
87
87
  node = node.children.first
88
- node.children.length.should == 1
89
- node.children.first.pk.should == 5
90
- node.children.first.parent.should == node
88
+ node.children.length.must_equal 1
89
+ node.children.first.pk.must_equal 5
90
+ node.children.first.parent.must_equal node
91
91
  node = node.children.first
92
- node.children.length.should == 1
93
- node.children.first.pk.should == 6
94
- node.children.first.parent.should == node
92
+ node.children.length.must_equal 1
93
+ node.children.first.pk.must_equal 6
94
+ node.children.first.parent.must_equal node
95
95
  node = node.children.first
96
- node.children.length.should == 1
97
- node.children.first.pk.should == 7
98
- node.children.first.parent.should == node
96
+ node.children.length.must_equal 1
97
+ node.children.first.pk.must_equal 7
98
+ node.children.first.parent.must_equal node
99
99
  end
100
100
 
101
101
  it "#ancestors should get all ancestors in one call" do
102
102
  nodes = Node.filter(:id=>[7,3]).order(:id).eager(:ancestors).all
103
- nodes.length.should == 2
104
- nodes.collect{|x| x.pk}.should == [3, 7]
105
- nodes.first.parent.pk.should == 1
106
- nodes.first.parent.parent.should == nil
103
+ nodes.length.must_equal 2
104
+ nodes.collect{|x| x.pk}.must_equal [3, 7]
105
+ nodes.first.parent.pk.must_equal 1
106
+ nodes.first.parent.parent.must_equal nil
107
107
  node = nodes.last
108
- node.parent.pk.should == 6
108
+ node.parent.pk.must_equal 6
109
109
  node = node.parent
110
- node.parent.pk.should == 5
110
+ node.parent.pk.must_equal 5
111
111
  node = node.parent
112
- node.parent.pk.should == 4
112
+ node.parent.pk.must_equal 4
113
113
  node = node.parent
114
- node.parent.pk.should == 2
114
+ node.parent.pk.must_equal 2
115
115
  node = node.parent
116
- node.parent.pk.should == 1
117
- node.parent.parent.should == nil
116
+ node.parent.pk.must_equal 1
117
+ node.parent.parent.must_equal nil
118
118
  end
119
119
  end
120
120
 
@@ -152,20 +152,20 @@ describe "Association Extensions" do
152
152
  end
153
153
 
154
154
  it "should allow methods to be called on the dataset method" do
155
- Authorship.count.should == 0
155
+ Authorship.count.must_equal 0
156
156
  authorship = @author.authorships_dataset.find_or_create_by_name('Bob')
157
- Authorship.count.should == 1
158
- Authorship.first.should == authorship
159
- authorship.name.should == 'Bob'
160
- authorship.author_id.should == @author.id
161
- @author.authorships_dataset.find_or_create_by_name('Bob').should == authorship
162
- Authorship.count.should == 1
157
+ Authorship.count.must_equal 1
158
+ Authorship.first.must_equal authorship
159
+ authorship.name.must_equal 'Bob'
160
+ authorship.author_id.must_equal @author.id
161
+ @author.authorships_dataset.find_or_create_by_name('Bob').must_equal authorship
162
+ Authorship.count.must_equal 1
163
163
  authorship2 = @author.authorships_dataset.find_or_create(:name=>'Jim')
164
- Authorship.count.should == 2
165
- Authorship.order(:name).map(:name).should == ['Bob', 'Jim']
166
- authorship2.name.should == 'Jim'
167
- authorship2.author_id.should == @author.id
168
- @author.authorships_dataset.find_or_create(:name=>'Jim').should == authorship2
164
+ Authorship.count.must_equal 2
165
+ Authorship.order(:name).map(:name).must_equal ['Bob', 'Jim']
166
+ authorship2.name.must_equal 'Jim'
167
+ authorship2.author_id.must_equal @author.id
168
+ @author.authorships_dataset.find_or_create(:name=>'Jim').must_equal authorship2
169
169
  end
170
170
  end
171
171
 
@@ -259,64 +259,64 @@ describe "has_many :through has_many and has_one :through belongs_to" do
259
259
 
260
260
  it "should return has_many :through has_many records for a single object" do
261
261
  invs = @firm1.invoices.sort_by{|x| x.pk}
262
- invs.should == [@invoice1, @invoice2, @invoice3]
263
- invs[0].client.should == @client1
264
- invs[1].client.should == @client1
265
- invs[2].client.should == @client2
266
- invs.collect{|i| i.firm}.should == [@firm1, @firm1, @firm1]
267
- invs.collect{|i| i.client.firm}.should == [@firm1, @firm1, @firm1]
262
+ invs.must_equal [@invoice1, @invoice2, @invoice3]
263
+ invs[0].client.must_equal @client1
264
+ invs[1].client.must_equal @client1
265
+ invs[2].client.must_equal @client2
266
+ invs.collect{|i| i.firm}.must_equal [@firm1, @firm1, @firm1]
267
+ invs.collect{|i| i.client.firm}.must_equal [@firm1, @firm1, @firm1]
268
268
  end
269
269
 
270
270
  it "should eagerly load has_many :through has_many records for multiple objects" do
271
271
  firms = Firm.order(:id).eager(:invoices).all
272
- firms.should == [@firm1, @firm2]
272
+ firms.must_equal [@firm1, @firm2]
273
273
  firm1, firm2 = firms
274
274
  invs1 = firm1.invoices.sort_by{|x| x.pk}
275
275
  invs2 = firm2.invoices.sort_by{|x| x.pk}
276
- invs1.should == [@invoice1, @invoice2, @invoice3]
277
- invs2.should == [@invoice4, @invoice5]
278
- invs1[0].client.should == @client1
279
- invs1[1].client.should == @client1
280
- invs1[2].client.should == @client2
281
- invs2[0].client.should == @client3
282
- invs2[1].client.should == @client3
283
- invs1.collect{|i| i.firm}.should == [@firm1, @firm1, @firm1]
284
- invs2.collect{|i| i.firm}.should == [@firm2, @firm2]
285
- invs1.collect{|i| i.client.firm}.should == [@firm1, @firm1, @firm1]
286
- invs2.collect{|i| i.client.firm}.should == [@firm2, @firm2]
276
+ invs1.must_equal [@invoice1, @invoice2, @invoice3]
277
+ invs2.must_equal [@invoice4, @invoice5]
278
+ invs1[0].client.must_equal @client1
279
+ invs1[1].client.must_equal @client1
280
+ invs1[2].client.must_equal @client2
281
+ invs2[0].client.must_equal @client3
282
+ invs2[1].client.must_equal @client3
283
+ invs1.collect{|i| i.firm}.must_equal [@firm1, @firm1, @firm1]
284
+ invs2.collect{|i| i.firm}.must_equal [@firm2, @firm2]
285
+ invs1.collect{|i| i.client.firm}.must_equal [@firm1, @firm1, @firm1]
286
+ invs2.collect{|i| i.client.firm}.must_equal [@firm2, @firm2]
287
287
  end
288
288
 
289
289
  it "should return has_one :through belongs_to records for a single object" do
290
290
  firm = @invoice1.firm
291
- firm.should == @firm1
292
- @invoice1.client.should == @client1
293
- @invoice1.client.firm.should == @firm1
294
- firm.associations[:clients].should == nil
291
+ firm.must_equal @firm1
292
+ @invoice1.client.must_equal @client1
293
+ @invoice1.client.firm.must_equal @firm1
294
+ firm.associations[:clients].must_equal nil
295
295
  end
296
296
 
297
297
  it "should eagerly load has_one :through belongs_to records for multiple objects" do
298
298
  invs = Invoice.order(:id).eager(:firm).all
299
- invs.should == [@invoice1, @invoice2, @invoice3, @invoice4, @invoice5]
300
- invs[0].firm.should == @firm1
301
- invs[0].client.should == @client1
302
- invs[0].client.firm.should == @firm1
303
- invs[0].firm.associations[:clients].should == nil
304
- invs[1].firm.should == @firm1
305
- invs[1].client.should == @client1
306
- invs[1].client.firm.should == @firm1
307
- invs[1].firm.associations[:clients].should == nil
308
- invs[2].firm.should == @firm1
309
- invs[2].client.should == @client2
310
- invs[2].client.firm.should == @firm1
311
- invs[2].firm.associations[:clients].should == nil
312
- invs[3].firm.should == @firm2
313
- invs[3].client.should == @client3
314
- invs[3].client.firm.should == @firm2
315
- invs[3].firm.associations[:clients].should == nil
316
- invs[4].firm.should == @firm2
317
- invs[4].client.should == @client3
318
- invs[4].client.firm.should == @firm2
319
- invs[4].firm.associations[:clients].should == nil
299
+ invs.must_equal [@invoice1, @invoice2, @invoice3, @invoice4, @invoice5]
300
+ invs[0].firm.must_equal @firm1
301
+ invs[0].client.must_equal @client1
302
+ invs[0].client.firm.must_equal @firm1
303
+ invs[0].firm.associations[:clients].must_equal nil
304
+ invs[1].firm.must_equal @firm1
305
+ invs[1].client.must_equal @client1
306
+ invs[1].client.firm.must_equal @firm1
307
+ invs[1].firm.associations[:clients].must_equal nil
308
+ invs[2].firm.must_equal @firm1
309
+ invs[2].client.must_equal @client2
310
+ invs[2].client.firm.must_equal @firm1
311
+ invs[2].firm.associations[:clients].must_equal nil
312
+ invs[3].firm.must_equal @firm2
313
+ invs[3].client.must_equal @client3
314
+ invs[3].client.firm.must_equal @firm2
315
+ invs[3].firm.associations[:clients].must_equal nil
316
+ invs[4].firm.must_equal @firm2
317
+ invs[4].client.must_equal @client3
318
+ invs[4].client.firm.must_equal @firm2
319
+ invs[4].firm.associations[:clients].must_equal nil
320
320
  end
321
321
  end
322
322
 
@@ -394,55 +394,55 @@ describe "Polymorphic Associations" do
394
394
  end
395
395
 
396
396
  it "should load the correct associated object for a single object" do
397
- @asset1.attachable.should == @post
398
- @asset2.attachable.should == @note
397
+ @asset1.attachable.must_equal @post
398
+ @asset2.attachable.must_equal @note
399
399
  end
400
400
 
401
401
  it "should eagerly load the correct associated object for a group of objects" do
402
402
  assets = Asset.order(:id).eager(:attachable).all
403
- assets.should == [@asset1, @asset2]
404
- assets[0].attachable.should == @post
405
- assets[1].attachable.should == @note
403
+ assets.must_equal [@asset1, @asset2]
404
+ assets[0].attachable.must_equal @post
405
+ assets[1].attachable.must_equal @note
406
406
  end
407
407
 
408
408
  it "should set items correctly" do
409
409
  @asset1.attachable = @note
410
410
  @asset2.attachable = @post
411
- @asset1.attachable.should == @note
412
- @asset1.attachable_id.should == @note.pk
413
- @asset1.attachable_type.should == 'Note'
414
- @asset2.attachable.should == @post
415
- @asset2.attachable_id.should == @post.pk
416
- @asset2.attachable_type.should == 'Post'
411
+ @asset1.attachable.must_equal @note
412
+ @asset1.attachable_id.must_equal @note.pk
413
+ @asset1.attachable_type.must_equal 'Note'
414
+ @asset2.attachable.must_equal @post
415
+ @asset2.attachable_id.must_equal @post.pk
416
+ @asset2.attachable_type.must_equal 'Post'
417
417
  @asset1.attachable = nil
418
- @asset1.attachable.should == nil
419
- @asset1.attachable_id.should == nil
420
- @asset1.attachable_type.should == nil
418
+ @asset1.attachable.must_equal nil
419
+ @asset1.attachable_id.must_equal nil
420
+ @asset1.attachable_type.must_equal nil
421
421
  end
422
422
 
423
423
  it "should add items correctly" do
424
- @post.assets.should == [@asset1]
424
+ @post.assets.must_equal [@asset1]
425
425
  @post.add_asset(@asset2)
426
- @post.assets.should == [@asset1, @asset2]
427
- @asset2.attachable.should == @post
428
- @asset2.attachable_id.should == @post.pk
429
- @asset2.attachable_type.should == 'Post'
426
+ @post.assets.must_equal [@asset1, @asset2]
427
+ @asset2.attachable.must_equal @post
428
+ @asset2.attachable_id.must_equal @post.pk
429
+ @asset2.attachable_type.must_equal 'Post'
430
430
  end
431
431
 
432
432
  it "should remove items correctly" do
433
- @note.assets.should == [@asset2]
433
+ @note.assets.must_equal [@asset2]
434
434
  @note.remove_asset(@asset2)
435
- @note.assets.should == []
436
- @asset2.attachable.should == nil
437
- @asset2.attachable_id.should == nil
438
- @asset2.attachable_type.should == nil
435
+ @note.assets.must_equal []
436
+ @asset2.attachable.must_equal nil
437
+ @asset2.attachable_id.must_equal nil
438
+ @asset2.attachable_type.must_equal nil
439
439
  end
440
440
 
441
441
  it "should remove all items correctly" do
442
442
  @post.remove_all_assets
443
443
  @note.remove_all_assets
444
- @asset1.reload.attachable.should == nil
445
- @asset2.reload.attachable.should == nil
444
+ @asset1.reload.attachable.must_equal nil
445
+ @asset2.reload.attachable.must_equal nil
446
446
  end
447
447
  end
448
448
 
@@ -511,65 +511,65 @@ describe "many_to_one/one_to_many not referencing primary key" do
511
511
 
512
512
  it "should load all associated one_to_many objects for a single object" do
513
513
  invs = @client1.invoices
514
- invs.should == [@invoice1, @invoice2]
515
- invs[0].client.should == @client1
516
- invs[1].client.should == @client1
514
+ invs.must_equal [@invoice1, @invoice2]
515
+ invs[0].client.must_equal @client1
516
+ invs[1].client.must_equal @client1
517
517
  end
518
518
 
519
519
  it "should load the associated many_to_one object for a single object" do
520
520
  client = @invoice1.client
521
- client.should == @client1
521
+ client.must_equal @client1
522
522
  end
523
523
 
524
524
  it "should eagerly load all associated one_to_many objects for a group of objects" do
525
525
  clients = Client.order(:id).eager(:invoices).all
526
- clients.should == [@client1, @client2]
527
- clients[1].invoices.should == []
526
+ clients.must_equal [@client1, @client2]
527
+ clients[1].invoices.must_equal []
528
528
  invs = clients[0].invoices.sort_by{|x| x.pk}
529
- invs.should == [@invoice1, @invoice2]
530
- invs[0].client.should == @client1
531
- invs[1].client.should == @client1
529
+ invs.must_equal [@invoice1, @invoice2]
530
+ invs[0].client.must_equal @client1
531
+ invs[1].client.must_equal @client1
532
532
  end
533
533
 
534
534
  it "should eagerly load the associated many_to_one object for a group of objects" do
535
535
  invoices = Invoice.order(:id).eager(:client).all
536
- invoices.should == [@invoice1, @invoice2]
537
- invoices[0].client.should == @client1
538
- invoices[1].client.should == @client1
536
+ invoices.must_equal [@invoice1, @invoice2]
537
+ invoices[0].client.must_equal @client1
538
+ invoices[1].client.must_equal @client1
539
539
  end
540
540
 
541
541
  it "should set the associated object correctly" do
542
542
  @invoice1.client = @client2
543
- @invoice1.client.should == @client2
544
- @invoice1.client_name.should == 'Y'
543
+ @invoice1.client.must_equal @client2
544
+ @invoice1.client_name.must_equal 'Y'
545
545
  @invoice1.client = nil
546
- @invoice1.client_name.should == nil
546
+ @invoice1.client_name.must_equal nil
547
547
  end
548
548
 
549
549
  it "should add the associated object correctly" do
550
- @client2.invoices.should == []
550
+ @client2.invoices.must_equal []
551
551
  @client2.add_invoice(@invoice1)
552
- @client2.invoices.should == [@invoice1]
553
- @invoice1.client_name.should == 'Y'
552
+ @client2.invoices.must_equal [@invoice1]
553
+ @invoice1.client_name.must_equal 'Y'
554
554
  @invoice1.client = nil
555
- @invoice1.client_name.should == nil
555
+ @invoice1.client_name.must_equal nil
556
556
  end
557
557
 
558
558
  it "should remove the associated object correctly" do
559
559
  invs = @client1.invoices.sort_by{|x| x.pk}
560
- invs.should == [@invoice1, @invoice2]
560
+ invs.must_equal [@invoice1, @invoice2]
561
561
  @client1.remove_invoice(@invoice1)
562
- @client1.invoices.should == [@invoice2]
563
- @invoice1.client_name.should == nil
564
- @invoice1.client.should == nil
562
+ @client1.invoices.must_equal [@invoice2]
563
+ @invoice1.client_name.must_equal nil
564
+ @invoice1.client.must_equal nil
565
565
  end
566
566
 
567
567
  it "should remove all associated objects correctly" do
568
568
  @client1.remove_all_invoices
569
- @invoice1.refresh.client.should == nil
570
- @invoice1.client_name.should == nil
571
- @invoice2.refresh.client.should == nil
572
- @invoice2.client_name.should == nil
569
+ @invoice1.refresh.client.must_equal nil
570
+ @invoice1.client_name.must_equal nil
571
+ @invoice2.refresh.client.must_equal nil
572
+ @invoice2.client_name.must_equal nil
573
573
  end
574
574
  end
575
575
 
@@ -622,14 +622,14 @@ describe "statistics associations" do
622
622
  end
623
623
 
624
624
  it "should give the correct sum of ticket hours for each project" do
625
- @project1.ticket_hours.to_i.should == 11
626
- @project2.ticket_hours.to_i.should == 22
625
+ @project1.ticket_hours.to_i.must_equal 11
626
+ @project2.ticket_hours.to_i.must_equal 22
627
627
  end
628
628
 
629
629
  it "should give the correct sum of ticket hours for each project when eager loading" do
630
630
  p1, p2 = Project.order(:name).eager(:ticket_hours).all
631
- p1.ticket_hours.to_i.should == 11
632
- p2.ticket_hours.to_i.should == 22
631
+ p1.ticket_hours.to_i.must_equal 11
632
+ p2.ticket_hours.to_i.must_equal 22
633
633
  end
634
634
  end
635
635
 
@@ -667,21 +667,21 @@ describe "one to one associations" do
667
667
 
668
668
  it "should be eager loadable" do
669
669
  bk1, bk2 = Book.filter(:books__id=>[1,2]).eager(:first_page).all
670
- bk1.first_page.should == @page1
671
- bk2.first_page.should == @page3
670
+ bk1.first_page.must_equal @page1
671
+ bk2.first_page.must_equal @page3
672
672
  end
673
673
 
674
674
  it "should be eager graphable" do
675
675
  bk1, bk2 = Book.filter(:books__id=>[1,2]).eager_graph(:first_page).all
676
- bk1.first_page.should == @page1
677
- bk2.first_page.should == @page3
676
+ bk1.first_page.must_equal @page1
677
+ bk2.first_page.must_equal @page3
678
678
  end
679
679
 
680
680
  it "should be eager graphable two at once" do
681
681
  bk1, bk2 = Book.filter(:books__id=>[1,2]).eager_graph(:first_page, :second_page).all
682
- bk1.first_page.should == @page1
683
- bk1.second_page.should == @page2
684
- bk2.first_page.should == @page3
685
- bk2.second_page.should == @page4
682
+ bk1.first_page.must_equal @page1
683
+ bk1.second_page.must_equal @page2
684
+ bk2.first_page.must_equal @page3
685
+ bk2.second_page.must_equal @page4
686
686
  end
687
687
  end
@@ -10,231 +10,231 @@ describe Sequel::Migrator do
10
10
  @db.drop_table?(:schema_info, :schema_migrations, :sm1111, :sm1122, :sm2222, :sm2233, :sm3333, :sm11111, :sm22222)
11
11
  end
12
12
 
13
- specify "should be able to migrate up and down all the way successfully" do
13
+ it "should be able to migrate up and down all the way successfully" do
14
14
  @dir = 'spec/files/integer_migrations'
15
15
  @m.apply(@db, @dir)
16
- [:schema_info, :sm1111, :sm2222, :sm3333].each{|n| @db.table_exists?(n).should == true}
17
- @db[:schema_info].get(:version).should == 3
16
+ [:schema_info, :sm1111, :sm2222, :sm3333].each{|n| @db.table_exists?(n).must_equal true}
17
+ @db[:schema_info].get(:version).must_equal 3
18
18
  @m.apply(@db, @dir, 0)
19
- [:sm1111, :sm2222, :sm3333].each{|n| @db.table_exists?(n).should == false}
20
- @db[:schema_info].get(:version).should == 0
19
+ [:sm1111, :sm2222, :sm3333].each{|n| @db.table_exists?(n).must_equal false}
20
+ @db[:schema_info].get(:version).must_equal 0
21
21
  end
22
22
 
23
- specify "should be able to migrate up and down to specific versions successfully" do
23
+ it "should be able to migrate up and down to specific versions successfully" do
24
24
  @dir = 'spec/files/integer_migrations'
25
25
  @m.apply(@db, @dir, 2)
26
- [:schema_info, :sm1111, :sm2222].each{|n| @db.table_exists?(n).should == true}
27
- @db.table_exists?(:sm3333).should == false
28
- @db[:schema_info].get(:version).should == 2
26
+ [:schema_info, :sm1111, :sm2222].each{|n| @db.table_exists?(n).must_equal true}
27
+ @db.table_exists?(:sm3333).must_equal false
28
+ @db[:schema_info].get(:version).must_equal 2
29
29
  @m.apply(@db, @dir, 1)
30
- [:sm2222, :sm3333].each{|n| @db.table_exists?(n).should == false}
31
- @db.table_exists?(:sm1111).should == true
32
- @db[:schema_info].get(:version).should == 1
30
+ [:sm2222, :sm3333].each{|n| @db.table_exists?(n).must_equal false}
31
+ @db.table_exists?(:sm1111).must_equal true
32
+ @db[:schema_info].get(:version).must_equal 1
33
33
  end
34
34
 
35
- specify "should correctly set migration version to the last successful migration if the migration raises an error when migrating up" do
35
+ it "should correctly set migration version to the last successful migration if the migration raises an error when migrating up" do
36
36
  @dir = 'spec/files/bad_up_migration'
37
- proc{@m.apply(@db, @dir)}.should raise_error
38
- [:schema_info, :sm11111].each{|n| @db.table_exists?(n).should == true}
39
- @db.table_exists?(:sm22222).should == false
40
- @db[:schema_info].get(:version).should == 1
37
+ proc{@m.apply(@db, @dir)}.must_raise Sequel::DatabaseError
38
+ [:schema_info, :sm11111].each{|n| @db.table_exists?(n).must_equal true}
39
+ @db.table_exists?(:sm22222).must_equal false
40
+ @db[:schema_info].get(:version).must_equal 1
41
41
  @m.apply(@db, @dir, 0)
42
- [:sm11111, :sm22222].each{|n| @db.table_exists?(n).should == false}
43
- @db[:schema_info].get(:version).should == 0
42
+ [:sm11111, :sm22222].each{|n| @db.table_exists?(n).must_equal false}
43
+ @db[:schema_info].get(:version).must_equal 0
44
44
  end
45
45
 
46
- specify "should correctly set migration version to the last successful migration if the migration raises an error when migrating down" do
46
+ it "should correctly set migration version to the last successful migration if the migration raises an error when migrating down" do
47
47
  @dir = 'spec/files/bad_down_migration'
48
48
  @m.apply(@db, @dir)
49
- [:schema_info, :sm11111, :sm22222].each{|n| @db.table_exists?(n).should == true}
50
- @db[:schema_info].get(:version).should == 2
51
- proc{@m.apply(@db, @dir, 0)}.should raise_error
52
- [:sm22222].each{|n| @db.table_exists?(n).should == false}
53
- @db.table_exists?(:sm11111).should == true
54
- @db[:schema_info].get(:version).should == 1
49
+ [:schema_info, :sm11111, :sm22222].each{|n| @db.table_exists?(n).must_equal true}
50
+ @db[:schema_info].get(:version).must_equal 2
51
+ proc{@m.apply(@db, @dir, 0)}.must_raise Sequel::DatabaseError
52
+ [:sm22222].each{|n| @db.table_exists?(n).must_equal false}
53
+ @db.table_exists?(:sm11111).must_equal true
54
+ @db[:schema_info].get(:version).must_equal 1
55
55
  end
56
56
 
57
- specify "should handle migrating up or down all the way with timestamped migrations" do
57
+ it "should handle migrating up or down all the way with timestamped migrations" do
58
58
  @dir = 'spec/files/timestamped_migrations'
59
59
  @m.apply(@db, @dir)
60
- [:schema_migrations, :sm1111, :sm2222, :sm3333].each{|n| @db.table_exists?(n).should == true}
61
- @db[:schema_migrations].select_order_map(:filename).should == %w'1273253849_create_sessions.rb 1273253851_create_nodes.rb 1273253853_3_create_users.rb'
60
+ [:schema_migrations, :sm1111, :sm2222, :sm3333].each{|n| @db.table_exists?(n).must_equal true}
61
+ @db[:schema_migrations].select_order_map(:filename).must_equal %w'1273253849_create_sessions.rb 1273253851_create_nodes.rb 1273253853_3_create_users.rb'
62
62
  @m.apply(@db, @dir, 0)
63
- [:sm1111, :sm2222, :sm3333].each{|n| @db.table_exists?(n).should == false}
64
- @db[:schema_migrations].select_order_map(:filename).should == []
63
+ [:sm1111, :sm2222, :sm3333].each{|n| @db.table_exists?(n).must_equal false}
64
+ @db[:schema_migrations].select_order_map(:filename).must_equal []
65
65
  end
66
66
 
67
- specify "should handle migrating up or down to specific timestamps with timestamped migrations" do
67
+ it "should handle migrating up or down to specific timestamps with timestamped migrations" do
68
68
  @dir = 'spec/files/timestamped_migrations'
69
69
  @m.apply(@db, @dir, 1273253851)
70
- [:schema_migrations, :sm1111, :sm2222].each{|n| @db.table_exists?(n).should == true}
71
- @db.table_exists?(:sm3333).should == false
72
- @db[:schema_migrations].select_order_map(:filename).should == %w'1273253849_create_sessions.rb 1273253851_create_nodes.rb'
70
+ [:schema_migrations, :sm1111, :sm2222].each{|n| @db.table_exists?(n).must_equal true}
71
+ @db.table_exists?(:sm3333).must_equal false
72
+ @db[:schema_migrations].select_order_map(:filename).must_equal %w'1273253849_create_sessions.rb 1273253851_create_nodes.rb'
73
73
  @m.apply(@db, @dir, 1273253849)
74
- [:sm2222, :sm3333].each{|n| @db.table_exists?(n).should == false}
75
- @db.table_exists?(:sm1111).should == true
76
- @db[:schema_migrations].select_order_map(:filename).should == %w'1273253849_create_sessions.rb'
74
+ [:sm2222, :sm3333].each{|n| @db.table_exists?(n).must_equal false}
75
+ @db.table_exists?(:sm1111).must_equal true
76
+ @db[:schema_migrations].select_order_map(:filename).must_equal %w'1273253849_create_sessions.rb'
77
77
  end
78
78
 
79
- specify "should apply all missing files when migrating up with timestamped migrations" do
79
+ it "should apply all missing files when migrating up with timestamped migrations" do
80
80
  @dir = 'spec/files/timestamped_migrations'
81
81
  @m.apply(@db, @dir)
82
82
  @dir = 'spec/files/interleaved_timestamped_migrations'
83
83
  @m.apply(@db, @dir)
84
- [:schema_migrations, :sm1111, :sm1122, :sm2222, :sm2233, :sm3333].each{|n| @db.table_exists?(n).should == true}
85
- @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'
84
+ [:schema_migrations, :sm1111, :sm1122, :sm2222, :sm2233, :sm3333].each{|n| @db.table_exists?(n).must_equal true}
85
+ @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'
86
86
  end
87
87
 
88
- specify "should not apply down action to migrations where up action hasn't been applied" do
88
+ it "should not apply down action to migrations where up action hasn't been applied" do
89
89
  @dir = 'spec/files/timestamped_migrations'
90
90
  @m.apply(@db, @dir)
91
91
  @dir = 'spec/files/interleaved_timestamped_migrations'
92
92
  @m.apply(@db, @dir, 0)
93
- [:sm1111, :sm1122, :sm2222, :sm2233, :sm3333].each{|n| @db.table_exists?(n).should == false}
94
- @db[:schema_migrations].select_order_map(:filename).should == []
93
+ [:sm1111, :sm1122, :sm2222, :sm2233, :sm3333].each{|n| @db.table_exists?(n).must_equal false}
94
+ @db[:schema_migrations].select_order_map(:filename).must_equal []
95
95
  end
96
96
 
97
- specify "should handle updating to a specific timestamp when interleaving migrations with timestamps" do
97
+ it "should handle updating to a specific timestamp when interleaving migrations with timestamps" do
98
98
  @dir = 'spec/files/timestamped_migrations'
99
99
  @m.apply(@db, @dir)
100
100
  @dir = 'spec/files/interleaved_timestamped_migrations'
101
101
  @m.apply(@db, @dir, 1273253851)
102
- [:schema_migrations, :sm1111, :sm1122, :sm2222].each{|n| @db.table_exists?(n).should == true}
103
- [:sm2233, :sm3333].each{|n| @db.table_exists?(n).should == false}
104
- @db[:schema_migrations].select_order_map(:filename).should == %w'1273253849_create_sessions.rb 1273253850_create_artists.rb 1273253851_create_nodes.rb'
102
+ [:schema_migrations, :sm1111, :sm1122, :sm2222].each{|n| @db.table_exists?(n).must_equal true}
103
+ [:sm2233, :sm3333].each{|n| @db.table_exists?(n).must_equal false}
104
+ @db[:schema_migrations].select_order_map(:filename).must_equal %w'1273253849_create_sessions.rb 1273253850_create_artists.rb 1273253851_create_nodes.rb'
105
105
  end
106
106
 
107
- specify "should correctly update schema_migrations table when an error occurs when migrating up or down using timestamped migrations" do
107
+ it "should correctly update schema_migrations table when an error occurs when migrating up or down using timestamped migrations" do
108
108
  @dir = 'spec/files/bad_timestamped_migrations'
109
- proc{@m.apply(@db, @dir)}.should raise_error
110
- [:schema_migrations, :sm1111, :sm2222].each{|n| @db.table_exists?(n).should == true}
111
- @db.table_exists?(:sm3333).should == false
112
- @db[:schema_migrations].select_order_map(:filename).should == %w'1273253849_create_sessions.rb 1273253851_create_nodes.rb'
113
- proc{@m.apply(@db, @dir, 0)}.should raise_error
114
- [:sm2222, :sm3333].each{|n| @db.table_exists?(n).should == false}
115
- @db.table_exists?(:sm1111).should == true
116
- @db[:schema_migrations].select_order_map(:filename).should == %w'1273253849_create_sessions.rb'
109
+ proc{@m.apply(@db, @dir)}.must_raise Sequel::DatabaseError
110
+ [:schema_migrations, :sm1111, :sm2222].each{|n| @db.table_exists?(n).must_equal true}
111
+ @db.table_exists?(:sm3333).must_equal false
112
+ @db[:schema_migrations].select_order_map(:filename).must_equal %w'1273253849_create_sessions.rb 1273253851_create_nodes.rb'
113
+ proc{@m.apply(@db, @dir, 0)}.must_raise Sequel::DatabaseError
114
+ [:sm2222, :sm3333].each{|n| @db.table_exists?(n).must_equal false}
115
+ @db.table_exists?(:sm1111).must_equal true
116
+ @db[:schema_migrations].select_order_map(:filename).must_equal %w'1273253849_create_sessions.rb'
117
117
  end
118
118
 
119
- specify "should handle multiple migrations with the same timestamp correctly" do
119
+ it "should handle multiple migrations with the same timestamp correctly" do
120
120
  @dir = 'spec/files/duplicate_timestamped_migrations'
121
121
  @m.apply(@db, @dir)
122
- [:schema_migrations, :sm1111, :sm2222, :sm3333].each{|n| @db.table_exists?(n).should == true}
123
- @db[:schema_migrations].select_order_map(:filename).should == %w'1273253849_create_sessions.rb 1273253853_create_nodes.rb 1273253853_create_users.rb'
122
+ [:schema_migrations, :sm1111, :sm2222, :sm3333].each{|n| @db.table_exists?(n).must_equal true}
123
+ @db[:schema_migrations].select_order_map(:filename).must_equal %w'1273253849_create_sessions.rb 1273253853_create_nodes.rb 1273253853_create_users.rb'
124
124
  @m.apply(@db, @dir, 1273253853)
125
- [:sm1111, :sm2222, :sm3333].each{|n| @db.table_exists?(n).should == true}
126
- @db[:schema_migrations].select_order_map(:filename).should == %w'1273253849_create_sessions.rb 1273253853_create_nodes.rb 1273253853_create_users.rb'
125
+ [:sm1111, :sm2222, :sm3333].each{|n| @db.table_exists?(n).must_equal true}
126
+ @db[:schema_migrations].select_order_map(:filename).must_equal %w'1273253849_create_sessions.rb 1273253853_create_nodes.rb 1273253853_create_users.rb'
127
127
  @m.apply(@db, @dir, 1273253849)
128
- [:sm1111].each{|n| @db.table_exists?(n).should == true}
129
- [:sm2222, :sm3333].each{|n| @db.table_exists?(n).should == false}
130
- @db[:schema_migrations].select_order_map(:filename).should == %w'1273253849_create_sessions.rb'
128
+ [:sm1111].each{|n| @db.table_exists?(n).must_equal true}
129
+ [:sm2222, :sm3333].each{|n| @db.table_exists?(n).must_equal false}
130
+ @db[:schema_migrations].select_order_map(:filename).must_equal %w'1273253849_create_sessions.rb'
131
131
  @m.apply(@db, @dir, 1273253848)
132
- [:sm1111, :sm2222, :sm3333].each{|n| @db.table_exists?(n).should == false}
133
- @db[:schema_migrations].select_order_map(:filename).should == []
132
+ [:sm1111, :sm2222, :sm3333].each{|n| @db.table_exists?(n).must_equal false}
133
+ @db[:schema_migrations].select_order_map(:filename).must_equal []
134
134
  end
135
135
 
136
- specify "should convert schema_info table to schema_migrations table" do
136
+ it "should convert schema_info table to schema_migrations table" do
137
137
  @dir = 'spec/files/integer_migrations'
138
138
  @m.apply(@db, @dir)
139
- [:schema_info, :sm1111, :sm2222, :sm3333].each{|n| @db.table_exists?(n).should == true}
140
- [:schema_migrations, :sm1122, :sm2233].each{|n| @db.table_exists?(n).should == false}
139
+ [:schema_info, :sm1111, :sm2222, :sm3333].each{|n| @db.table_exists?(n).must_equal true}
140
+ [:schema_migrations, :sm1122, :sm2233].each{|n| @db.table_exists?(n).must_equal false}
141
141
 
142
142
  @dir = 'spec/files/convert_to_timestamp_migrations'
143
143
  @m.apply(@db, @dir)
144
- [:schema_info, :sm1111, :sm2222, :sm3333, :schema_migrations, :sm1122, :sm2233].each{|n| @db.table_exists?(n).should == true}
145
- @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'
144
+ [:schema_info, :sm1111, :sm2222, :sm3333, :schema_migrations, :sm1122, :sm2233].each{|n| @db.table_exists?(n).must_equal true}
145
+ @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'
146
146
 
147
147
  @m.apply(@db, @dir, 4)
148
- [:schema_info, :schema_migrations, :sm1111, :sm2222, :sm3333].each{|n| @db.table_exists?(n).should == true}
149
- [:sm1122, :sm2233].each{|n| @db.table_exists?(n).should == false}
150
- @db[:schema_migrations].select_order_map(:filename).should == %w'001_create_sessions.rb 002_create_nodes.rb 003_3_create_users.rb'
148
+ [:schema_info, :schema_migrations, :sm1111, :sm2222, :sm3333].each{|n| @db.table_exists?(n).must_equal true}
149
+ [:sm1122, :sm2233].each{|n| @db.table_exists?(n).must_equal false}
150
+ @db[:schema_migrations].select_order_map(:filename).must_equal %w'001_create_sessions.rb 002_create_nodes.rb 003_3_create_users.rb'
151
151
 
152
152
  @m.apply(@db, @dir, 0)
153
- [:schema_info, :schema_migrations].each{|n| @db.table_exists?(n).should == true}
154
- [:sm1111, :sm2222, :sm3333, :sm1122, :sm2233].each{|n| @db.table_exists?(n).should == false}
155
- @db[:schema_migrations].select_order_map(:filename).should == []
153
+ [:schema_info, :schema_migrations].each{|n| @db.table_exists?(n).must_equal true}
154
+ [:sm1111, :sm2222, :sm3333, :sm1122, :sm2233].each{|n| @db.table_exists?(n).must_equal false}
155
+ @db[:schema_migrations].select_order_map(:filename).must_equal []
156
156
  end
157
157
 
158
- specify "should handle unapplied migrations when migrating schema_info table to schema_migrations table" do
158
+ it "should handle unapplied migrations when migrating schema_info table to schema_migrations table" do
159
159
  @dir = 'spec/files/integer_migrations'
160
160
  @m.apply(@db, @dir, 2)
161
- [:schema_info, :sm1111, :sm2222].each{|n| @db.table_exists?(n).should == true}
162
- [:schema_migrations, :sm3333, :sm1122, :sm2233].each{|n| @db.table_exists?(n).should == false}
161
+ [:schema_info, :sm1111, :sm2222].each{|n| @db.table_exists?(n).must_equal true}
162
+ [:schema_migrations, :sm3333, :sm1122, :sm2233].each{|n| @db.table_exists?(n).must_equal false}
163
163
 
164
164
  @dir = 'spec/files/convert_to_timestamp_migrations'
165
165
  @m.apply(@db, @dir, 1273253850)
166
- [:schema_info, :sm1111, :sm2222, :sm3333, :schema_migrations, :sm1122].each{|n| @db.table_exists?(n).should == true}
167
- [:sm2233].each{|n| @db.table_exists?(n).should == false}
168
- @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'
166
+ [:schema_info, :sm1111, :sm2222, :sm3333, :schema_migrations, :sm1122].each{|n| @db.table_exists?(n).must_equal true}
167
+ [:sm2233].each{|n| @db.table_exists?(n).must_equal false}
168
+ @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'
169
169
  end
170
170
 
171
- specify "should handle unapplied migrations when migrating schema_info table to schema_migrations table and target is less than last integer migration version" do
171
+ it "should handle unapplied migrations when migrating schema_info table to schema_migrations table and target is less than last integer migration version" do
172
172
  @dir = 'spec/files/integer_migrations'
173
173
  @m.apply(@db, @dir, 1)
174
- [:schema_info, :sm1111].each{|n| @db.table_exists?(n).should == true}
175
- [:schema_migrations, :sm2222, :sm3333, :sm1122, :sm2233].each{|n| @db.table_exists?(n).should == false}
174
+ [:schema_info, :sm1111].each{|n| @db.table_exists?(n).must_equal true}
175
+ [:schema_migrations, :sm2222, :sm3333, :sm1122, :sm2233].each{|n| @db.table_exists?(n).must_equal false}
176
176
 
177
177
  @dir = 'spec/files/convert_to_timestamp_migrations'
178
178
  @m.apply(@db, @dir, 2)
179
- [:schema_info, :sm1111, :sm2222, :schema_migrations].each{|n| @db.table_exists?(n).should == true}
180
- [:sm3333, :sm1122, :sm2233].each{|n| @db.table_exists?(n).should == false}
181
- @db[:schema_migrations].select_order_map(:filename).should == %w'001_create_sessions.rb 002_create_nodes.rb'
179
+ [:schema_info, :sm1111, :sm2222, :schema_migrations].each{|n| @db.table_exists?(n).must_equal true}
180
+ [:sm3333, :sm1122, :sm2233].each{|n| @db.table_exists?(n).must_equal false}
181
+ @db[:schema_migrations].select_order_map(:filename).must_equal %w'001_create_sessions.rb 002_create_nodes.rb'
182
182
 
183
183
  @m.apply(@db, @dir)
184
- [:schema_info, :sm1111, :sm2222, :schema_migrations, :sm3333, :sm1122, :sm2233].each{|n| @db.table_exists?(n).should == true}
185
- @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'
184
+ [:schema_info, :sm1111, :sm2222, :schema_migrations, :sm3333, :sm1122, :sm2233].each{|n| @db.table_exists?(n).must_equal true}
185
+ @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'
186
186
  end
187
187
 
188
- specify "should handle reversible migrations" do
188
+ it "should handle reversible migrations" do
189
189
  @dir = 'spec/files/reversible_migrations'
190
190
  @db.drop_table?(:a, :b)
191
191
  @m.apply(@db, @dir, 1)
192
- [:schema_info, :a].each{|n| @db.table_exists?(n).should == true}
193
- [:schema_migrations, :b].each{|n| @db.table_exists?(n).should == false}
194
- @db[:a].columns.should == [:a]
192
+ [:schema_info, :a].each{|n| @db.table_exists?(n).must_equal true}
193
+ [:schema_migrations, :b].each{|n| @db.table_exists?(n).must_equal false}
194
+ @db[:a].columns.must_equal [:a]
195
195
 
196
196
  @m.apply(@db, @dir, 2)
197
- [:schema_info, :a].each{|n| @db.table_exists?(n).should == true}
198
- [:schema_migrations, :b].each{|n| @db.table_exists?(n).should == false}
199
- @db[:a].columns.should == [:a, :b]
197
+ [:schema_info, :a].each{|n| @db.table_exists?(n).must_equal true}
198
+ [:schema_migrations, :b].each{|n| @db.table_exists?(n).must_equal false}
199
+ @db[:a].columns.must_equal [:a, :b]
200
200
 
201
201
  @m.apply(@db, @dir, 3)
202
- [:schema_info, :a].each{|n| @db.table_exists?(n).should == true}
203
- [:schema_migrations, :b].each{|n| @db.table_exists?(n).should == false}
204
- @db[:a].columns.should == [:a, :c]
202
+ [:schema_info, :a].each{|n| @db.table_exists?(n).must_equal true}
203
+ [:schema_migrations, :b].each{|n| @db.table_exists?(n).must_equal false}
204
+ @db[:a].columns.must_equal [:a, :c]
205
205
 
206
206
  @m.apply(@db, @dir, 4)
207
- [:schema_info, :b].each{|n| @db.table_exists?(n).should == true}
208
- [:schema_migrations, :a].each{|n| @db.table_exists?(n).should == false}
209
- @db[:b].columns.should == [:a, :c]
207
+ [:schema_info, :b].each{|n| @db.table_exists?(n).must_equal true}
208
+ [:schema_migrations, :a].each{|n| @db.table_exists?(n).must_equal false}
209
+ @db[:b].columns.must_equal [:a, :c]
210
210
 
211
211
  @m.apply(@db, @dir, 5)
212
- [:schema_info, :b].each{|n| @db.table_exists?(n).should == true}
213
- [:schema_migrations, :a].each{|n| @db.table_exists?(n).should == false}
214
- @db[:b].columns.should == [:a, :c, :e]
212
+ [:schema_info, :b].each{|n| @db.table_exists?(n).must_equal true}
213
+ [:schema_migrations, :a].each{|n| @db.table_exists?(n).must_equal false}
214
+ @db[:b].columns.must_equal [:a, :c, :e]
215
215
 
216
216
  @m.apply(@db, @dir, 4)
217
- [:schema_info, :b].each{|n| @db.table_exists?(n).should == true}
218
- [:schema_migrations, :a].each{|n| @db.table_exists?(n).should == false}
219
- @db[:b].columns.should == [:a, :c]
217
+ [:schema_info, :b].each{|n| @db.table_exists?(n).must_equal true}
218
+ [:schema_migrations, :a].each{|n| @db.table_exists?(n).must_equal false}
219
+ @db[:b].columns.must_equal [:a, :c]
220
220
 
221
221
  @m.apply(@db, @dir, 3)
222
- [:schema_info, :a].each{|n| @db.table_exists?(n).should == true}
223
- [:schema_migrations, :b].each{|n| @db.table_exists?(n).should == false}
224
- @db[:a].columns.should == [:a, :c]
222
+ [:schema_info, :a].each{|n| @db.table_exists?(n).must_equal true}
223
+ [:schema_migrations, :b].each{|n| @db.table_exists?(n).must_equal false}
224
+ @db[:a].columns.must_equal [:a, :c]
225
225
 
226
226
  @m.apply(@db, @dir, 2)
227
- [:schema_info, :a].each{|n| @db.table_exists?(n).should == true}
228
- [:schema_migrations, :b].each{|n| @db.table_exists?(n).should == false}
229
- @db[:a].columns.should == [:a, :b]
227
+ [:schema_info, :a].each{|n| @db.table_exists?(n).must_equal true}
228
+ [:schema_migrations, :b].each{|n| @db.table_exists?(n).must_equal false}
229
+ @db[:a].columns.must_equal [:a, :b]
230
230
 
231
231
  @m.apply(@db, @dir, 1)
232
- [:schema_info, :a].each{|n| @db.table_exists?(n).should == true}
233
- [:schema_migrations, :b].each{|n| @db.table_exists?(n).should == false}
234
- @db[:a].columns.should == [:a]
232
+ [:schema_info, :a].each{|n| @db.table_exists?(n).must_equal true}
233
+ [:schema_migrations, :b].each{|n| @db.table_exists?(n).must_equal false}
234
+ @db[:a].columns.must_equal [:a]
235
235
 
236
236
  @m.apply(@db, @dir, 0)
237
- [:schema_info].each{|n| @db.table_exists?(n).should == true}
238
- [:schema_migrations, :a, :b].each{|n| @db.table_exists?(n).should == false}
237
+ [:schema_info].each{|n| @db.table_exists?(n).must_equal true}
238
+ [:schema_migrations, :a, :b].each{|n| @db.table_exists?(n).must_equal false}
239
239
  end
240
240
  end