sequel 4.22.0 → 4.23.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (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
@@ -15,78 +15,78 @@ describe "Sequel::Model basic support" do
15
15
  Object.send(:remove_const, :Item)
16
16
  end
17
17
 
18
- specify ".find should return first matching item" do
19
- Item.all.should == []
20
- Item.find(:name=>'J').should == nil
18
+ it ".find should return first matching item" do
19
+ Item.all.must_equal []
20
+ Item.find(:name=>'J').must_equal nil
21
21
  Item.create(:name=>'J')
22
- Item.find(:name=>'J').should == Item.load(:id=>1, :name=>'J')
22
+ Item.find(:name=>'J').must_equal Item.load(:id=>1, :name=>'J')
23
23
  end
24
24
 
25
- specify ".finder should create method that returns first matching item" do
25
+ it ".finder should create method that returns first matching item" do
26
26
  def Item.by_name(name) where(:name=>name) end
27
27
  Item.finder :by_name
28
- Item.first_by_name('J').should == nil
28
+ Item.first_by_name('J').must_equal nil
29
29
  Item.create(:name=>'J')
30
- Item.first_by_name('J').should == Item.load(:id=>1, :name=>'J')
31
- Item.first_by_name(['J', 'K']).should == Item.load(:id=>1, :name=>'J')
30
+ Item.first_by_name('J').must_equal Item.load(:id=>1, :name=>'J')
31
+ Item.first_by_name(['J', 'K']).must_equal Item.load(:id=>1, :name=>'J')
32
32
  end
33
33
 
34
- specify ".prepared_finder should create method that returns first matching item" do
34
+ it ".prepared_finder should create method that returns first matching item" do
35
35
  def Item.by_name(name) where(:name=>name) end
36
36
  Item.prepared_finder :by_name
37
- Item.first_by_name('J').should == nil
37
+ Item.first_by_name('J').must_equal nil
38
38
  Item.create(:name=>'J')
39
- Item.first_by_name('J').should == Item.load(:id=>1, :name=>'J')
39
+ Item.first_by_name('J').must_equal Item.load(:id=>1, :name=>'J')
40
40
  end
41
41
 
42
- specify ".find_or_create should return first matching item, or create it if it doesn't exist" do
43
- Item.all.should == []
44
- Item.find_or_create(:name=>'J').should == Item.load(:id=>1, :name=>'J')
45
- Item.all.should == [Item.load(:id=>1, :name=>'J')]
46
- Item.find_or_create(:name=>'J').should == Item.load(:id=>1, :name=>'J')
47
- Item.all.should == [Item.load(:id=>1, :name=>'J')]
42
+ it ".find_or_create should return first matching item, or create it if it doesn't exist" do
43
+ Item.all.must_equal []
44
+ Item.find_or_create(:name=>'J').must_equal Item.load(:id=>1, :name=>'J')
45
+ Item.all.must_equal [Item.load(:id=>1, :name=>'J')]
46
+ Item.find_or_create(:name=>'J').must_equal Item.load(:id=>1, :name=>'J')
47
+ Item.all.must_equal [Item.load(:id=>1, :name=>'J')]
48
48
  end
49
49
 
50
- specify "should not raise an error if the implied database table doesn't exist " do
50
+ it "should not raise an error if the implied database table doesn't exist " do
51
51
  class ::Item::Thing < Sequel::Model(@db)
52
52
  set_dataset :items
53
53
  end
54
54
  Item.create(:name=>'J')
55
- Item::Thing.first.should == Item::Thing.load(:id=>1, :name=>'J')
55
+ Item::Thing.first.must_equal Item::Thing.load(:id=>1, :name=>'J')
56
56
  end
57
57
 
58
- specify "should create accessors for all table columns even if all dataset columns aren't selected" do
58
+ it "should create accessors for all table columns even if all dataset columns aren't selected" do
59
59
  c = Class.new(Sequel::Model(@db[:items].select(:id)))
60
60
  o = c.new
61
61
  o.name = 'A'
62
- o.save.should == c.load(:id=>1)
63
- c.select_map(:name).should == ['A']
62
+ o.save.must_equal c.load(:id=>1)
63
+ c.select_map(:name).must_equal ['A']
64
64
  end
65
65
 
66
- specify "should work correctly when a dataset restricts the colums it selects" do
66
+ it "should work correctly when a dataset restricts the colums it selects" do
67
67
  class ::Item::Thing < Sequel::Model(@db[:items].select(:name))
68
68
  end
69
69
  Item.create(:name=>'J')
70
- Item::Thing.first.should == Item::Thing.load(:name=>'J')
70
+ Item::Thing.first.must_equal Item::Thing.load(:name=>'J')
71
71
  end
72
72
 
73
- specify "#delete should delete items correctly" do
73
+ it "#delete should delete items correctly" do
74
74
  i = Item.create(:name=>'J')
75
- Item.count.should == 1
75
+ Item.count.must_equal 1
76
76
  i.delete
77
- Item.count.should == 0
77
+ Item.count.must_equal 0
78
78
  end
79
79
 
80
- specify "#save should return nil if raise_on_save_failure is false and save isn't successful" do
80
+ it "#save should return nil if raise_on_save_failure is false and save isn't successful" do
81
81
  i = Item.new(:name=>'J')
82
82
  i.use_transactions = true
83
83
  def i.after_save
84
84
  raise Sequel::Rollback
85
85
  end
86
- i.save.should be_nil
86
+ i.save.must_equal nil
87
87
  end
88
88
 
89
- specify "#should respect after_commit, after_rollback, after_destroy_commit, and after_destroy_rollback hooks" do
89
+ it "#should respect after_commit, after_rollback, after_destroy_commit, and after_destroy_rollback hooks" do
90
90
  i = Item.create(:name=>'J')
91
91
  i.use_transactions = true
92
92
  def i.hooks
@@ -118,35 +118,35 @@ describe "Sequel::Model basic support" do
118
118
  end
119
119
  i.name = 'K'
120
120
  i.rb = true
121
- i.save.should be_nil
122
- i.reload.name.should == 'J'
123
- i.hooks.should == [:as, :ar]
121
+ i.save.must_equal nil
122
+ i.reload.name.must_equal 'J'
123
+ i.hooks.must_equal [:as, :ar]
124
124
 
125
125
  i.rb = true
126
- i.destroy.should be_nil
127
- i.exists?.should == true
128
- i.hooks.should == [:ad, :adr]
126
+ i.destroy.must_equal nil
127
+ i.exists?.must_equal true
128
+ i.hooks.must_equal [:ad, :adr]
129
129
 
130
130
  i.name = 'K'
131
131
  i.rb = false
132
- i.save.should_not be_nil
133
- i.reload.name.should == 'K'
134
- i.hooks.should == [:as, :ac]
132
+ i.save.wont_equal nil
133
+ i.reload.name.must_equal 'K'
134
+ i.hooks.must_equal [:as, :ac]
135
135
 
136
136
  i.rb = false
137
- i.destroy.should_not be_nil
138
- i.exists?.should == false
139
- i.hooks.should == [:ad, :adc]
137
+ i.destroy.wont_equal nil
138
+ i.exists?.must_equal false
139
+ i.hooks.must_equal [:ad, :adc]
140
140
  end
141
141
 
142
- specify "#exists? should return whether the item is still in the database" do
142
+ it "#exists? should return whether the item is still in the database" do
143
143
  i = Item.create(:name=>'J')
144
- i.exists?.should == true
144
+ i.exists?.must_equal true
145
145
  Item.dataset.delete
146
- i.exists?.should == false
146
+ i.exists?.must_equal false
147
147
  end
148
148
 
149
- specify "#save should only update specified columns when saving" do
149
+ it "#save should only update specified columns when saving" do
150
150
  @db.create_table!(:items) do
151
151
  primary_key :id
152
152
  String :name
@@ -154,60 +154,60 @@ describe "Sequel::Model basic support" do
154
154
  end
155
155
  Item.dataset = Item.dataset
156
156
  i = Item.create(:name=>'J', :num=>1)
157
- Item.all.should == [Item.load(:id=>1, :name=>'J', :num=>1)]
157
+ Item.all.must_equal [Item.load(:id=>1, :name=>'J', :num=>1)]
158
158
  i.set(:name=>'K', :num=>2)
159
159
  i.save(:columns=>:name)
160
- Item.all.should == [Item.load(:id=>1, :name=>'K', :num=>1)]
160
+ Item.all.must_equal [Item.load(:id=>1, :name=>'K', :num=>1)]
161
161
  i.set(:name=>'L')
162
162
  i.save(:columns=>:num)
163
- Item.all.should == [Item.load(:id=>1, :name=>'K', :num=>2)]
163
+ Item.all.must_equal [Item.load(:id=>1, :name=>'K', :num=>2)]
164
164
  end
165
165
 
166
- specify "#save should check that the only a single row is modified, unless require_modification is false" do
166
+ it "#save should check that the only a single row is modified, unless require_modification is false" do
167
167
  i = Item.create(:name=>'a')
168
168
  i.require_modification = true
169
169
  i.delete
170
- proc{i.save}.should raise_error(Sequel::NoExistingObject)
171
- proc{i.delete}.should raise_error(Sequel::NoExistingObject)
170
+ proc{i.save}.must_raise(Sequel::NoExistingObject)
171
+ proc{i.delete}.must_raise(Sequel::NoExistingObject)
172
172
 
173
173
  i.require_modification = false
174
174
  i.save
175
175
  i.delete
176
176
  end
177
177
 
178
- specify ".to_hash should return a hash keyed on primary key if no argument provided" do
178
+ it ".to_hash should return a hash keyed on primary key if no argument provided" do
179
179
  Item.create(:name=>'J')
180
- Item.to_hash.should == {1=>Item.load(:id=>1, :name=>'J')}
180
+ Item.to_hash.must_equal(1=>Item.load(:id=>1, :name=>'J'))
181
181
  end
182
182
 
183
- specify ".to_hash should return a hash keyed on argument if one argument provided" do
183
+ it ".to_hash should return a hash keyed on argument if one argument provided" do
184
184
  Item.create(:name=>'J')
185
- Item.to_hash(:name).should == {'J'=>Item.load(:id=>1, :name=>'J')}
185
+ Item.to_hash(:name).must_equal('J'=>Item.load(:id=>1, :name=>'J'))
186
186
  end
187
187
 
188
- specify "should be marshallable before and after saving if marshallable! is called" do
188
+ it "should be marshallable before and after saving if marshallable! is called" do
189
189
  i = Item.new(:name=>'J')
190
190
  s = nil
191
191
  i2 = nil
192
192
  i.marshallable!
193
- proc{s = Marshal.dump(i)}.should_not raise_error
194
- proc{i2 = Marshal.load(s)}.should_not raise_error
195
- i2.should == i
193
+ s = Marshal.dump(i)
194
+ i2 = Marshal.load(s)
195
+ i2.must_equal i
196
196
 
197
197
  i.save
198
198
  i.marshallable!
199
- proc{s = Marshal.dump(i)}.should_not raise_error
200
- proc{i2 = Marshal.load(s)}.should_not raise_error
201
- i2.should == i
199
+ s = Marshal.dump(i)
200
+ i2 = Marshal.load(s)
201
+ i2.must_equal i
202
202
 
203
203
  i.save
204
204
  i.marshallable!
205
- proc{s = Marshal.dump(i)}.should_not raise_error
206
- proc{i2 = Marshal.load(s)}.should_not raise_error
207
- i2.should == i
205
+ s = Marshal.dump(i)
206
+ i2 = Marshal.load(s)
207
+ i2.must_equal i
208
208
  end
209
209
 
210
- specify "#lock! should lock records" do
210
+ it "#lock! should lock records" do
211
211
  Item.db.transaction do
212
212
  i = Item.create(:name=>'J')
213
213
  i.lock!
@@ -217,10 +217,10 @@ describe "Sequel::Model basic support" do
217
217
  end
218
218
 
219
219
  describe "Sequel::Model with no existing table" do
220
- specify "should not raise an error when setting the dataset" do
220
+ it "should not raise an error when setting the dataset" do
221
221
  db = DB
222
222
  db.drop_table?(:items)
223
- proc{class ::Item < Sequel::Model(db); end; Object.send(:remove_const, :Item)}.should_not raise_error
224
- proc{c = Class.new(Sequel::Model); c.set_dataset(db[:items])}.should_not raise_error
223
+ class ::Item < Sequel::Model(db); end; Object.send(:remove_const, :Item)
224
+ c = Class.new(Sequel::Model); c.set_dataset(db[:items])
225
225
  end
226
226
  end
@@ -53,8 +53,8 @@ describe "Class Table Inheritance Plugin" do
53
53
  @db.drop_table? :staff, :executives, :managers, :employees
54
54
  end
55
55
 
56
- specify "should return rows as subclass instances" do
57
- Employee.order(:id).all.should == [
56
+ it "should return rows as subclass instances" do
57
+ Employee.order(:id).all.must_equal [
58
58
  Employee.load(:id=>@i1, :name=>'E', :kind=>'Employee'),
59
59
  Staff.load(:id=>@i2, :name=>'S', :kind=>'Staff'),
60
60
  Manager.load(:id=>@i3, :name=>'M', :kind=>'Manager'),
@@ -62,100 +62,100 @@ describe "Class Table Inheritance Plugin" do
62
62
  ]
63
63
  end
64
64
 
65
- specify "should lazily load columns in subclass tables" do
66
- Employee[@i2][:manager_id].should == nil
67
- Employee[@i2].manager_id.should == @i4
68
- Employee[@i3][:num_staff].should == nil
69
- Employee[@i3].num_staff.should == 7
70
- Employee[@i4][:num_staff].should == nil
71
- Employee[@i4].num_staff.should == 5
72
- Employee[@i4][:num_managers].should == nil
73
- Employee[@i4].num_managers.should == 6
65
+ it "should lazily load columns in subclass tables" do
66
+ Employee[@i2][:manager_id].must_equal nil
67
+ Employee[@i2].manager_id.must_equal @i4
68
+ Employee[@i3][:num_staff].must_equal nil
69
+ Employee[@i3].num_staff.must_equal 7
70
+ Employee[@i4][:num_staff].must_equal nil
71
+ Employee[@i4].num_staff.must_equal 5
72
+ Employee[@i4][:num_managers].must_equal nil
73
+ Employee[@i4].num_managers.must_equal 6
74
74
  end
75
75
 
76
- specify "should eagerly load columns in subclass tables when retrieving multiple objects" do
76
+ it "should eagerly load columns in subclass tables when retrieving multiple objects" do
77
77
  a = Employee.order(:id).all
78
- a[1][:manager_id].should == nil
79
- a[1].manager_id.should == @i4
80
- a[2][:num_staff].should == nil
81
- a[2].num_staff.should == 7
82
- a[3][:num_staff].should == 5 # eagerly loaded by previous call
83
- a[3].num_staff.should == 5
84
- a[3][:num_managers].should == nil
85
- a[3].num_managers.should == 6
78
+ a[1][:manager_id].must_equal nil
79
+ a[1].manager_id.must_equal @i4
80
+ a[2][:num_staff].must_equal nil
81
+ a[2].num_staff.must_equal 7
82
+ a[3][:num_staff].must_equal 5 # eagerly loaded by previous call
83
+ a[3].num_staff.must_equal 5
84
+ a[3][:num_managers].must_equal nil
85
+ a[3].num_managers.must_equal 6
86
86
  end
87
87
 
88
- specify "should include schema for columns for tables for ancestor classes" do
89
- Employee.db_schema.keys.sort_by{|x| x.to_s}.should == [:id, :kind, :name]
90
- Staff.db_schema.keys.sort_by{|x| x.to_s}.should == [:id, :kind, :manager_id, :name]
91
- Manager.db_schema.keys.sort_by{|x| x.to_s}.should == [:id, :kind, :name, :num_staff]
92
- Executive.db_schema.keys.sort_by{|x| x.to_s}.should == [:id, :kind, :name, :num_managers, :num_staff]
88
+ it "should include schema for columns for tables for ancestor classes" do
89
+ Employee.db_schema.keys.sort_by{|x| x.to_s}.must_equal [:id, :kind, :name]
90
+ Staff.db_schema.keys.sort_by{|x| x.to_s}.must_equal [:id, :kind, :manager_id, :name]
91
+ Manager.db_schema.keys.sort_by{|x| x.to_s}.must_equal [:id, :kind, :name, :num_staff]
92
+ Executive.db_schema.keys.sort_by{|x| x.to_s}.must_equal [:id, :kind, :name, :num_managers, :num_staff]
93
93
  end
94
94
 
95
- specify "should include columns for tables for ancestor classes" do
96
- Employee.columns.should == [:id, :name, :kind]
97
- Staff.columns.should == [:id, :name, :kind, :manager_id]
98
- Manager.columns.should == [:id, :name, :kind, :num_staff]
99
- Executive.columns.should == [:id, :name, :kind, :num_staff, :num_managers]
95
+ it "should include columns for tables for ancestor classes" do
96
+ Employee.columns.must_equal [:id, :name, :kind]
97
+ Staff.columns.must_equal [:id, :name, :kind, :manager_id]
98
+ Manager.columns.must_equal [:id, :name, :kind, :num_staff]
99
+ Executive.columns.must_equal [:id, :name, :kind, :num_staff, :num_managers]
100
100
  end
101
101
 
102
- specify "should delete rows from all tables" do
102
+ it "should delete rows from all tables" do
103
103
  e = Executive.first
104
104
  i = e.id
105
105
  e.staff_members_dataset.destroy
106
106
  e.destroy
107
- @db[:executives][:id=>i].should == nil
108
- @db[:managers][:id=>i].should == nil
109
- @db[:employees][:id=>i].should == nil
107
+ @db[:executives][:id=>i].must_equal nil
108
+ @db[:managers][:id=>i].must_equal nil
109
+ @db[:employees][:id=>i].must_equal nil
110
110
  end
111
111
 
112
- specify "should handle associations only defined in subclasses" do
113
- Employee.filter(:employees__id=>@i2).all.first.manager.id.should == @i4
112
+ it "should handle associations only defined in subclasses" do
113
+ Employee.filter(:employees__id=>@i2).all.first.manager.id.must_equal @i4
114
114
  end
115
115
 
116
- specify "should insert rows into all tables" do
116
+ it "should insert rows into all tables" do
117
117
  e = Executive.create(:name=>'Ex2', :num_managers=>8, :num_staff=>9)
118
118
  i = e.id
119
- @db[:employees][:id=>i].should == {:id=>i, :name=>'Ex2', :kind=>'Executive'}
120
- @db[:managers][:id=>i].should == {:id=>i, :num_staff=>9}
121
- @db[:executives][:id=>i].should == {:id=>i, :num_managers=>8}
119
+ @db[:employees][:id=>i].must_equal(:id=>i, :name=>'Ex2', :kind=>'Executive')
120
+ @db[:managers][:id=>i].must_equal(:id=>i, :num_staff=>9)
121
+ @db[:executives][:id=>i].must_equal(:id=>i, :num_managers=>8)
122
122
  end
123
123
 
124
- specify "should update rows in all tables" do
124
+ it "should update rows in all tables" do
125
125
  Executive.first.update(:name=>'Ex2', :num_managers=>8, :num_staff=>9)
126
- @db[:employees][:id=>@i4].should == {:id=>@i4, :name=>'Ex2', :kind=>'Executive'}
127
- @db[:managers][:id=>@i4].should == {:id=>@i4, :num_staff=>9}
128
- @db[:executives][:id=>@i4].should == {:id=>@i4, :num_managers=>8}
126
+ @db[:employees][:id=>@i4].must_equal(:id=>@i4, :name=>'Ex2', :kind=>'Executive')
127
+ @db[:managers][:id=>@i4].must_equal(:id=>@i4, :num_staff=>9)
128
+ @db[:executives][:id=>@i4].must_equal(:id=>@i4, :num_managers=>8)
129
129
  end
130
130
 
131
- specify "should handle many_to_one relationships" do
131
+ it "should handle many_to_one relationships" do
132
132
  m = Staff.first.manager
133
- m.should == Manager[@i4]
134
- m.should be_a_kind_of(Executive)
133
+ m.must_equal Manager[@i4]
134
+ m.must_be_kind_of(Executive)
135
135
  end
136
136
 
137
- specify "should handle eagerly loading many_to_one relationships" do
138
- Staff.limit(1).eager(:manager).all.map{|x| x.manager}.should == [Manager[@i4]]
137
+ it "should handle eagerly loading many_to_one relationships" do
138
+ Staff.limit(1).eager(:manager).all.map{|x| x.manager}.must_equal [Manager[@i4]]
139
139
  end
140
140
 
141
- specify "should handle eagerly graphing many_to_one relationships" do
141
+ it "should handle eagerly graphing many_to_one relationships" do
142
142
  ss = Staff.eager_graph(:manager).all
143
- ss.should == [Staff[@i2]]
144
- ss.map{|x| x.manager}.should == [Manager[@i4]]
143
+ ss.must_equal [Staff[@i2]]
144
+ ss.map{|x| x.manager}.must_equal [Manager[@i4]]
145
145
  end
146
146
 
147
- specify "should handle one_to_many relationships" do
148
- Executive.first.staff_members.should == [Staff[@i2]]
147
+ it "should handle one_to_many relationships" do
148
+ Executive.first.staff_members.must_equal [Staff[@i2]]
149
149
  end
150
150
 
151
- specify "should handle eagerly loading one_to_many relationships" do
152
- Executive.limit(1).eager(:staff_members).first.staff_members.should == [Staff[@i2]]
151
+ it "should handle eagerly loading one_to_many relationships" do
152
+ Executive.limit(1).eager(:staff_members).first.staff_members.must_equal [Staff[@i2]]
153
153
  end
154
154
 
155
- specify "should handle eagerly graphing one_to_many relationships" do
155
+ it "should handle eagerly graphing one_to_many relationships" do
156
156
  es = Executive.limit(1).eager_graph(:staff_members).all
157
- es.should == [Executive[@i4]]
158
- es.map{|x| x.staff_members}.should == [[Staff[@i2]]]
157
+ es.must_equal [Executive[@i4]]
158
+ es.map{|x| x.staff_members}.must_equal [[Staff[@i2]]]
159
159
  end
160
160
  end
161
161
 
@@ -209,132 +209,135 @@ describe "Many Through Many Plugin" do
209
209
  after(:all) do
210
210
  @db.drop_table? :albums_artists, :albums, :artists
211
211
  end
212
+ def around
213
+ DB.transaction(:rollback=>:always){super}
214
+ end
212
215
 
213
216
  def self_join(c)
214
217
  c.join(Sequel.as(c.table_name, :b), Array(c.primary_key).zip(Array(c.primary_key))).select_all(c.table_name)
215
218
  end
216
219
 
217
- specify "should handle super simple case with 1 join table" do
220
+ it "should handle super simple case with 1 join table" do
218
221
  Artist.many_through_many :albums, [[:albums_artists, :artist_id, :album_id]]
219
- Artist[@artist1.id].albums.map{|x| x.name}.sort.should == %w'A D'
220
- Artist[@artist2.id].albums.map{|x| x.name}.sort.should == %w'A C'
221
- Artist[@artist3.id].albums.map{|x| x.name}.sort.should == %w'B C'
222
- Artist[@artist4.id].albums.map{|x| x.name}.sort.should == %w'B D'
222
+ Artist[@artist1.id].albums.map{|x| x.name}.sort.must_equal %w'A D'
223
+ Artist[@artist2.id].albums.map{|x| x.name}.sort.must_equal %w'A C'
224
+ Artist[@artist3.id].albums.map{|x| x.name}.sort.must_equal %w'B C'
225
+ Artist[@artist4.id].albums.map{|x| x.name}.sort.must_equal %w'B D'
223
226
 
224
227
  Artist.plugin :prepared_statements_associations
225
- Artist[@artist1.id].albums.map{|x| x.name}.sort.should == %w'A D'
226
- Artist[@artist2.id].albums.map{|x| x.name}.sort.should == %w'A C'
227
- Artist[@artist3.id].albums.map{|x| x.name}.sort.should == %w'B C'
228
- Artist[@artist4.id].albums.map{|x| x.name}.sort.should == %w'B D'
229
-
230
- Artist.filter(:id=>1).eager(:albums).all.map{|x| x.albums.map{|a| a.name}}.flatten.sort.should == %w'A D'
231
- Artist.filter(:id=>2).eager(:albums).all.map{|x| x.albums.map{|a| a.name}}.flatten.sort.should == %w'A C'
232
- Artist.filter(:id=>3).eager(:albums).all.map{|x| x.albums.map{|a| a.name}}.flatten.sort.should == %w'B C'
233
- Artist.filter(:id=>4).eager(:albums).all.map{|x| x.albums.map{|a| a.name}}.flatten.sort.should == %w'B D'
228
+ Artist[@artist1.id].albums.map{|x| x.name}.sort.must_equal %w'A D'
229
+ Artist[@artist2.id].albums.map{|x| x.name}.sort.must_equal %w'A C'
230
+ Artist[@artist3.id].albums.map{|x| x.name}.sort.must_equal %w'B C'
231
+ Artist[@artist4.id].albums.map{|x| x.name}.sort.must_equal %w'B D'
232
+
233
+ Artist.filter(:id=>@artist1.id).eager(:albums).all.map{|x| x.albums.map{|a| a.name}}.flatten.sort.must_equal %w'A D'
234
+ Artist.filter(:id=>@artist2.id).eager(:albums).all.map{|x| x.albums.map{|a| a.name}}.flatten.sort.must_equal %w'A C'
235
+ Artist.filter(:id=>@artist3.id).eager(:albums).all.map{|x| x.albums.map{|a| a.name}}.flatten.sort.must_equal %w'B C'
236
+ Artist.filter(:id=>@artist4.id).eager(:albums).all.map{|x| x.albums.map{|a| a.name}}.flatten.sort.must_equal %w'B D'
234
237
 
235
- Artist.filter(:artists__id=>1).eager_graph(:albums).all.map{|x| x.albums.map{|a| a.name}}.flatten.sort.should == %w'A D'
236
- Artist.filter(:artists__id=>2).eager_graph(:albums).all.map{|x| x.albums.map{|a| a.name}}.flatten.sort.should == %w'A C'
237
- Artist.filter(:artists__id=>3).eager_graph(:albums).all.map{|x| x.albums.map{|a| a.name}}.flatten.sort.should == %w'B C'
238
- Artist.filter(:artists__id=>4).eager_graph(:albums).all.map{|x| x.albums.map{|a| a.name}}.flatten.sort.should == %w'B D'
238
+ Artist.filter(:artists__id=>@artist1.id).eager_graph(:albums).all.map{|x| x.albums.map{|a| a.name}}.flatten.sort.must_equal %w'A D'
239
+ Artist.filter(:artists__id=>@artist2.id).eager_graph(:albums).all.map{|x| x.albums.map{|a| a.name}}.flatten.sort.must_equal %w'A C'
240
+ Artist.filter(:artists__id=>@artist3.id).eager_graph(:albums).all.map{|x| x.albums.map{|a| a.name}}.flatten.sort.must_equal %w'B C'
241
+ Artist.filter(:artists__id=>@artist4.id).eager_graph(:albums).all.map{|x| x.albums.map{|a| a.name}}.flatten.sort.must_equal %w'B D'
239
242
 
240
- Artist.filter(:albums=>@album1).all.map{|a| a.name}.sort.should == %w'1 2'
241
- Artist.filter(:albums=>@album2).all.map{|a| a.name}.sort.should == %w'3 4'
242
- Artist.filter(:albums=>@album3).all.map{|a| a.name}.sort.should == %w'2 3'
243
- Artist.filter(:albums=>@album4).all.map{|a| a.name}.sort.should == %w'1 4'
243
+ Artist.filter(:albums=>@album1).all.map{|a| a.name}.sort.must_equal %w'1 2'
244
+ Artist.filter(:albums=>@album2).all.map{|a| a.name}.sort.must_equal %w'3 4'
245
+ Artist.filter(:albums=>@album3).all.map{|a| a.name}.sort.must_equal %w'2 3'
246
+ Artist.filter(:albums=>@album4).all.map{|a| a.name}.sort.must_equal %w'1 4'
244
247
 
245
- Artist.exclude(:albums=>@album1).all.map{|a| a.name}.sort.should == %w'3 4'
246
- Artist.exclude(:albums=>@album2).all.map{|a| a.name}.sort.should == %w'1 2'
247
- Artist.exclude(:albums=>@album3).all.map{|a| a.name}.sort.should == %w'1 4'
248
- Artist.exclude(:albums=>@album4).all.map{|a| a.name}.sort.should == %w'2 3'
248
+ Artist.exclude(:albums=>@album1).all.map{|a| a.name}.sort.must_equal %w'3 4'
249
+ Artist.exclude(:albums=>@album2).all.map{|a| a.name}.sort.must_equal %w'1 2'
250
+ Artist.exclude(:albums=>@album3).all.map{|a| a.name}.sort.must_equal %w'1 4'
251
+ Artist.exclude(:albums=>@album4).all.map{|a| a.name}.sort.must_equal %w'2 3'
249
252
 
250
- Artist.filter(:albums=>[@album1, @album3]).all.map{|a| a.name}.sort.should == %w'1 2 3'
251
- Artist.filter(:albums=>[@album2, @album4]).all.map{|a| a.name}.sort.should == %w'1 3 4'
253
+ Artist.filter(:albums=>[@album1, @album3]).all.map{|a| a.name}.sort.must_equal %w'1 2 3'
254
+ Artist.filter(:albums=>[@album2, @album4]).all.map{|a| a.name}.sort.must_equal %w'1 3 4'
252
255
 
253
- Artist.exclude(:albums=>[@album1, @album3]).all.map{|a| a.name}.sort.should == %w'4'
254
- Artist.exclude(:albums=>[@album2, @album4]).all.map{|a| a.name}.sort.should == %w'2'
256
+ Artist.exclude(:albums=>[@album1, @album3]).all.map{|a| a.name}.sort.must_equal %w'4'
257
+ Artist.exclude(:albums=>[@album2, @album4]).all.map{|a| a.name}.sort.must_equal %w'2'
255
258
 
256
- Artist.filter(:albums=>Album.filter(:id=>[@album1.id, @album3.id])).all.map{|a| a.name}.sort.should == %w'1 2 3'
257
- Artist.exclude(:albums=>Album.filter(:id=>[@album1.id, @album3.id])).all.map{|a| a.name}.sort.should == %w'4'
259
+ Artist.filter(:albums=>Album.filter(:id=>[@album1.id, @album3.id])).all.map{|a| a.name}.sort.must_equal %w'1 2 3'
260
+ Artist.exclude(:albums=>Album.filter(:id=>[@album1.id, @album3.id])).all.map{|a| a.name}.sort.must_equal %w'4'
258
261
 
259
262
  c = self_join(Artist)
260
- c.filter(:albums=>@album1).all.map{|a| a.name}.sort.should == %w'1 2'
261
- c.filter(:albums=>@album2).all.map{|a| a.name}.sort.should == %w'3 4'
262
- c.filter(:albums=>@album3).all.map{|a| a.name}.sort.should == %w'2 3'
263
- c.filter(:albums=>@album4).all.map{|a| a.name}.sort.should == %w'1 4'
263
+ c.filter(:albums=>@album1).all.map{|a| a.name}.sort.must_equal %w'1 2'
264
+ c.filter(:albums=>@album2).all.map{|a| a.name}.sort.must_equal %w'3 4'
265
+ c.filter(:albums=>@album3).all.map{|a| a.name}.sort.must_equal %w'2 3'
266
+ c.filter(:albums=>@album4).all.map{|a| a.name}.sort.must_equal %w'1 4'
264
267
 
265
- c.exclude(:albums=>@album1).all.map{|a| a.name}.sort.should == %w'3 4'
266
- c.exclude(:albums=>@album2).all.map{|a| a.name}.sort.should == %w'1 2'
267
- c.exclude(:albums=>@album3).all.map{|a| a.name}.sort.should == %w'1 4'
268
- c.exclude(:albums=>@album4).all.map{|a| a.name}.sort.should == %w'2 3'
268
+ c.exclude(:albums=>@album1).all.map{|a| a.name}.sort.must_equal %w'3 4'
269
+ c.exclude(:albums=>@album2).all.map{|a| a.name}.sort.must_equal %w'1 2'
270
+ c.exclude(:albums=>@album3).all.map{|a| a.name}.sort.must_equal %w'1 4'
271
+ c.exclude(:albums=>@album4).all.map{|a| a.name}.sort.must_equal %w'2 3'
269
272
 
270
- c.filter(:albums=>[@album1, @album3]).all.map{|a| a.name}.sort.should == %w'1 2 3'
271
- c.filter(:albums=>[@album2, @album4]).all.map{|a| a.name}.sort.should == %w'1 3 4'
273
+ c.filter(:albums=>[@album1, @album3]).all.map{|a| a.name}.sort.must_equal %w'1 2 3'
274
+ c.filter(:albums=>[@album2, @album4]).all.map{|a| a.name}.sort.must_equal %w'1 3 4'
272
275
 
273
- c.exclude(:albums=>[@album1, @album3]).all.map{|a| a.name}.sort.should == %w'4'
274
- c.exclude(:albums=>[@album2, @album4]).all.map{|a| a.name}.sort.should == %w'2'
276
+ c.exclude(:albums=>[@album1, @album3]).all.map{|a| a.name}.sort.must_equal %w'4'
277
+ c.exclude(:albums=>[@album2, @album4]).all.map{|a| a.name}.sort.must_equal %w'2'
275
278
 
276
- c.filter(:albums=>self_join(Album).filter(:albums__id=>[@album1.id, @album3.id])).all.map{|a| a.name}.sort.should == %w'1 2 3'
277
- c.exclude(:albums=>self_join(Album).filter(:albums__id=>[@album1.id, @album3.id])).all.map{|a| a.name}.sort.should == %w'4'
279
+ c.filter(:albums=>self_join(Album).filter(:albums__id=>[@album1.id, @album3.id])).all.map{|a| a.name}.sort.must_equal %w'1 2 3'
280
+ c.exclude(:albums=>self_join(Album).filter(:albums__id=>[@album1.id, @album3.id])).all.map{|a| a.name}.sort.must_equal %w'4'
278
281
  end
279
282
 
280
- specify "should handle typical case with 3 join tables" do
283
+ it "should handle typical case with 3 join tables" do
281
284
  Artist.many_through_many :related_artists, [[:albums_artists, :artist_id, :album_id], [:albums, :id, :id], [:albums_artists, :album_id, :artist_id]], :class=>Artist, :distinct=>true
282
- Artist[@artist1.id].related_artists.map{|x| x.name}.sort.should == %w'1 2 4'
283
- Artist[@artist2.id].related_artists.map{|x| x.name}.sort.should == %w'1 2 3'
284
- Artist[@artist3.id].related_artists.map{|x| x.name}.sort.should == %w'2 3 4'
285
- Artist[@artist4.id].related_artists.map{|x| x.name}.sort.should == %w'1 3 4'
285
+ Artist[@artist1.id].related_artists.map{|x| x.name}.sort.must_equal %w'1 2 4'
286
+ Artist[@artist2.id].related_artists.map{|x| x.name}.sort.must_equal %w'1 2 3'
287
+ Artist[@artist3.id].related_artists.map{|x| x.name}.sort.must_equal %w'2 3 4'
288
+ Artist[@artist4.id].related_artists.map{|x| x.name}.sort.must_equal %w'1 3 4'
286
289
 
287
290
  Artist.plugin :prepared_statements_associations
288
- Artist[@artist1.id].related_artists.map{|x| x.name}.sort.should == %w'1 2 4'
289
- Artist[@artist2.id].related_artists.map{|x| x.name}.sort.should == %w'1 2 3'
290
- Artist[@artist3.id].related_artists.map{|x| x.name}.sort.should == %w'2 3 4'
291
- Artist[@artist4.id].related_artists.map{|x| x.name}.sort.should == %w'1 3 4'
291
+ Artist[@artist1.id].related_artists.map{|x| x.name}.sort.must_equal %w'1 2 4'
292
+ Artist[@artist2.id].related_artists.map{|x| x.name}.sort.must_equal %w'1 2 3'
293
+ Artist[@artist3.id].related_artists.map{|x| x.name}.sort.must_equal %w'2 3 4'
294
+ Artist[@artist4.id].related_artists.map{|x| x.name}.sort.must_equal %w'1 3 4'
292
295
 
293
- Artist.filter(:id=>@artist1.id).eager(:related_artists).all.map{|x| x.related_artists.map{|a| a.name}}.flatten.sort.should == %w'1 2 4'
294
- Artist.filter(:id=>@artist2.id).eager(:related_artists).all.map{|x| x.related_artists.map{|a| a.name}}.flatten.sort.should == %w'1 2 3'
295
- Artist.filter(:id=>@artist3.id).eager(:related_artists).all.map{|x| x.related_artists.map{|a| a.name}}.flatten.sort.should == %w'2 3 4'
296
- Artist.filter(:id=>@artist4.id).eager(:related_artists).all.map{|x| x.related_artists.map{|a| a.name}}.flatten.sort.should == %w'1 3 4'
296
+ Artist.filter(:id=>@artist1.id).eager(:related_artists).all.map{|x| x.related_artists.map{|a| a.name}}.flatten.sort.must_equal %w'1 2 4'
297
+ Artist.filter(:id=>@artist2.id).eager(:related_artists).all.map{|x| x.related_artists.map{|a| a.name}}.flatten.sort.must_equal %w'1 2 3'
298
+ Artist.filter(:id=>@artist3.id).eager(:related_artists).all.map{|x| x.related_artists.map{|a| a.name}}.flatten.sort.must_equal %w'2 3 4'
299
+ Artist.filter(:id=>@artist4.id).eager(:related_artists).all.map{|x| x.related_artists.map{|a| a.name}}.flatten.sort.must_equal %w'1 3 4'
297
300
 
298
- Artist.filter(:artists__id=>@artist1.id).eager_graph(:related_artists).all.map{|x| x.related_artists.map{|a| a.name}}.flatten.sort.should == %w'1 2 4'
299
- Artist.filter(:artists__id=>@artist2.id).eager_graph(:related_artists).all.map{|x| x.related_artists.map{|a| a.name}}.flatten.sort.should == %w'1 2 3'
300
- Artist.filter(:artists__id=>@artist3.id).eager_graph(:related_artists).all.map{|x| x.related_artists.map{|a| a.name}}.flatten.sort.should == %w'2 3 4'
301
- Artist.filter(:artists__id=>@artist4.id).eager_graph(:related_artists).all.map{|x| x.related_artists.map{|a| a.name}}.flatten.sort.should == %w'1 3 4'
301
+ Artist.filter(:artists__id=>@artist1.id).eager_graph(:related_artists).all.map{|x| x.related_artists.map{|a| a.name}}.flatten.sort.must_equal %w'1 2 4'
302
+ Artist.filter(:artists__id=>@artist2.id).eager_graph(:related_artists).all.map{|x| x.related_artists.map{|a| a.name}}.flatten.sort.must_equal %w'1 2 3'
303
+ Artist.filter(:artists__id=>@artist3.id).eager_graph(:related_artists).all.map{|x| x.related_artists.map{|a| a.name}}.flatten.sort.must_equal %w'2 3 4'
304
+ Artist.filter(:artists__id=>@artist4.id).eager_graph(:related_artists).all.map{|x| x.related_artists.map{|a| a.name}}.flatten.sort.must_equal %w'1 3 4'
302
305
 
303
- Artist.filter(:related_artists=>@artist1).all.map{|a| a.name}.sort.should == %w'1 2 4'
304
- Artist.filter(:related_artists=>@artist2).all.map{|a| a.name}.sort.should == %w'1 2 3'
305
- Artist.filter(:related_artists=>@artist3).all.map{|a| a.name}.sort.should == %w'2 3 4'
306
- Artist.filter(:related_artists=>@artist4).all.map{|a| a.name}.sort.should == %w'1 3 4'
306
+ Artist.filter(:related_artists=>@artist1).all.map{|a| a.name}.sort.must_equal %w'1 2 4'
307
+ Artist.filter(:related_artists=>@artist2).all.map{|a| a.name}.sort.must_equal %w'1 2 3'
308
+ Artist.filter(:related_artists=>@artist3).all.map{|a| a.name}.sort.must_equal %w'2 3 4'
309
+ Artist.filter(:related_artists=>@artist4).all.map{|a| a.name}.sort.must_equal %w'1 3 4'
307
310
 
308
- Artist.exclude(:related_artists=>@artist1).all.map{|a| a.name}.sort.should == %w'3'
309
- Artist.exclude(:related_artists=>@artist2).all.map{|a| a.name}.sort.should == %w'4'
310
- Artist.exclude(:related_artists=>@artist3).all.map{|a| a.name}.sort.should == %w'1'
311
- Artist.exclude(:related_artists=>@artist4).all.map{|a| a.name}.sort.should == %w'2'
311
+ Artist.exclude(:related_artists=>@artist1).all.map{|a| a.name}.sort.must_equal %w'3'
312
+ Artist.exclude(:related_artists=>@artist2).all.map{|a| a.name}.sort.must_equal %w'4'
313
+ Artist.exclude(:related_artists=>@artist3).all.map{|a| a.name}.sort.must_equal %w'1'
314
+ Artist.exclude(:related_artists=>@artist4).all.map{|a| a.name}.sort.must_equal %w'2'
312
315
 
313
- Artist.filter(:related_artists=>[@artist1, @artist4]).all.map{|a| a.name}.sort.should == %w'1 2 3 4'
314
- Artist.exclude(:related_artists=>[@artist1, @artist4]).all.map{|a| a.name}.sort.should == %w''
316
+ Artist.filter(:related_artists=>[@artist1, @artist4]).all.map{|a| a.name}.sort.must_equal %w'1 2 3 4'
317
+ Artist.exclude(:related_artists=>[@artist1, @artist4]).all.map{|a| a.name}.sort.must_equal %w''
315
318
 
316
- Artist.filter(:related_artists=>Artist.filter(:id=>@artist1.id)).all.map{|a| a.name}.sort.should == %w'1 2 4'
317
- Artist.exclude(:related_artists=>Artist.filter(:id=>@artist1.id)).all.map{|a| a.name}.sort.should == %w'3'
319
+ Artist.filter(:related_artists=>Artist.filter(:id=>@artist1.id)).all.map{|a| a.name}.sort.must_equal %w'1 2 4'
320
+ Artist.exclude(:related_artists=>Artist.filter(:id=>@artist1.id)).all.map{|a| a.name}.sort.must_equal %w'3'
318
321
 
319
322
  c = self_join(Artist)
320
- c.filter(:related_artists=>@artist1).all.map{|a| a.name}.sort.should == %w'1 2 4'
321
- c.filter(:related_artists=>@artist2).all.map{|a| a.name}.sort.should == %w'1 2 3'
322
- c.filter(:related_artists=>@artist3).all.map{|a| a.name}.sort.should == %w'2 3 4'
323
- c.filter(:related_artists=>@artist4).all.map{|a| a.name}.sort.should == %w'1 3 4'
323
+ c.filter(:related_artists=>@artist1).all.map{|a| a.name}.sort.must_equal %w'1 2 4'
324
+ c.filter(:related_artists=>@artist2).all.map{|a| a.name}.sort.must_equal %w'1 2 3'
325
+ c.filter(:related_artists=>@artist3).all.map{|a| a.name}.sort.must_equal %w'2 3 4'
326
+ c.filter(:related_artists=>@artist4).all.map{|a| a.name}.sort.must_equal %w'1 3 4'
324
327
 
325
- c.exclude(:related_artists=>@artist1).all.map{|a| a.name}.sort.should == %w'3'
326
- c.exclude(:related_artists=>@artist2).all.map{|a| a.name}.sort.should == %w'4'
327
- c.exclude(:related_artists=>@artist3).all.map{|a| a.name}.sort.should == %w'1'
328
- c.exclude(:related_artists=>@artist4).all.map{|a| a.name}.sort.should == %w'2'
328
+ c.exclude(:related_artists=>@artist1).all.map{|a| a.name}.sort.must_equal %w'3'
329
+ c.exclude(:related_artists=>@artist2).all.map{|a| a.name}.sort.must_equal %w'4'
330
+ c.exclude(:related_artists=>@artist3).all.map{|a| a.name}.sort.must_equal %w'1'
331
+ c.exclude(:related_artists=>@artist4).all.map{|a| a.name}.sort.must_equal %w'2'
329
332
 
330
- c.filter(:related_artists=>[@artist1, @artist4]).all.map{|a| a.name}.sort.should == %w'1 2 3 4'
331
- c.exclude(:related_artists=>[@artist1, @artist4]).all.map{|a| a.name}.sort.should == %w''
333
+ c.filter(:related_artists=>[@artist1, @artist4]).all.map{|a| a.name}.sort.must_equal %w'1 2 3 4'
334
+ c.exclude(:related_artists=>[@artist1, @artist4]).all.map{|a| a.name}.sort.must_equal %w''
332
335
 
333
- c.filter(:related_artists=>c.filter(:artists__id=>@artist1.id)).all.map{|a| a.name}.sort.should == %w'1 2 4'
334
- c.exclude(:related_artists=>c.filter(:artists__id=>@artist1.id)).all.map{|a| a.name}.sort.should == %w'3'
336
+ c.filter(:related_artists=>c.filter(:artists__id=>@artist1.id)).all.map{|a| a.name}.sort.must_equal %w'1 2 4'
337
+ c.exclude(:related_artists=>c.filter(:artists__id=>@artist1.id)).all.map{|a| a.name}.sort.must_equal %w'3'
335
338
  end
336
339
 
337
- cspecify "should handle extreme case with 5 join tables", :fdbsql do
340
+ it "should handle extreme case with 5 join tables" do
338
341
  Artist.many_through_many :related_albums, [[:albums_artists, :artist_id, :album_id], [:albums, :id, :id], [:albums_artists, :album_id, :artist_id], [:artists, :id, :id], [:albums_artists, :artist_id, :album_id]], :class=>Album, :distinct=>true
339
342
  @db[:albums_artists].delete
340
343
  @album1.add_artist(@artist1)
@@ -345,65 +348,65 @@ describe "Many Through Many Plugin" do
345
348
  @album4.add_artist(@artist3)
346
349
  @album4.add_artist(@artist4)
347
350
 
348
- Artist[@artist1.id].related_albums.map{|x| x.name}.sort.should == %w'A B C'
349
- Artist[@artist2.id].related_albums.map{|x| x.name}.sort.should == %w'A B C D'
350
- Artist[@artist3.id].related_albums.map{|x| x.name}.sort.should == %w'A B D'
351
- Artist[@artist4.id].related_albums.map{|x| x.name}.sort.should == %w'B D'
351
+ Artist[@artist1.id].related_albums.map{|x| x.name}.sort.must_equal %w'A B C'
352
+ Artist[@artist2.id].related_albums.map{|x| x.name}.sort.must_equal %w'A B C D'
353
+ Artist[@artist3.id].related_albums.map{|x| x.name}.sort.must_equal %w'A B D'
354
+ Artist[@artist4.id].related_albums.map{|x| x.name}.sort.must_equal %w'B D'
352
355
 
353
356
  Artist.plugin :prepared_statements_associations
354
- Artist[@artist1.id].related_albums.map{|x| x.name}.sort.should == %w'A B C'
355
- Artist[@artist2.id].related_albums.map{|x| x.name}.sort.should == %w'A B C D'
356
- Artist[@artist3.id].related_albums.map{|x| x.name}.sort.should == %w'A B D'
357
- Artist[@artist4.id].related_albums.map{|x| x.name}.sort.should == %w'B D'
357
+ Artist[@artist1.id].related_albums.map{|x| x.name}.sort.must_equal %w'A B C'
358
+ Artist[@artist2.id].related_albums.map{|x| x.name}.sort.must_equal %w'A B C D'
359
+ Artist[@artist3.id].related_albums.map{|x| x.name}.sort.must_equal %w'A B D'
360
+ Artist[@artist4.id].related_albums.map{|x| x.name}.sort.must_equal %w'B D'
358
361
 
359
- Artist.filter(:id=>@artist1.id).eager(:related_albums).all.map{|x| x.related_albums.map{|a| a.name}}.flatten.sort.should == %w'A B C'
360
- Artist.filter(:id=>@artist2.id).eager(:related_albums).all.map{|x| x.related_albums.map{|a| a.name}}.flatten.sort.should == %w'A B C D'
361
- Artist.filter(:id=>@artist3.id).eager(:related_albums).all.map{|x| x.related_albums.map{|a| a.name}}.flatten.sort.should == %w'A B D'
362
- Artist.filter(:id=>@artist4.id).eager(:related_albums).all.map{|x| x.related_albums.map{|a| a.name}}.flatten.sort.should == %w'B D'
362
+ Artist.filter(:id=>@artist1.id).eager(:related_albums).all.map{|x| x.related_albums.map{|a| a.name}}.flatten.sort.must_equal %w'A B C'
363
+ Artist.filter(:id=>@artist2.id).eager(:related_albums).all.map{|x| x.related_albums.map{|a| a.name}}.flatten.sort.must_equal %w'A B C D'
364
+ Artist.filter(:id=>@artist3.id).eager(:related_albums).all.map{|x| x.related_albums.map{|a| a.name}}.flatten.sort.must_equal %w'A B D'
365
+ Artist.filter(:id=>@artist4.id).eager(:related_albums).all.map{|x| x.related_albums.map{|a| a.name}}.flatten.sort.must_equal %w'B D'
363
366
 
364
- Artist.filter(:artists__id=>@artist1.id).eager_graph(:related_albums).all.map{|x| x.related_albums.map{|a| a.name}}.flatten.sort.should == %w'A B C'
365
- Artist.filter(:artists__id=>@artist2.id).eager_graph(:related_albums).all.map{|x| x.related_albums.map{|a| a.name}}.flatten.sort.should == %w'A B C D'
366
- Artist.filter(:artists__id=>@artist3.id).eager_graph(:related_albums).all.map{|x| x.related_albums.map{|a| a.name}}.flatten.sort.should == %w'A B D'
367
- Artist.filter(:artists__id=>@artist4.id).eager_graph(:related_albums).all.map{|x| x.related_albums.map{|a| a.name}}.flatten.sort.should == %w'B D'
367
+ Artist.filter(:artists__id=>@artist1.id).eager_graph(:related_albums).all.map{|x| x.related_albums.map{|a| a.name}}.flatten.sort.must_equal %w'A B C'
368
+ Artist.filter(:artists__id=>@artist2.id).eager_graph(:related_albums).all.map{|x| x.related_albums.map{|a| a.name}}.flatten.sort.must_equal %w'A B C D'
369
+ Artist.filter(:artists__id=>@artist3.id).eager_graph(:related_albums).all.map{|x| x.related_albums.map{|a| a.name}}.flatten.sort.must_equal %w'A B D'
370
+ Artist.filter(:artists__id=>@artist4.id).eager_graph(:related_albums).all.map{|x| x.related_albums.map{|a| a.name}}.flatten.sort.must_equal %w'B D'
368
371
 
369
- Artist.filter(:related_albums=>@album1).all.map{|a| a.name}.sort.should == %w'1 2 3'
370
- Artist.filter(:related_albums=>@album2).all.map{|a| a.name}.sort.should == %w'1 2 3 4'
371
- Artist.filter(:related_albums=>@album3).all.map{|a| a.name}.sort.should == %w'1 2'
372
- Artist.filter(:related_albums=>@album4).all.map{|a| a.name}.sort.should == %w'2 3 4'
372
+ Artist.filter(:related_albums=>@album1).all.map{|a| a.name}.sort.must_equal %w'1 2 3'
373
+ Artist.filter(:related_albums=>@album2).all.map{|a| a.name}.sort.must_equal %w'1 2 3 4'
374
+ Artist.filter(:related_albums=>@album3).all.map{|a| a.name}.sort.must_equal %w'1 2'
375
+ Artist.filter(:related_albums=>@album4).all.map{|a| a.name}.sort.must_equal %w'2 3 4'
373
376
 
374
- Artist.exclude(:related_albums=>@album1).all.map{|a| a.name}.sort.should == %w'4'
375
- Artist.exclude(:related_albums=>@album2).all.map{|a| a.name}.sort.should == %w''
376
- Artist.exclude(:related_albums=>@album3).all.map{|a| a.name}.sort.should == %w'3 4'
377
- Artist.exclude(:related_albums=>@album4).all.map{|a| a.name}.sort.should == %w'1'
377
+ Artist.exclude(:related_albums=>@album1).all.map{|a| a.name}.sort.must_equal %w'4'
378
+ Artist.exclude(:related_albums=>@album2).all.map{|a| a.name}.sort.must_equal %w''
379
+ Artist.exclude(:related_albums=>@album3).all.map{|a| a.name}.sort.must_equal %w'3 4'
380
+ Artist.exclude(:related_albums=>@album4).all.map{|a| a.name}.sort.must_equal %w'1'
378
381
 
379
- Artist.filter(:related_albums=>[@album1, @album3]).all.map{|a| a.name}.sort.should == %w'1 2 3'
380
- Artist.filter(:related_albums=>[@album3, @album4]).all.map{|a| a.name}.sort.should == %w'1 2 3 4'
382
+ Artist.filter(:related_albums=>[@album1, @album3]).all.map{|a| a.name}.sort.must_equal %w'1 2 3'
383
+ Artist.filter(:related_albums=>[@album3, @album4]).all.map{|a| a.name}.sort.must_equal %w'1 2 3 4'
381
384
 
382
- Artist.exclude(:related_albums=>[@album1, @album3]).all.map{|a| a.name}.sort.should == %w'4'
383
- Artist.exclude(:related_albums=>[@album2, @album4]).all.map{|a| a.name}.sort.should == %w''
385
+ Artist.exclude(:related_albums=>[@album1, @album3]).all.map{|a| a.name}.sort.must_equal %w'4'
386
+ Artist.exclude(:related_albums=>[@album2, @album4]).all.map{|a| a.name}.sort.must_equal %w''
384
387
 
385
- Artist.filter(:related_albums=>Album.filter(:id=>[@album1.id, @album3.id])).all.map{|a| a.name}.sort.should == %w'1 2 3'
386
- Artist.exclude(:related_albums=>Album.filter(:id=>[@album1.id, @album3.id])).all.map{|a| a.name}.sort.should == %w'4'
388
+ Artist.filter(:related_albums=>Album.filter(:id=>[@album1.id, @album3.id])).all.map{|a| a.name}.sort.must_equal %w'1 2 3'
389
+ Artist.exclude(:related_albums=>Album.filter(:id=>[@album1.id, @album3.id])).all.map{|a| a.name}.sort.must_equal %w'4'
387
390
 
388
391
  c = self_join(Artist)
389
- c.filter(:related_albums=>@album1).all.map{|a| a.name}.sort.should == %w'1 2 3'
390
- c.filter(:related_albums=>@album2).all.map{|a| a.name}.sort.should == %w'1 2 3 4'
391
- c.filter(:related_albums=>@album3).all.map{|a| a.name}.sort.should == %w'1 2'
392
- c.filter(:related_albums=>@album4).all.map{|a| a.name}.sort.should == %w'2 3 4'
392
+ c.filter(:related_albums=>@album1).all.map{|a| a.name}.sort.must_equal %w'1 2 3'
393
+ c.filter(:related_albums=>@album2).all.map{|a| a.name}.sort.must_equal %w'1 2 3 4'
394
+ c.filter(:related_albums=>@album3).all.map{|a| a.name}.sort.must_equal %w'1 2'
395
+ c.filter(:related_albums=>@album4).all.map{|a| a.name}.sort.must_equal %w'2 3 4'
393
396
 
394
- c.exclude(:related_albums=>@album1).all.map{|a| a.name}.sort.should == %w'4'
395
- c.exclude(:related_albums=>@album2).all.map{|a| a.name}.sort.should == %w''
396
- c.exclude(:related_albums=>@album3).all.map{|a| a.name}.sort.should == %w'3 4'
397
- c.exclude(:related_albums=>@album4).all.map{|a| a.name}.sort.should == %w'1'
397
+ c.exclude(:related_albums=>@album1).all.map{|a| a.name}.sort.must_equal %w'4'
398
+ c.exclude(:related_albums=>@album2).all.map{|a| a.name}.sort.must_equal %w''
399
+ c.exclude(:related_albums=>@album3).all.map{|a| a.name}.sort.must_equal %w'3 4'
400
+ c.exclude(:related_albums=>@album4).all.map{|a| a.name}.sort.must_equal %w'1'
398
401
 
399
- c.filter(:related_albums=>[@album1, @album3]).all.map{|a| a.name}.sort.should == %w'1 2 3'
400
- c.filter(:related_albums=>[@album3, @album4]).all.map{|a| a.name}.sort.should == %w'1 2 3 4'
402
+ c.filter(:related_albums=>[@album1, @album3]).all.map{|a| a.name}.sort.must_equal %w'1 2 3'
403
+ c.filter(:related_albums=>[@album3, @album4]).all.map{|a| a.name}.sort.must_equal %w'1 2 3 4'
401
404
 
402
- c.exclude(:related_albums=>[@album1, @album3]).all.map{|a| a.name}.sort.should == %w'4'
403
- c.exclude(:related_albums=>[@album2, @album4]).all.map{|a| a.name}.sort.should == %w''
405
+ c.exclude(:related_albums=>[@album1, @album3]).all.map{|a| a.name}.sort.must_equal %w'4'
406
+ c.exclude(:related_albums=>[@album2, @album4]).all.map{|a| a.name}.sort.must_equal %w''
404
407
 
405
- c.filter(:related_albums=>self_join(Album).filter(:albums__id=>[@album1.id, @album3.id])).all.map{|a| a.name}.sort.should == %w'1 2 3'
406
- c.exclude(:related_albums=>self_join(Album).filter(:albums__id=>[@album1.id, @album3.id])).all.map{|a| a.name}.sort.should == %w'4'
408
+ c.filter(:related_albums=>self_join(Album).filter(:albums__id=>[@album1.id, @album3.id])).all.map{|a| a.name}.sort.must_equal %w'1 2 3'
409
+ c.exclude(:related_albums=>self_join(Album).filter(:albums__id=>[@album1.id, @album3.id])).all.map{|a| a.name}.sort.must_equal %w'4'
407
410
  end
408
411
  end
409
412
 
@@ -426,28 +429,28 @@ describe "Lazy Attributes plugin" do
426
429
  Object.send(:remove_const, :Item)
427
430
  end
428
431
 
429
- specify "should not include lazy attribute columns by default" do
430
- Item.first.should == Item.load(:id=>1, :name=>'J')
432
+ it "should not include lazy attribute columns by default" do
433
+ Item.first.must_equal Item.load(:id=>1, :name=>'J')
431
434
  end
432
435
 
433
- specify "should load lazy attribute on access" do
434
- Item.first.num.should == 1
436
+ it "should load lazy attribute on access" do
437
+ Item.first.num.must_equal 1
435
438
  end
436
439
 
437
- specify "should typecast lazy attribute in setter" do
440
+ it "should typecast lazy attribute in setter" do
438
441
  i = Item.new
439
442
  i.num = '1'
440
- i.num.should == 1
443
+ i.num.must_equal 1
441
444
  end
442
445
 
443
- specify "should load lazy attribute for all items returned when accessing any item if using identity map " do
446
+ it "should load lazy attribute for all items returned when accessing any item if using identity map " do
444
447
  Item.create(:name=>'K', :num=>2)
445
448
  a = Item.order(:name).all
446
- a.should == [Item.load(:id=>1, :name=>'J'), Item.load(:id=>2, :name=>'K')]
447
- a.map{|x| x[:num]}.should == [nil, nil]
448
- a.first.num.should == 1
449
- a.map{|x| x[:num]}.should == [1, 2]
450
- a.last.num.should == 2
449
+ a.must_equal [Item.load(:id=>1, :name=>'J'), Item.load(:id=>2, :name=>'K')]
450
+ a.map{|x| x[:num]}.must_equal [nil, nil]
451
+ a.first.num.must_equal 1
452
+ a.map{|x| x[:num]}.must_equal [1, 2]
453
+ a.last.num.must_equal 2
451
454
  end
452
455
  end
453
456
 
@@ -455,7 +458,7 @@ describe "Tactical Eager Loading Plugin" do
455
458
  before(:all) do
456
459
  @db = DB
457
460
  @db.instance_variable_set(:@schemas, {})
458
- @db.drop_table?(:albums_artists) # work around fdbsql disconnect bug
461
+ @db.drop_table?(:albums_artists)
459
462
  @db.create_table!(:artists) do
460
463
  primary_key :id
461
464
  String :name
@@ -494,16 +497,16 @@ describe "Tactical Eager Loading Plugin" do
494
497
  @db.drop_table? :albums, :artists
495
498
  end
496
499
 
497
- specify "should eagerly load associations for all items when accessing any item" do
500
+ it "should eagerly load associations for all items when accessing any item" do
498
501
  a = Artist.order(:name).all
499
- a.map{|x| x.associations}.should == [{}, {}, {}, {}]
500
- a.first.albums.should == [@album1, @album2]
501
- a.map{|x| x.associations}.should == [{:albums=>[@album1, @album2]}, {:albums=>[@album3]}, {:albums=>[@album4]}, {:albums=>[]}]
502
+ a.map{|x| x.associations}.must_equal [{}, {}, {}, {}]
503
+ a.first.albums.must_equal [@album1, @album2]
504
+ a.map{|x| x.associations}.must_equal [{:albums=>[@album1, @album2]}, {:albums=>[@album3]}, {:albums=>[@album4]}, {:albums=>[]}]
502
505
 
503
506
  a = Album.order(:name).all
504
- a.map{|x| x.associations}.should == [{}, {}, {}, {}]
505
- a.first.artist.should == @artist1
506
- a.map{|x| x.associations}.should == [{:artist=>@artist1}, {:artist=>@artist1}, {:artist=>@artist2}, {:artist=>@artist3}]
507
+ a.map{|x| x.associations}.must_equal [{}, {}, {}, {}]
508
+ a.first.artist.must_equal @artist1
509
+ a.map{|x| x.associations}.must_equal [{:artist=>@artist1}, {:artist=>@artist1}, {:artist=>@artist2}, {:artist=>@artist3}]
507
510
  end
508
511
  end
509
512
 
@@ -541,44 +544,47 @@ describe "Touch plugin" do
541
544
  after(:all) do
542
545
  @db.drop_table? :albums_artists, :albums, :artists
543
546
  end
547
+ def around
548
+ DB.transaction(:rollback=>:always){super}
549
+ end
544
550
 
545
- specify "should update the timestamp column when touching the record" do
551
+ it "should update the timestamp column when touching the record" do
546
552
  Album.plugin :touch
547
- @album.updated_at.should == nil
553
+ @album.updated_at.must_equal nil
548
554
  @album.touch
549
- @album.updated_at.to_i.should be_within(2).of(Time.now.to_i)
555
+ @album.updated_at.to_i.must_be_close_to Time.now.to_i, 2
550
556
  end
551
557
 
552
558
  cspecify "should update the timestamp column for many_to_one associated records when the record is updated or destroyed", [:do, :sqlite], [:jdbc, :sqlite], [:swift] do
553
559
  Album.many_to_one :artist
554
560
  Album.plugin :touch, :associations=>:artist
555
- @artist.updated_at.should == nil
561
+ @artist.updated_at.must_equal nil
556
562
  @album.update(:name=>'B')
557
563
  ua = @artist.reload.updated_at
558
564
  if ua.is_a?(Time)
559
- ua.to_i.should be_within(60).of(Time.now.to_i)
565
+ ua.to_i.must_be_close_to Time.now.to_i, 60
560
566
  else
561
- (DateTime.now - ua).should be_within(60.0/86400).of(0)
567
+ (DateTime.now - ua).must_be_close_to 0, 60.0/86400
562
568
  end
563
569
  @artist.update(:updated_at=>nil)
564
570
  @album.destroy
565
571
  if ua.is_a?(Time)
566
- ua.to_i.should be_within(60).of(Time.now.to_i)
572
+ ua.to_i.must_be_close_to Time.now.to_i, 60
567
573
  else
568
- (DateTime.now - ua).should be_within(60.0/86400).of(0)
574
+ (DateTime.now - ua).must_be_close_to 0, 60.0/86400
569
575
  end
570
576
  end
571
577
 
572
578
  cspecify "should update the timestamp column for one_to_many associated records when the record is updated", [:do, :sqlite], [:jdbc, :sqlite], [:swift] do
573
579
  Artist.one_to_many :albums
574
580
  Artist.plugin :touch, :associations=>:albums
575
- @album.updated_at.should == nil
581
+ @album.updated_at.must_equal nil
576
582
  @artist.update(:name=>'B')
577
583
  ua = @album.reload.updated_at
578
584
  if ua.is_a?(Time)
579
- ua.to_i.should be_within(60).of(Time.now.to_i)
585
+ ua.to_i.must_be_close_to Time.now.to_i, 60
580
586
  else
581
- (DateTime.now - ua).should be_within(60.0/86400).of(0)
587
+ (DateTime.now - ua).must_be_close_to 0, 60.0/86400
582
588
  end
583
589
  end
584
590
 
@@ -586,13 +592,13 @@ describe "Touch plugin" do
586
592
  Artist.many_to_many :albums
587
593
  Artist.plugin :touch, :associations=>:albums
588
594
  @artist.add_album(@album)
589
- @album.updated_at.should == nil
595
+ @album.updated_at.must_equal nil
590
596
  @artist.update(:name=>'B')
591
597
  ua = @album.reload.updated_at
592
598
  if ua.is_a?(Time)
593
- ua.to_i.should be_within(60).of(Time.now.to_i)
599
+ ua.to_i.must_be_close_to Time.now.to_i, 60
594
600
  else
595
- (DateTime.now - ua).should be_within(60.0/86400).of(0)
601
+ (DateTime.now - ua).must_be_close_to 0, 60.0/86400
596
602
  end
597
603
  end
598
604
  end
@@ -613,14 +619,14 @@ describe "Serialization plugin" do
613
619
  Object.send(:remove_const, :Item)
614
620
  end
615
621
 
616
- specify "should serialize and deserialize items as needed" do
622
+ it "should serialize and deserialize items as needed" do
617
623
  i = Item.create(:stuff=>{:a=>1})
618
- i.stuff.should == {:a=>1}
624
+ i.stuff.must_equal(:a=>1)
619
625
  i.stuff = [1, 2, 3]
620
626
  i.save
621
- Item.first.stuff.should == [1, 2, 3]
627
+ Item.first.stuff.must_equal [1, 2, 3]
622
628
  i.update(:stuff=>Item.new)
623
- Item.first.stuff.should == Item.new
629
+ Item.first.stuff.must_equal Item.new
624
630
  end
625
631
  end
626
632
 
@@ -645,24 +651,24 @@ describe "OptimisticLocking plugin" do
645
651
  Object.send(:remove_const, :Person)
646
652
  end
647
653
 
648
- specify "should raise an error when updating a stale record" do
654
+ it "should raise an error when updating a stale record" do
649
655
  p1 = Person[@p.id]
650
656
  p2 = Person[@p.id]
651
657
  p1.update(:name=>'Jim')
652
- proc{p2.update(:name=>'Bob')}.should raise_error(Sequel::Plugins::OptimisticLocking::Error)
658
+ proc{p2.update(:name=>'Bob')}.must_raise(Sequel::Plugins::OptimisticLocking::Error)
653
659
  end
654
660
 
655
- specify "should raise an error when destroying a stale record" do
661
+ it "should raise an error when destroying a stale record" do
656
662
  p1 = Person[@p.id]
657
663
  p2 = Person[@p.id]
658
664
  p1.update(:name=>'Jim')
659
- proc{p2.destroy}.should raise_error(Sequel::Plugins::OptimisticLocking::Error)
665
+ proc{p2.destroy}.must_raise(Sequel::Plugins::OptimisticLocking::Error)
660
666
  end
661
667
 
662
- specify "should not raise an error when updating the same record twice" do
668
+ it "should not raise an error when updating the same record twice" do
663
669
  p1 = Person[@p.id]
664
670
  p1.update(:name=>'Jim')
665
- proc{p1.update(:name=>'Bob')}.should_not raise_error
671
+ p1.update(:name=>'Bob')
666
672
  end
667
673
  end
668
674
 
@@ -696,212 +702,212 @@ describe "Composition plugin" do
696
702
  Object.send(:remove_const, :Event)
697
703
  end
698
704
 
699
- specify "should return a composed object if the underlying columns have a value" do
700
- @e1.date.should == Date.civil(2010, 2, 15)
701
- @e2.date.should == nil
705
+ it "should return a composed object if the underlying columns have a value" do
706
+ @e1.date.must_equal Date.civil(2010, 2, 15)
707
+ @e2.date.must_equal nil
702
708
  end
703
709
 
704
- specify "should decompose the object when saving the record" do
710
+ it "should decompose the object when saving the record" do
705
711
  @e1.date = Date.civil(2009, 1, 2)
706
712
  @e1.save
707
- @e1.year.should == 2009
708
- @e1.month.should == 1
709
- @e1.day.should == 2
713
+ @e1.year.must_equal 2009
714
+ @e1.month.must_equal 1
715
+ @e1.day.must_equal 2
710
716
  end
711
717
 
712
- specify "should save all columns when saving changes" do
718
+ it "should save all columns when saving changes" do
713
719
  @e2.date = Date.civil(2009, 10, 2)
714
720
  @e2.save_changes
715
721
  @e2.reload
716
- @e2.year.should == 2009
717
- @e2.month.should == 10
718
- @e2.day.should == 2
722
+ @e2.year.must_equal 2009
723
+ @e2.month.must_equal 10
724
+ @e2.day.must_equal 2
719
725
  end
720
726
  end
721
727
 
722
728
  describe "RcteTree Plugin" do
723
- shared_examples_for "rcte tree plugin" do
724
- specify "should load all standard (not-CTE) methods correctly" do
725
- @a.children.should == [@aa, @ab]
726
- @b.children.should == [@ba, @bb]
727
- @aa.children.should == [@aaa, @aab]
728
- @ab.children.should == [@aba, @abb]
729
- @ba.children.should == []
730
- @bb.children.should == []
731
- @aaa.children.should == [@aaaa, @aaab]
732
- @aab.children.should == []
733
- @aba.children.should == []
734
- @abb.children.should == []
735
- @aaaa.children.should == [@aaaaa]
736
- @aaab.children.should == []
737
- @aaaaa.children.should == []
729
+ RcteTreePluginSpecs = shared_description do
730
+ it "should load all standard (not-CTE) methods correctly" do
731
+ @a.children.must_equal [@aa, @ab]
732
+ @b.children.must_equal [@ba, @bb]
733
+ @aa.children.must_equal [@aaa, @aab]
734
+ @ab.children.must_equal [@aba, @abb]
735
+ @ba.children.must_equal []
736
+ @bb.children.must_equal []
737
+ @aaa.children.must_equal [@aaaa, @aaab]
738
+ @aab.children.must_equal []
739
+ @aba.children.must_equal []
740
+ @abb.children.must_equal []
741
+ @aaaa.children.must_equal [@aaaaa]
742
+ @aaab.children.must_equal []
743
+ @aaaaa.children.must_equal []
738
744
 
739
- @a.parent.should == nil
740
- @b.parent.should == nil
741
- @aa.parent.should == @a
742
- @ab.parent.should == @a
743
- @ba.parent.should == @b
744
- @bb.parent.should == @b
745
- @aaa.parent.should == @aa
746
- @aab.parent.should == @aa
747
- @aba.parent.should == @ab
748
- @abb.parent.should == @ab
749
- @aaaa.parent.should == @aaa
750
- @aaab.parent.should == @aaa
751
- @aaaaa.parent.should == @aaaa
745
+ @a.parent.must_equal nil
746
+ @b.parent.must_equal nil
747
+ @aa.parent.must_equal @a
748
+ @ab.parent.must_equal @a
749
+ @ba.parent.must_equal @b
750
+ @bb.parent.must_equal @b
751
+ @aaa.parent.must_equal @aa
752
+ @aab.parent.must_equal @aa
753
+ @aba.parent.must_equal @ab
754
+ @abb.parent.must_equal @ab
755
+ @aaaa.parent.must_equal @aaa
756
+ @aaab.parent.must_equal @aaa
757
+ @aaaaa.parent.must_equal @aaaa
752
758
  end
753
759
 
754
- specify "should load all ancestors and descendants lazily for a given instance" do
755
- @a.descendants.should == [@aa, @aaa, @aaaa, @aaaaa, @aaab, @aab, @ab, @aba, @abb]
756
- @b.descendants.should == [@ba, @bb]
757
- @aa.descendants.should == [@aaa, @aaaa, @aaaaa, @aaab, @aab]
758
- @ab.descendants.should == [@aba, @abb]
759
- @ba.descendants.should == []
760
- @bb.descendants.should == []
761
- @aaa.descendants.should == [@aaaa, @aaaaa, @aaab]
762
- @aab.descendants.should == []
763
- @aba.descendants.should == []
764
- @abb.descendants.should == []
765
- @aaaa.descendants.should == [@aaaaa]
766
- @aaab.descendants.should == []
767
- @aaaaa.descendants.should == []
760
+ it "should load all ancestors and descendants lazily for a given instance" do
761
+ @a.descendants.must_equal [@aa, @aaa, @aaaa, @aaaaa, @aaab, @aab, @ab, @aba, @abb]
762
+ @b.descendants.must_equal [@ba, @bb]
763
+ @aa.descendants.must_equal [@aaa, @aaaa, @aaaaa, @aaab, @aab]
764
+ @ab.descendants.must_equal [@aba, @abb]
765
+ @ba.descendants.must_equal []
766
+ @bb.descendants.must_equal []
767
+ @aaa.descendants.must_equal [@aaaa, @aaaaa, @aaab]
768
+ @aab.descendants.must_equal []
769
+ @aba.descendants.must_equal []
770
+ @abb.descendants.must_equal []
771
+ @aaaa.descendants.must_equal [@aaaaa]
772
+ @aaab.descendants.must_equal []
773
+ @aaaaa.descendants.must_equal []
768
774
 
769
- @a.ancestors.should == []
770
- @b.ancestors.should == []
771
- @aa.ancestors.should == [@a]
772
- @ab.ancestors.should == [@a]
773
- @ba.ancestors.should == [@b]
774
- @bb.ancestors.should == [@b]
775
- @aaa.ancestors.should == [@a, @aa]
776
- @aab.ancestors.should == [@a, @aa]
777
- @aba.ancestors.should == [@a, @ab]
778
- @abb.ancestors.should == [@a, @ab]
779
- @aaaa.ancestors.should == [@a, @aa, @aaa]
780
- @aaab.ancestors.should == [@a, @aa, @aaa]
781
- @aaaaa.ancestors.should == [@a, @aa, @aaa, @aaaa]
775
+ @a.ancestors.must_equal []
776
+ @b.ancestors.must_equal []
777
+ @aa.ancestors.must_equal [@a]
778
+ @ab.ancestors.must_equal [@a]
779
+ @ba.ancestors.must_equal [@b]
780
+ @bb.ancestors.must_equal [@b]
781
+ @aaa.ancestors.must_equal [@a, @aa]
782
+ @aab.ancestors.must_equal [@a, @aa]
783
+ @aba.ancestors.must_equal [@a, @ab]
784
+ @abb.ancestors.must_equal [@a, @ab]
785
+ @aaaa.ancestors.must_equal [@a, @aa, @aaa]
786
+ @aaab.ancestors.must_equal [@a, @aa, @aaa]
787
+ @aaaaa.ancestors.must_equal [@a, @aa, @aaa, @aaaa]
782
788
  end
783
789
 
784
- specify "should eagerly load all ancestors and descendants for a dataset" do
790
+ it "should eagerly load all ancestors and descendants for a dataset" do
785
791
  nodes = @Node.filter(@Node.primary_key=>[@a.pk, @b.pk, @aaa.pk]).order(:name).eager(:ancestors, :descendants).all
786
- nodes.should == [@a, @aaa, @b]
787
- nodes[0].descendants.should == [@aa, @aaa, @aaaa, @aaaaa, @aaab, @aab, @ab, @aba, @abb]
788
- nodes[1].descendants.should == [@aaaa, @aaaaa, @aaab]
789
- nodes[2].descendants.should == [@ba, @bb]
790
- nodes[0].ancestors.should == []
791
- nodes[1].ancestors.should == [@a, @aa]
792
- nodes[2].ancestors.should == []
792
+ nodes.must_equal [@a, @aaa, @b]
793
+ nodes[0].descendants.must_equal [@aa, @aaa, @aaaa, @aaaaa, @aaab, @aab, @ab, @aba, @abb]
794
+ nodes[1].descendants.must_equal [@aaaa, @aaaaa, @aaab]
795
+ nodes[2].descendants.must_equal [@ba, @bb]
796
+ nodes[0].ancestors.must_equal []
797
+ nodes[1].ancestors.must_equal [@a, @aa]
798
+ nodes[2].ancestors.must_equal []
793
799
  end
794
800
 
795
- specify "should eagerly load descendants to a given level" do
801
+ it "should eagerly load descendants to a given level" do
796
802
  nodes = @Node.filter(@Node.primary_key=>[@a.pk, @b.pk, @aaa.pk]).order(:name).eager(:descendants=>1).all
797
- nodes.should == [@a, @aaa, @b]
798
- nodes[0].descendants.should == [@aa, @ab]
799
- nodes[1].descendants.should == [@aaaa, @aaab]
800
- nodes[2].descendants.should == [@ba, @bb]
803
+ nodes.must_equal [@a, @aaa, @b]
804
+ nodes[0].descendants.must_equal [@aa, @ab]
805
+ nodes[1].descendants.must_equal [@aaaa, @aaab]
806
+ nodes[2].descendants.must_equal [@ba, @bb]
801
807
 
802
808
  nodes = @Node.filter(@Node.primary_key=>[@a.pk, @b.pk, @aaa.pk]).order(:name).eager(:descendants=>2).all
803
- nodes.should == [@a, @aaa, @b]
804
- nodes[0].descendants.should == [@aa, @aaa, @aab, @ab, @aba, @abb]
805
- nodes[1].descendants.should == [@aaaa, @aaaaa, @aaab]
806
- nodes[2].descendants.should == [@ba, @bb]
809
+ nodes.must_equal [@a, @aaa, @b]
810
+ nodes[0].descendants.must_equal [@aa, @aaa, @aab, @ab, @aba, @abb]
811
+ nodes[1].descendants.must_equal [@aaaa, @aaaaa, @aaab]
812
+ nodes[2].descendants.must_equal [@ba, @bb]
807
813
  end
808
814
 
809
- specify "should populate all :children associations when eagerly loading descendants for a dataset" do
815
+ it "should populate all :children associations when eagerly loading descendants for a dataset" do
810
816
  nodes = @Node.filter(@Node.primary_key=>[@a.pk, @b.pk, @aaa.pk]).order(:name).eager(:descendants).all
811
- nodes[0].associations[:children].should == [@aa, @ab]
812
- nodes[1].associations[:children].should == [@aaaa, @aaab]
813
- nodes[2].associations[:children].should == [@ba, @bb]
814
- nodes[0].associations[:children].map{|c1| c1.associations[:children]}.should == [[@aaa, @aab], [@aba, @abb]]
815
- nodes[1].associations[:children].map{|c1| c1.associations[:children]}.should == [[@aaaaa], []]
816
- nodes[2].associations[:children].map{|c1| c1.associations[:children]}.should == [[], []]
817
- nodes[0].associations[:children].map{|c1| c1.associations[:children].map{|c2| c2.associations[:children]}}.should == [[[@aaaa, @aaab], []], [[], []]]
818
- nodes[1].associations[:children].map{|c1| c1.associations[:children].map{|c2| c2.associations[:children]}}.should == [[[]], []]
819
- nodes[0].associations[:children].map{|c1| c1.associations[:children].map{|c2| c2.associations[:children].map{|c3| c3.associations[:children]}}}.should == [[[[@aaaaa], []], []], [[], []]]
820
- nodes[0].associations[:children].map{|c1| c1.associations[:children].map{|c2| c2.associations[:children].map{|c3| c3.associations[:children].map{|c4| c4.associations[:children]}}}}.should == [[[[[]], []], []], [[], []]]
817
+ nodes[0].associations[:children].must_equal [@aa, @ab]
818
+ nodes[1].associations[:children].must_equal [@aaaa, @aaab]
819
+ nodes[2].associations[:children].must_equal [@ba, @bb]
820
+ nodes[0].associations[:children].map{|c1| c1.associations[:children]}.must_equal [[@aaa, @aab], [@aba, @abb]]
821
+ nodes[1].associations[:children].map{|c1| c1.associations[:children]}.must_equal [[@aaaaa], []]
822
+ nodes[2].associations[:children].map{|c1| c1.associations[:children]}.must_equal [[], []]
823
+ nodes[0].associations[:children].map{|c1| c1.associations[:children].map{|c2| c2.associations[:children]}}.must_equal [[[@aaaa, @aaab], []], [[], []]]
824
+ nodes[1].associations[:children].map{|c1| c1.associations[:children].map{|c2| c2.associations[:children]}}.must_equal [[[]], []]
825
+ nodes[0].associations[:children].map{|c1| c1.associations[:children].map{|c2| c2.associations[:children].map{|c3| c3.associations[:children]}}}.must_equal [[[[@aaaaa], []], []], [[], []]]
826
+ nodes[0].associations[:children].map{|c1| c1.associations[:children].map{|c2| c2.associations[:children].map{|c3| c3.associations[:children].map{|c4| c4.associations[:children]}}}}.must_equal [[[[[]], []], []], [[], []]]
821
827
  end
822
828
 
823
- specify "should not populate :children associations for final level when loading descendants to a given level" do
829
+ it "should not populate :children associations for final level when loading descendants to a given level" do
824
830
  nodes = @Node.filter(@Node.primary_key=>[@a.pk, @b.pk, @aaa.pk]).order(:name).eager(:descendants=>1).all
825
- nodes[0].associations[:children].should == [@aa, @ab]
826
- nodes[0].associations[:children].map{|c1| c1.associations[:children]}.should == [nil, nil]
827
- nodes[1].associations[:children].should == [@aaaa, @aaab]
828
- nodes[1].associations[:children].map{|c1| c1.associations[:children]}.should == [nil, nil]
829
- nodes[2].associations[:children].should == [@ba, @bb]
830
- nodes[2].associations[:children].map{|c1| c1.associations[:children]}.should == [nil, nil]
831
+ nodes[0].associations[:children].must_equal [@aa, @ab]
832
+ nodes[0].associations[:children].map{|c1| c1.associations[:children]}.must_equal [nil, nil]
833
+ nodes[1].associations[:children].must_equal [@aaaa, @aaab]
834
+ nodes[1].associations[:children].map{|c1| c1.associations[:children]}.must_equal [nil, nil]
835
+ nodes[2].associations[:children].must_equal [@ba, @bb]
836
+ nodes[2].associations[:children].map{|c1| c1.associations[:children]}.must_equal [nil, nil]
831
837
 
832
- nodes[0].associations[:children].map{|c1| c1.children}.should == [[@aaa, @aab], [@aba, @abb]]
833
- nodes[1].associations[:children].map{|c1| c1.children}.should == [[@aaaaa], []]
834
- nodes[2].associations[:children].map{|c1| c1.children}.should == [[], []]
838
+ nodes[0].associations[:children].map{|c1| c1.children}.must_equal [[@aaa, @aab], [@aba, @abb]]
839
+ nodes[1].associations[:children].map{|c1| c1.children}.must_equal [[@aaaaa], []]
840
+ nodes[2].associations[:children].map{|c1| c1.children}.must_equal [[], []]
835
841
 
836
842
  nodes = @Node.filter(@Node.primary_key=>[@a.pk, @b.pk, @aaa.pk]).order(:name).eager(:descendants=>2).all
837
- nodes[0].associations[:children].should == [@aa, @ab]
838
- nodes[0].associations[:children].map{|c1| c1.associations[:children]}.should == [[@aaa, @aab], [@aba, @abb]]
839
- nodes[0].associations[:children].map{|c1| c1.associations[:children].map{|c2| c2.associations[:children]}}.should == [[[@aaaa, @aaab], nil], [nil, nil]]
840
- nodes[0].associations[:children].map{|c1| c1.associations[:children].map{|c2| (cc2 = c2.associations[:children]) ? cc2.map{|c3| c3.associations[:children]} : nil}}.should == [[[[@aaaaa], []], nil], [nil, nil]]
841
- nodes[0].associations[:children].map{|c1| c1.associations[:children].map{|c2| (cc2 = c2.associations[:children]) ? cc2.map{|c3| (cc3 = c3.associations[:children]) ? cc3.map{|c4| c4.associations[:children]} : nil} : nil}}.should == [[[[nil], []], nil], [nil, nil]]
843
+ nodes[0].associations[:children].must_equal [@aa, @ab]
844
+ nodes[0].associations[:children].map{|c1| c1.associations[:children]}.must_equal [[@aaa, @aab], [@aba, @abb]]
845
+ nodes[0].associations[:children].map{|c1| c1.associations[:children].map{|c2| c2.associations[:children]}}.must_equal [[[@aaaa, @aaab], nil], [nil, nil]]
846
+ nodes[0].associations[:children].map{|c1| c1.associations[:children].map{|c2| (cc2 = c2.associations[:children]) ? cc2.map{|c3| c3.associations[:children]} : nil}}.must_equal [[[[@aaaaa], []], nil], [nil, nil]]
847
+ nodes[0].associations[:children].map{|c1| c1.associations[:children].map{|c2| (cc2 = c2.associations[:children]) ? cc2.map{|c3| (cc3 = c3.associations[:children]) ? cc3.map{|c4| c4.associations[:children]} : nil} : nil}}.must_equal [[[[nil], []], nil], [nil, nil]]
842
848
 
843
- nodes[1].associations[:children].should == [@aaaa, @aaab]
844
- nodes[1].associations[:children].map{|c1| c1.associations[:children]}.should == [[@aaaaa], []]
845
- nodes[1].associations[:children].map{|c1| c1.associations[:children].map{|c2| c2.associations[:children]}}.should == [[nil], []]
849
+ nodes[1].associations[:children].must_equal [@aaaa, @aaab]
850
+ nodes[1].associations[:children].map{|c1| c1.associations[:children]}.must_equal [[@aaaaa], []]
851
+ nodes[1].associations[:children].map{|c1| c1.associations[:children].map{|c2| c2.associations[:children]}}.must_equal [[nil], []]
846
852
 
847
- nodes[2].associations[:children].should == [@ba, @bb]
848
- nodes[2].associations[:children].map{|c1| c1.associations[:children]}.should == [[], []]
853
+ nodes[2].associations[:children].must_equal [@ba, @bb]
854
+ nodes[2].associations[:children].map{|c1| c1.associations[:children]}.must_equal [[], []]
849
855
 
850
- nodes[0].associations[:children].map{|c1| c1.associations[:children].map{|c2| c2.children}}.should == [[[@aaaa, @aaab], []], [[], []]]
851
- nodes[0].associations[:children].map{|c1| c1.associations[:children].map{|c2| c2.children.map{|c3| c3.children}}}.should == [[[[@aaaaa], []], []], [[], []]]
852
- nodes[0].associations[:children].map{|c1| c1.associations[:children].map{|c2| c2.children.map{|c3| c3.children.map{|c4| c4.children}}}}.should == [[[[[]], []], []], [[], []]]
853
- nodes[1].associations[:children].map{|c1| c1.associations[:children].map{|c2| c2.children}}.should == [[[]], []]
856
+ nodes[0].associations[:children].map{|c1| c1.associations[:children].map{|c2| c2.children}}.must_equal [[[@aaaa, @aaab], []], [[], []]]
857
+ nodes[0].associations[:children].map{|c1| c1.associations[:children].map{|c2| c2.children.map{|c3| c3.children}}}.must_equal [[[[@aaaaa], []], []], [[], []]]
858
+ nodes[0].associations[:children].map{|c1| c1.associations[:children].map{|c2| c2.children.map{|c3| c3.children.map{|c4| c4.children}}}}.must_equal [[[[[]], []], []], [[], []]]
859
+ nodes[1].associations[:children].map{|c1| c1.associations[:children].map{|c2| c2.children}}.must_equal [[[]], []]
854
860
  end
855
861
 
856
- specify "should populate all :children associations when lazily loading descendants" do
862
+ it "should populate all :children associations when lazily loading descendants" do
857
863
  @a.descendants
858
- @a.associations[:children].should == [@aa, @ab]
859
- @a.associations[:children].map{|c1| c1.associations[:children]}.should == [[@aaa, @aab], [@aba, @abb]]
860
- @a.associations[:children].map{|c1| c1.associations[:children].map{|c2| c2.associations[:children]}}.should == [[[@aaaa, @aaab], []], [[], []]]
861
- @a.associations[:children].map{|c1| c1.associations[:children].map{|c2| c2.associations[:children].map{|c3| c3.associations[:children]}}}.should == [[[[@aaaaa], []], []], [[], []]]
862
- @a.associations[:children].map{|c1| c1.associations[:children].map{|c2| c2.associations[:children].map{|c3| c3.associations[:children].map{|c4| c4.associations[:children]}}}}.should == [[[[[]], []], []], [[], []]]
864
+ @a.associations[:children].must_equal [@aa, @ab]
865
+ @a.associations[:children].map{|c1| c1.associations[:children]}.must_equal [[@aaa, @aab], [@aba, @abb]]
866
+ @a.associations[:children].map{|c1| c1.associations[:children].map{|c2| c2.associations[:children]}}.must_equal [[[@aaaa, @aaab], []], [[], []]]
867
+ @a.associations[:children].map{|c1| c1.associations[:children].map{|c2| c2.associations[:children].map{|c3| c3.associations[:children]}}}.must_equal [[[[@aaaaa], []], []], [[], []]]
868
+ @a.associations[:children].map{|c1| c1.associations[:children].map{|c2| c2.associations[:children].map{|c3| c3.associations[:children].map{|c4| c4.associations[:children]}}}}.must_equal [[[[[]], []], []], [[], []]]
863
869
 
864
870
  @b.descendants
865
- @b.associations[:children].should == [@ba, @bb]
866
- @b.associations[:children].map{|c1| c1.associations[:children]}.should == [[], []]
871
+ @b.associations[:children].must_equal [@ba, @bb]
872
+ @b.associations[:children].map{|c1| c1.associations[:children]}.must_equal [[], []]
867
873
 
868
874
  @aaa.descendants
869
- @aaa.associations[:children].map{|c1| c1.associations[:children]}.should == [[@aaaaa], []]
870
- @aaa.associations[:children].map{|c1| c1.associations[:children].map{|c2| c2.associations[:children]}}.should == [[[]], []]
875
+ @aaa.associations[:children].map{|c1| c1.associations[:children]}.must_equal [[@aaaaa], []]
876
+ @aaa.associations[:children].map{|c1| c1.associations[:children].map{|c2| c2.associations[:children]}}.must_equal [[[]], []]
871
877
  end
872
878
 
873
- specify "should populate all :parent associations when eagerly loading ancestors for a dataset" do
879
+ it "should populate all :parent associations when eagerly loading ancestors for a dataset" do
874
880
  nodes = @Node.filter(@Node.primary_key=>[@a.pk, @ba.pk, @aaa.pk, @aaaaa.pk]).order(:name).eager(:ancestors).all
875
- nodes[0].associations.fetch(:parent, 1).should == nil
876
- nodes[1].associations[:parent].should == @aa
877
- nodes[1].associations[:parent].associations[:parent].should == @a
878
- nodes[1].associations[:parent].associations[:parent].associations.fetch(:parent, 1).should == nil
879
- nodes[2].associations[:parent].should == @aaaa
880
- nodes[2].associations[:parent].associations[:parent].should == @aaa
881
- nodes[2].associations[:parent].associations[:parent].associations[:parent].should == @aa
882
- nodes[2].associations[:parent].associations[:parent].associations[:parent].associations[:parent].should == @a
883
- nodes[2].associations[:parent].associations[:parent].associations[:parent].associations[:parent].associations.fetch(:parent, 1).should == nil
884
- nodes[3].associations[:parent].should == @b
885
- nodes[3].associations[:parent].associations.fetch(:parent, 1).should == nil
881
+ nodes[0].associations.fetch(:parent, 1).must_equal nil
882
+ nodes[1].associations[:parent].must_equal @aa
883
+ nodes[1].associations[:parent].associations[:parent].must_equal @a
884
+ nodes[1].associations[:parent].associations[:parent].associations.fetch(:parent, 1).must_equal nil
885
+ nodes[2].associations[:parent].must_equal @aaaa
886
+ nodes[2].associations[:parent].associations[:parent].must_equal @aaa
887
+ nodes[2].associations[:parent].associations[:parent].associations[:parent].must_equal @aa
888
+ nodes[2].associations[:parent].associations[:parent].associations[:parent].associations[:parent].must_equal @a
889
+ nodes[2].associations[:parent].associations[:parent].associations[:parent].associations[:parent].associations.fetch(:parent, 1).must_equal nil
890
+ nodes[3].associations[:parent].must_equal @b
891
+ nodes[3].associations[:parent].associations.fetch(:parent, 1).must_equal nil
886
892
  end
887
893
 
888
- specify "should populate all :parent associations when lazily loading ancestors" do
894
+ it "should populate all :parent associations when lazily loading ancestors" do
889
895
  @a.reload
890
896
  @a.ancestors
891
- @a.associations[:parent].should == nil
897
+ @a.associations[:parent].must_equal nil
892
898
 
893
899
  @ba.reload
894
900
  @ba.ancestors
895
- @ba.associations[:parent].should == @b
896
- @ba.associations[:parent].associations.fetch(:parent, 1).should == nil
901
+ @ba.associations[:parent].must_equal @b
902
+ @ba.associations[:parent].associations.fetch(:parent, 1).must_equal nil
897
903
 
898
904
  @ba.reload
899
905
  @aaaaa.ancestors
900
- @aaaaa.associations[:parent].should == @aaaa
901
- @aaaaa.associations[:parent].associations[:parent].should == @aaa
902
- @aaaaa.associations[:parent].associations[:parent].associations[:parent].should == @aa
903
- @aaaaa.associations[:parent].associations[:parent].associations[:parent].associations[:parent].should == @a
904
- @aaaaa.associations[:parent].associations[:parent].associations[:parent].associations[:parent].associations.fetch(:parent, 1).should == nil
906
+ @aaaaa.associations[:parent].must_equal @aaaa
907
+ @aaaaa.associations[:parent].associations[:parent].must_equal @aaa
908
+ @aaaaa.associations[:parent].associations[:parent].associations[:parent].must_equal @aa
909
+ @aaaaa.associations[:parent].associations[:parent].associations[:parent].associations[:parent].must_equal @a
910
+ @aaaaa.associations[:parent].associations[:parent].associations[:parent].associations[:parent].associations.fetch(:parent, 1).must_equal nil
905
911
  end
906
912
  end
907
913
 
@@ -938,18 +944,18 @@ describe "RcteTree Plugin" do
938
944
  @db.drop_table? :nodes
939
945
  end
940
946
 
941
- it_should_behave_like "rcte tree plugin"
947
+ include RcteTreePluginSpecs
942
948
 
943
- specify "should work correctly if not all columns are selected" do
949
+ it "should work correctly if not all columns are selected" do
944
950
  c = Class.new(Sequel::Model(@db[:nodes]))
945
951
  c.plugin :rcte_tree, :order=>:name
946
952
  c.plugin :lazy_attributes, :name
947
- c[:name=>'aaaa'].descendants.should == [c.load(:parent_id=>11, :id=>13)]
948
- c[:name=>'aa'].ancestors.should == [c.load(:parent_id=>nil, :id=>1)]
953
+ c[:name=>'aaaa'].descendants.must_equal [c.load(:parent_id=>11, :id=>13)]
954
+ c[:name=>'aa'].ancestors.must_equal [c.load(:parent_id=>nil, :id=>1)]
949
955
  nodes = c.filter(:id=>[@a.id, @b.id, @aaa.id]).order(:name).eager(:ancestors, :descendants).all
950
- nodes.should == [{:parent_id=>nil, :id=>1}, {:parent_id=>3, :id=>7}, {:parent_id=>nil, :id=>2}].map{|x| c.load(x)}
951
- nodes[2].descendants.should == [{:parent_id=>2, :id=>5}, {:parent_id=>2, :id=>6}].map{|x| c.load(x)}
952
- nodes[1].ancestors.should == [{:parent_id=>nil, :id=>1}, {:parent_id=>1, :id=>3}].map{|x| c.load(x)}
956
+ nodes.must_equal [{:parent_id=>nil, :id=>1}, {:parent_id=>3, :id=>7}, {:parent_id=>nil, :id=>2}].map{|x| c.load(x)}
957
+ nodes[2].descendants.must_equal [{:parent_id=>2, :id=>5}, {:parent_id=>2, :id=>6}].map{|x| c.load(x)}
958
+ nodes[1].ancestors.must_equal [{:parent_id=>nil, :id=>1}, {:parent_id=>1, :id=>3}].map{|x| c.load(x)}
953
959
  end
954
960
  end
955
961
 
@@ -986,7 +992,7 @@ describe "RcteTree Plugin" do
986
992
  @db.drop_table? :nodes
987
993
  end
988
994
 
989
- it_should_behave_like "rcte tree plugin"
995
+ include RcteTreePluginSpecs
990
996
  end
991
997
  end if DB.dataset.supports_cte? and !Sequel.guarded?(:db2)
992
998
 
@@ -1014,42 +1020,42 @@ describe "Instance Filters plugin" do
1014
1020
  Object.send(:remove_const, :Item)
1015
1021
  end
1016
1022
 
1017
- specify "should not raise an error if saving only updates one row" do
1023
+ it "should not raise an error if saving only updates one row" do
1018
1024
  @i.save
1019
- @i.refresh.name.should == 'K'
1025
+ @i.refresh.name.must_equal 'K'
1020
1026
  end
1021
1027
 
1022
- specify "should raise error if saving doesn't update a row" do
1028
+ it "should raise error if saving doesn't update a row" do
1023
1029
  @i.this.update(:number=>2)
1024
- proc{@i.save}.should raise_error(Sequel::Error)
1030
+ proc{@i.save}.must_raise(Sequel::NoExistingObject)
1025
1031
  end
1026
1032
 
1027
- specify "should apply all instance filters" do
1033
+ it "should apply all instance filters" do
1028
1034
  @i.instance_filter{cost <= 2}
1029
1035
  @i.this.update(:number=>2)
1030
- proc{@i.save}.should raise_error(Sequel::Error)
1036
+ proc{@i.save}.must_raise(Sequel::NoExistingObject)
1031
1037
  @i.this.update(:number=>1, :cost=>3)
1032
- proc{@i.save}.should raise_error(Sequel::Error)
1038
+ proc{@i.save}.must_raise(Sequel::NoExistingObject)
1033
1039
  @i.this.update(:cost=>2)
1034
1040
  @i.save
1035
- @i.refresh.name.should == 'K'
1041
+ @i.refresh.name.must_equal 'K'
1036
1042
  end
1037
1043
 
1038
- specify "should clear instance filters after successful save" do
1044
+ it "should clear instance filters after successful save" do
1039
1045
  @i.save
1040
1046
  @i.this.update(:number=>2)
1041
1047
  @i.update(:name=>'L')
1042
- @i.refresh.name.should == 'L'
1048
+ @i.refresh.name.must_equal 'L'
1043
1049
  end
1044
1050
 
1045
- specify "should not raise an error if deleting only deletes one row" do
1051
+ it "should not raise an error if deleting only deletes one row" do
1046
1052
  @i.destroy
1047
- proc{@i.refresh}.should raise_error(Sequel::Error, 'Record not found')
1053
+ proc{@i.refresh}.must_raise(Sequel::Error, 'Record not found')
1048
1054
  end
1049
1055
 
1050
- specify "should raise error if destroying doesn't delete a row" do
1056
+ it "should raise error if destroying doesn't delete a row" do
1051
1057
  @i.this.update(:number=>2)
1052
- proc{@i.destroy}.should raise_error(Sequel::Error)
1058
+ proc{@i.destroy}.must_raise(Sequel::NoExistingObject)
1053
1059
  end
1054
1060
  end
1055
1061
 
@@ -1074,40 +1080,40 @@ describe "UpdatePrimaryKey plugin" do
1074
1080
  @db.drop_table?(:t)
1075
1081
  end
1076
1082
 
1077
- specify "should handle regular updates" do
1083
+ it "should handle regular updates" do
1078
1084
  @c.first.update(:b=>4)
1079
- @db[:t].all.should == [{:a=>1, :b=>4}]
1085
+ @db[:t].all.must_equal [{:a=>1, :b=>4}]
1080
1086
  @c.first.set(:b=>5).save
1081
- @db[:t].all.should == [{:a=>1, :b=>5}]
1087
+ @db[:t].all.must_equal [{:a=>1, :b=>5}]
1082
1088
  @c.first.set(:b=>6).save(:columns=>:b)
1083
- @db[:t].all.should == [{:a=>1, :b=>6}]
1089
+ @db[:t].all.must_equal [{:a=>1, :b=>6}]
1084
1090
  end
1085
1091
 
1086
- specify "should handle updating the primary key field with another field" do
1092
+ it "should handle updating the primary key field with another field" do
1087
1093
  @c.first.update(:a=>2, :b=>4)
1088
- @db[:t].all.should == [{:a=>2, :b=>4}]
1094
+ @db[:t].all.must_equal [{:a=>2, :b=>4}]
1089
1095
  end
1090
1096
 
1091
- specify "should handle updating just the primary key field when saving changes" do
1097
+ it "should handle updating just the primary key field when saving changes" do
1092
1098
  @c.first.update(:a=>2)
1093
- @db[:t].all.should == [{:a=>2, :b=>3}]
1099
+ @db[:t].all.must_equal [{:a=>2, :b=>3}]
1094
1100
  @c.first.set(:a=>3).save(:columns=>:a)
1095
- @db[:t].all.should == [{:a=>3, :b=>3}]
1101
+ @db[:t].all.must_equal [{:a=>3, :b=>3}]
1096
1102
  end
1097
1103
 
1098
- specify "should handle saving after modifying the primary key field with another field" do
1104
+ it "should handle saving after modifying the primary key field with another field" do
1099
1105
  @c.first.set(:a=>2, :b=>4).save
1100
- @db[:t].all.should == [{:a=>2, :b=>4}]
1106
+ @db[:t].all.must_equal [{:a=>2, :b=>4}]
1101
1107
  end
1102
1108
 
1103
- specify "should handle saving after modifying just the primary key field" do
1109
+ it "should handle saving after modifying just the primary key field" do
1104
1110
  @c.first.set(:a=>2).save
1105
- @db[:t].all.should == [{:a=>2, :b=>3}]
1111
+ @db[:t].all.must_equal [{:a=>2, :b=>3}]
1106
1112
  end
1107
1113
 
1108
- specify "should handle saving after updating the primary key" do
1114
+ it "should handle saving after updating the primary key" do
1109
1115
  @c.first.update(:a=>2).update(:b=>4).set(:b=>5).save
1110
- @db[:t].all.should == [{:a=>2, :b=>5}]
1116
+ @db[:t].all.must_equal [{:a=>2, :b=>5}]
1111
1117
  end
1112
1118
  end
1113
1119
 
@@ -1236,203 +1242,203 @@ describe "AssociationPks plugin" do
1236
1242
  [:Artist, :Album, :Tag, :Vocalist, :Instrument, :Hit].each{|s| Object.send(:remove_const, s)}
1237
1243
  end
1238
1244
 
1239
- specify "should return correct associated pks for one_to_many associations" do
1240
- Artist.order(:id).all.map{|a| a.album_pks}.should == [[@al1, @al2, @al3], []]
1245
+ it "should return correct associated pks for one_to_many associations" do
1246
+ Artist.order(:id).all.map{|a| a.album_pks}.must_equal [[@al1, @al2, @al3], []]
1241
1247
  end
1242
1248
 
1243
- specify "should return correct associated pks for many_to_many associations" do
1244
- Album.order(:id).all.map{|a| a.tag_pks.sort}.should == [[@t1, @t2, @t3], [@t2], []]
1249
+ it "should return correct associated pks for many_to_many associations" do
1250
+ Album.order(:id).all.map{|a| a.tag_pks.sort}.must_equal [[@t1, @t2, @t3], [@t2], []]
1245
1251
  end
1246
1252
 
1247
- specify "should return correct associated right-side cpks for one_to_many associations" do
1253
+ it "should return correct associated right-side cpks for one_to_many associations" do
1248
1254
  Album.one_to_many :vocalists, :order=>:first
1249
- Album.order(:id).all.map{|a| a.vocalist_pks.sort}.should == [[@v1, @v2, @v3], [], []]
1255
+ Album.order(:id).all.map{|a| a.vocalist_pks.sort}.must_equal [[@v1, @v2, @v3], [], []]
1250
1256
  end
1251
1257
 
1252
- specify "should return correct associated right-side cpks for many_to_many associations" do
1258
+ it "should return correct associated right-side cpks for many_to_many associations" do
1253
1259
  Album.many_to_many :vocalists, :join_table=>:albums_vocalists, :right_key=>[:first, :last], :order=>:first
1254
- Album.order(:id).all.map{|a| a.vocalist_pks.sort}.should == [[@v1, @v2, @v3], [@v2], []]
1260
+ Album.order(:id).all.map{|a| a.vocalist_pks.sort}.must_equal [[@v1, @v2, @v3], [@v2], []]
1255
1261
  end
1256
1262
 
1257
- specify "should return correct associated pks for left-side cpks for one_to_many associations" do
1263
+ it "should return correct associated pks for left-side cpks for one_to_many associations" do
1258
1264
  Vocalist.one_to_many :instruments, :key=>[:first, :last], :order=>:id
1259
- Vocalist.order(:first, :last).all.map{|a| a.instrument_pks.sort}.should == [[@i1, @i2, @i3], [], []]
1265
+ Vocalist.order(:first, :last).all.map{|a| a.instrument_pks.sort}.must_equal [[@i1, @i2, @i3], [], []]
1260
1266
  end
1261
1267
 
1262
- specify "should return correct associated pks for left-side cpks for many_to_many associations" do
1268
+ it "should return correct associated pks for left-side cpks for many_to_many associations" do
1263
1269
  Vocalist.many_to_many :instruments, :join_table=>:vocalists_instruments, :left_key=>[:first, :last], :order=>:id
1264
- Vocalist.order(:first, :last).all.map{|a| a.instrument_pks.sort}.should == [[@i1, @i2, @i3], [@i2], []]
1270
+ Vocalist.order(:first, :last).all.map{|a| a.instrument_pks.sort}.must_equal [[@i1, @i2, @i3], [@i2], []]
1265
1271
  end
1266
1272
 
1267
- specify "should return correct associated right-side cpks for left-side cpks for one_to_many associations" do
1273
+ it "should return correct associated right-side cpks for left-side cpks for one_to_many associations" do
1268
1274
  Vocalist.one_to_many :hits, :key=>[:first, :last], :order=>:week
1269
- Vocalist.order(:first, :last).all.map{|a| a.hit_pks.sort}.should == [[@h1, @h2, @h3], [], []]
1275
+ Vocalist.order(:first, :last).all.map{|a| a.hit_pks.sort}.must_equal [[@h1, @h2, @h3], [], []]
1270
1276
  end
1271
1277
 
1272
- specify "should return correct associated right-side cpks for left-side cpks for many_to_many associations" do
1278
+ it "should return correct associated right-side cpks for left-side cpks for many_to_many associations" do
1273
1279
  Vocalist.many_to_many :hits, :join_table=>:vocalists_hits, :left_key=>[:first, :last], :right_key=>[:year, :week], :order=>:week
1274
- Vocalist.order(:first, :last).all.map{|a| a.hit_pks.sort}.should == [[@h1, @h2, @h3], [@h2], []]
1280
+ Vocalist.order(:first, :last).all.map{|a| a.hit_pks.sort}.must_equal [[@h1, @h2, @h3], [@h2], []]
1275
1281
  end
1276
1282
 
1277
- specify "should set associated pks correctly for a one_to_many association" do
1283
+ it "should set associated pks correctly for a one_to_many association" do
1278
1284
  Artist.use_transactions = true
1279
- Album.order(:id).select_map(:artist_id).should == [@ar1, @ar1, @ar1]
1285
+ Album.order(:id).select_map(:artist_id).must_equal [@ar1, @ar1, @ar1]
1280
1286
 
1281
1287
  Artist[@ar2].album_pks = [@t1, @t3]
1282
- Artist[@ar1].album_pks.should == [@t2]
1283
- Album.order(:id).select_map(:artist_id).should == [@ar2, @ar1, @ar2]
1288
+ Artist[@ar1].album_pks.must_equal [@t2]
1289
+ Album.order(:id).select_map(:artist_id).must_equal [@ar2, @ar1, @ar2]
1284
1290
 
1285
1291
  Artist[@ar1].album_pks = [@t1]
1286
- Artist[@ar2].album_pks.should == [@t3]
1287
- Album.order(:id).select_map(:artist_id).should == [@ar1, nil, @ar2]
1292
+ Artist[@ar2].album_pks.must_equal [@t3]
1293
+ Album.order(:id).select_map(:artist_id).must_equal [@ar1, nil, @ar2]
1288
1294
 
1289
1295
  Artist[@ar1].album_pks = [@t1, @t2]
1290
- Artist[@ar2].album_pks.should == [@t3]
1291
- Album.order(:id).select_map(:artist_id).should == [@ar1, @ar1, @ar2]
1296
+ Artist[@ar2].album_pks.must_equal [@t3]
1297
+ Album.order(:id).select_map(:artist_id).must_equal [@ar1, @ar1, @ar2]
1292
1298
  end
1293
1299
 
1294
- specify "should set associated pks correctly for a many_to_many association" do
1300
+ it "should set associated pks correctly for a many_to_many association" do
1295
1301
  Artist.use_transactions = true
1296
- @db[:albums_tags].filter(:album_id=>@al1).select_order_map(:tag_id).should == [@t1, @t2, @t3]
1302
+ @db[:albums_tags].filter(:album_id=>@al1).select_order_map(:tag_id).must_equal [@t1, @t2, @t3]
1297
1303
  Album[@al1].tag_pks = [@t1, @t3]
1298
- @db[:albums_tags].filter(:album_id=>@al1).select_order_map(:tag_id).should == [@t1, @t3]
1304
+ @db[:albums_tags].filter(:album_id=>@al1).select_order_map(:tag_id).must_equal [@t1, @t3]
1299
1305
  Album[@al1].tag_pks = []
1300
- @db[:albums_tags].filter(:album_id=>@al1).select_order_map(:tag_id).should == []
1306
+ @db[:albums_tags].filter(:album_id=>@al1).select_order_map(:tag_id).must_equal []
1301
1307
 
1302
- @db[:albums_tags].filter(:album_id=>@al2).select_order_map(:tag_id).should == [@t2]
1308
+ @db[:albums_tags].filter(:album_id=>@al2).select_order_map(:tag_id).must_equal [@t2]
1303
1309
  Album[@al2].tag_pks = [@t1, @t2]
1304
- @db[:albums_tags].filter(:album_id=>@al2).select_order_map(:tag_id).should == [@t1, @t2]
1310
+ @db[:albums_tags].filter(:album_id=>@al2).select_order_map(:tag_id).must_equal [@t1, @t2]
1305
1311
  Album[@al2].tag_pks = []
1306
- @db[:albums_tags].filter(:album_id=>@al1).select_order_map(:tag_id).should == []
1312
+ @db[:albums_tags].filter(:album_id=>@al1).select_order_map(:tag_id).must_equal []
1307
1313
 
1308
- @db[:albums_tags].filter(:album_id=>@al3).select_order_map(:tag_id).should == []
1314
+ @db[:albums_tags].filter(:album_id=>@al3).select_order_map(:tag_id).must_equal []
1309
1315
  Album[@al3].tag_pks = [@t1, @t3]
1310
- @db[:albums_tags].filter(:album_id=>@al3).select_order_map(:tag_id).should == [@t1, @t3]
1316
+ @db[:albums_tags].filter(:album_id=>@al3).select_order_map(:tag_id).must_equal [@t1, @t3]
1311
1317
  Album[@al3].tag_pks = []
1312
- @db[:albums_tags].filter(:album_id=>@al1).select_order_map(:tag_id).should == []
1318
+ @db[:albums_tags].filter(:album_id=>@al1).select_order_map(:tag_id).must_equal []
1313
1319
  end
1314
1320
 
1315
- specify "should set associated right-side cpks correctly for a one_to_many association" do
1321
+ it "should set associated right-side cpks correctly for a one_to_many association" do
1316
1322
  Album.use_transactions = true
1317
1323
  Album.one_to_many :vocalists, :order=>:first
1318
- Album.order(:id).all.map{|a| a.vocalist_pks.sort}.should == [[@v1, @v2, @v3], [], []]
1324
+ Album.order(:id).all.map{|a| a.vocalist_pks.sort}.must_equal [[@v1, @v2, @v3], [], []]
1319
1325
 
1320
1326
  Album[@al2].vocalist_pks = [@v1, @v3]
1321
- Album[@al1].vocalist_pks.should == [@v2]
1322
- Vocalist.order(:first, :last).select_map(:album_id).should == [@al2, @al1, @al2]
1327
+ Album[@al1].vocalist_pks.must_equal [@v2]
1328
+ Vocalist.order(:first, :last).select_map(:album_id).must_equal [@al2, @al1, @al2]
1323
1329
 
1324
1330
  Album[@al1].vocalist_pks = [@v1]
1325
- Album[@al2].vocalist_pks.should == [@v3]
1326
- Vocalist.order(:first, :last).select_map(:album_id).should == [@al1, nil, @al2]
1331
+ Album[@al2].vocalist_pks.must_equal [@v3]
1332
+ Vocalist.order(:first, :last).select_map(:album_id).must_equal [@al1, nil, @al2]
1327
1333
 
1328
1334
  Album[@al1].vocalist_pks = [@v1, @v2]
1329
- Album[@al2].vocalist_pks.should == [@v3]
1330
- Vocalist.order(:first, :last).select_map(:album_id).should == [@al1, @al1, @al2]
1335
+ Album[@al2].vocalist_pks.must_equal [@v3]
1336
+ Vocalist.order(:first, :last).select_map(:album_id).must_equal [@al1, @al1, @al2]
1331
1337
  end
1332
1338
 
1333
- specify "should set associated right-side cpks correctly for a many_to_many association" do
1339
+ it "should set associated right-side cpks correctly for a many_to_many association" do
1334
1340
  Album.use_transactions = true
1335
1341
  Album.many_to_many :vocalists, :join_table=>:albums_vocalists, :right_key=>[:first, :last], :order=>:first
1336
1342
 
1337
- @db[:albums_vocalists].filter(:album_id=>@al1).select_order_map([:first, :last]).should == [@v1, @v2, @v3]
1343
+ @db[:albums_vocalists].filter(:album_id=>@al1).select_order_map([:first, :last]).must_equal [@v1, @v2, @v3]
1338
1344
  Album[@al1].vocalist_pks = [@v1, @v3]
1339
- @db[:albums_vocalists].filter(:album_id=>@al1).select_order_map([:first, :last]).should == [@v1, @v3]
1345
+ @db[:albums_vocalists].filter(:album_id=>@al1).select_order_map([:first, :last]).must_equal [@v1, @v3]
1340
1346
  Album[@al1].vocalist_pks = []
1341
- @db[:albums_vocalists].filter(:album_id=>@al1).select_order_map([:first, :last]).should == []
1347
+ @db[:albums_vocalists].filter(:album_id=>@al1).select_order_map([:first, :last]).must_equal []
1342
1348
 
1343
- @db[:albums_vocalists].filter(:album_id=>@al2).select_order_map([:first, :last]).should == [@v2]
1349
+ @db[:albums_vocalists].filter(:album_id=>@al2).select_order_map([:first, :last]).must_equal [@v2]
1344
1350
  Album[@al2].vocalist_pks = [@v1, @v2]
1345
- @db[:albums_vocalists].filter(:album_id=>@al2).select_order_map([:first, :last]).should == [@v1, @v2]
1351
+ @db[:albums_vocalists].filter(:album_id=>@al2).select_order_map([:first, :last]).must_equal [@v1, @v2]
1346
1352
  Album[@al2].vocalist_pks = []
1347
- @db[:albums_vocalists].filter(:album_id=>@al1).select_order_map([:first, :last]).should == []
1353
+ @db[:albums_vocalists].filter(:album_id=>@al1).select_order_map([:first, :last]).must_equal []
1348
1354
 
1349
- @db[:albums_vocalists].filter(:album_id=>@al3).select_order_map([:first, :last]).should == []
1355
+ @db[:albums_vocalists].filter(:album_id=>@al3).select_order_map([:first, :last]).must_equal []
1350
1356
  Album[@al3].vocalist_pks = [@v1, @v3]
1351
- @db[:albums_vocalists].filter(:album_id=>@al3).select_order_map([:first, :last]).should == [@v1, @v3]
1357
+ @db[:albums_vocalists].filter(:album_id=>@al3).select_order_map([:first, :last]).must_equal [@v1, @v3]
1352
1358
  Album[@al3].vocalist_pks = []
1353
- @db[:albums_vocalists].filter(:album_id=>@al1).select_order_map([:first, :last]).should == []
1359
+ @db[:albums_vocalists].filter(:album_id=>@al1).select_order_map([:first, :last]).must_equal []
1354
1360
  end
1355
1361
 
1356
- specify "should set associated pks correctly with left-side cpks for a one_to_many association" do
1362
+ it "should set associated pks correctly with left-side cpks for a one_to_many association" do
1357
1363
  Vocalist.use_transactions = true
1358
1364
  Vocalist.one_to_many :instruments, :key=>[:first, :last], :order=>:id
1359
- Vocalist.order(:first, :last).all.map{|a| a.instrument_pks.sort}.should == [[@i1, @i2, @i3], [], []]
1365
+ Vocalist.order(:first, :last).all.map{|a| a.instrument_pks.sort}.must_equal [[@i1, @i2, @i3], [], []]
1360
1366
 
1361
1367
  Vocalist[@v2].instrument_pks = [@i1, @i3]
1362
- Vocalist[@v1].instrument_pks.should == [@i2]
1363
- Instrument.order(:id).select_map([:first, :last]).should == [@v2, @v1, @v2]
1368
+ Vocalist[@v1].instrument_pks.must_equal [@i2]
1369
+ Instrument.order(:id).select_map([:first, :last]).must_equal [@v2, @v1, @v2]
1364
1370
 
1365
1371
  Vocalist[@v1].instrument_pks = [@i1]
1366
- Vocalist[@v2].instrument_pks.should == [@i3]
1367
- Instrument.order(:id).select_map([:first, :last]).should == [@v1, [nil, nil], @v2]
1372
+ Vocalist[@v2].instrument_pks.must_equal [@i3]
1373
+ Instrument.order(:id).select_map([:first, :last]).must_equal [@v1, [nil, nil], @v2]
1368
1374
 
1369
1375
  Vocalist[@v1].instrument_pks = [@i1, @i2]
1370
- Vocalist[@v2].instrument_pks.should == [@i3]
1371
- Instrument.order(:id).select_map([:first, :last]).should == [@v1, @v1, @v2]
1376
+ Vocalist[@v2].instrument_pks.must_equal [@i3]
1377
+ Instrument.order(:id).select_map([:first, :last]).must_equal [@v1, @v1, @v2]
1372
1378
  end
1373
1379
 
1374
- specify "should set associated pks correctly with left-side cpks for a many_to_many association" do
1380
+ it "should set associated pks correctly with left-side cpks for a many_to_many association" do
1375
1381
  Vocalist.use_transactions = true
1376
1382
  Vocalist.many_to_many :instruments, :join_table=>:vocalists_instruments, :left_key=>[:first, :last], :order=>:id
1377
1383
 
1378
- @db[:vocalists_instruments].filter([:first, :last]=>[@v1]).select_order_map(:instrument_id).should == [@i1, @i2, @i3]
1384
+ @db[:vocalists_instruments].filter([:first, :last]=>[@v1]).select_order_map(:instrument_id).must_equal [@i1, @i2, @i3]
1379
1385
  Vocalist[@v1].instrument_pks = [@i1, @i3]
1380
- @db[:vocalists_instruments].filter([:first, :last]=>[@v1]).select_order_map(:instrument_id).should == [@i1, @i3]
1386
+ @db[:vocalists_instruments].filter([:first, :last]=>[@v1]).select_order_map(:instrument_id).must_equal [@i1, @i3]
1381
1387
  Vocalist[@v1].instrument_pks = []
1382
- @db[:vocalists_instruments].filter([:first, :last]=>[@v1]).select_order_map(:instrument_id).should == []
1388
+ @db[:vocalists_instruments].filter([:first, :last]=>[@v1]).select_order_map(:instrument_id).must_equal []
1383
1389
 
1384
- @db[:vocalists_instruments].filter([:first, :last]=>[@v2]).select_order_map(:instrument_id).should == [@i2]
1390
+ @db[:vocalists_instruments].filter([:first, :last]=>[@v2]).select_order_map(:instrument_id).must_equal [@i2]
1385
1391
  Vocalist[@v2].instrument_pks = [@i1, @i2]
1386
- @db[:vocalists_instruments].filter([:first, :last]=>[@v2]).select_order_map(:instrument_id).should == [@i1, @i2]
1392
+ @db[:vocalists_instruments].filter([:first, :last]=>[@v2]).select_order_map(:instrument_id).must_equal [@i1, @i2]
1387
1393
  Vocalist[@v2].instrument_pks = []
1388
- @db[:vocalists_instruments].filter([:first, :last]=>[@v1]).select_order_map(:instrument_id).should == []
1394
+ @db[:vocalists_instruments].filter([:first, :last]=>[@v1]).select_order_map(:instrument_id).must_equal []
1389
1395
 
1390
- @db[:vocalists_instruments].filter([:first, :last]=>[@v3]).select_order_map(:instrument_id).should == []
1396
+ @db[:vocalists_instruments].filter([:first, :last]=>[@v3]).select_order_map(:instrument_id).must_equal []
1391
1397
  Vocalist[@v3].instrument_pks = [@i1, @i3]
1392
- @db[:vocalists_instruments].filter([:first, :last]=>[@v3]).select_order_map(:instrument_id).should == [@i1, @i3]
1398
+ @db[:vocalists_instruments].filter([:first, :last]=>[@v3]).select_order_map(:instrument_id).must_equal [@i1, @i3]
1393
1399
  Vocalist[@v3].instrument_pks = []
1394
- @db[:vocalists_instruments].filter([:first, :last]=>[@v1]).select_order_map(:instrument_id).should == []
1400
+ @db[:vocalists_instruments].filter([:first, :last]=>[@v1]).select_order_map(:instrument_id).must_equal []
1395
1401
  end
1396
1402
 
1397
- specify "should set associated right-side cpks correctly with left-side cpks for a one_to_many association" do
1403
+ it "should set associated right-side cpks correctly with left-side cpks for a one_to_many association" do
1398
1404
  Vocalist.use_transactions = true
1399
1405
  Vocalist.one_to_many :hits, :key=>[:first, :last], :order=>:week
1400
- Vocalist.order(:first, :last).all.map{|a| a.hit_pks.sort}.should == [[@h1, @h2, @h3], [], []]
1406
+ Vocalist.order(:first, :last).all.map{|a| a.hit_pks.sort}.must_equal [[@h1, @h2, @h3], [], []]
1401
1407
 
1402
1408
  Vocalist[@v2].hit_pks = [@h1, @h3]
1403
- Vocalist[@v1].hit_pks.should == [@h2]
1404
- Hit.order(:year, :week).select_map([:first, :last]).should == [@v2, @v1, @v2]
1409
+ Vocalist[@v1].hit_pks.must_equal [@h2]
1410
+ Hit.order(:year, :week).select_map([:first, :last]).must_equal [@v2, @v1, @v2]
1405
1411
 
1406
1412
  Vocalist[@v1].hit_pks = [@h1]
1407
- Vocalist[@v2].hit_pks.should == [@h3]
1408
- Hit.order(:year, :week).select_map([:first, :last]).should == [@v1, [nil, nil], @v2]
1413
+ Vocalist[@v2].hit_pks.must_equal [@h3]
1414
+ Hit.order(:year, :week).select_map([:first, :last]).must_equal [@v1, [nil, nil], @v2]
1409
1415
 
1410
1416
  Vocalist[@v1].hit_pks = [@h1, @h2]
1411
- Vocalist[@v2].hit_pks.should == [@h3]
1412
- Hit.order(:year, :week).select_map([:first, :last]).should == [@v1, @v1, @v2]
1417
+ Vocalist[@v2].hit_pks.must_equal [@h3]
1418
+ Hit.order(:year, :week).select_map([:first, :last]).must_equal [@v1, @v1, @v2]
1413
1419
  end
1414
1420
 
1415
- specify "should set associated right-side cpks correctly with left-side cpks for a many_to_many association" do
1421
+ it "should set associated right-side cpks correctly with left-side cpks for a many_to_many association" do
1416
1422
  Vocalist.use_transactions = true
1417
1423
  Vocalist.many_to_many :hits, :join_table=>:vocalists_hits, :left_key=>[:first, :last], :right_key=>[:year, :week], :order=>:week
1418
1424
 
1419
- @db[:vocalists_hits].filter([:first, :last]=>[@v1]).select_order_map([:year, :week]).should == [@h1, @h2, @h3]
1425
+ @db[:vocalists_hits].filter([:first, :last]=>[@v1]).select_order_map([:year, :week]).must_equal [@h1, @h2, @h3]
1420
1426
  Vocalist[@v1].hit_pks = [@h1, @h3]
1421
- @db[:vocalists_hits].filter([:first, :last]=>[@v1]).select_order_map([:year, :week]).should == [@h1, @h3]
1427
+ @db[:vocalists_hits].filter([:first, :last]=>[@v1]).select_order_map([:year, :week]).must_equal [@h1, @h3]
1422
1428
  Vocalist[@v1].hit_pks = []
1423
- @db[:vocalists_hits].filter([:first, :last]=>[@v1]).select_order_map([:year, :week]).should == []
1429
+ @db[:vocalists_hits].filter([:first, :last]=>[@v1]).select_order_map([:year, :week]).must_equal []
1424
1430
 
1425
- @db[:vocalists_hits].filter([:first, :last]=>[@v2]).select_order_map([:year, :week]).should == [@h2]
1431
+ @db[:vocalists_hits].filter([:first, :last]=>[@v2]).select_order_map([:year, :week]).must_equal [@h2]
1426
1432
  Vocalist[@v2].hit_pks = [@h1, @h2]
1427
- @db[:vocalists_hits].filter([:first, :last]=>[@v2]).select_order_map([:year, :week]).should == [@h1, @h2]
1433
+ @db[:vocalists_hits].filter([:first, :last]=>[@v2]).select_order_map([:year, :week]).must_equal [@h1, @h2]
1428
1434
  Vocalist[@v2].hit_pks = []
1429
- @db[:vocalists_hits].filter([:first, :last]=>[@v1]).select_order_map([:year, :week]).should == []
1435
+ @db[:vocalists_hits].filter([:first, :last]=>[@v1]).select_order_map([:year, :week]).must_equal []
1430
1436
 
1431
- @db[:vocalists_hits].filter([:first, :last]=>[@v3]).select_order_map([:year, :week]).should == []
1437
+ @db[:vocalists_hits].filter([:first, :last]=>[@v3]).select_order_map([:year, :week]).must_equal []
1432
1438
  Vocalist[@v3].hit_pks = [@h1, @h3]
1433
- @db[:vocalists_hits].filter([:first, :last]=>[@v3]).select_order_map([:year, :week]).should == [@h1, @h3]
1439
+ @db[:vocalists_hits].filter([:first, :last]=>[@v3]).select_order_map([:year, :week]).must_equal [@h1, @h3]
1434
1440
  Vocalist[@v3].hit_pks = []
1435
- @db[:vocalists_hits].filter([:first, :last]=>[@v1]).select_order_map([:year, :week]).should == []
1441
+ @db[:vocalists_hits].filter([:first, :last]=>[@v1]).select_order_map([:year, :week]).must_equal []
1436
1442
  end
1437
1443
  end
1438
1444
 
@@ -1459,59 +1465,63 @@ describe "List plugin without a scope" do
1459
1465
  end
1460
1466
 
1461
1467
  it "should return rows in order of position" do
1462
- @c.map(:position).should == [1,2,3]
1463
- @c.map(:name).should == %w[ abc def hig ]
1468
+ @c.map(:position).must_equal [1,2,3]
1469
+ @c.map(:name).must_equal %w[ abc def hig ]
1464
1470
  end
1465
1471
 
1466
1472
  it "should define prev and next" do
1467
1473
  i = @c[:name => "abc"]
1468
- i.prev.should == nil
1474
+ i.prev.must_equal nil
1469
1475
  i = @c[:name => "def"]
1470
- i.prev.should == @c[:name => "abc"]
1471
- i.next.should == @c[:name => "hig"]
1476
+ i.prev.must_equal @c[:name => "abc"]
1477
+ i.next.must_equal @c[:name => "hig"]
1472
1478
  i = @c[:name => "hig"]
1473
- i.next.should == nil
1479
+ i.next.must_equal nil
1474
1480
  end
1475
1481
 
1476
1482
  it "should define move_to" do
1477
1483
  @c[:name => "def"].move_to(1)
1478
- @c.map(:name).should == %w[ def abc hig ]
1484
+ @c.map(:name).must_equal %w[ def abc hig ]
1479
1485
 
1480
1486
  @c[:name => "abc"].move_to(3)
1481
- @c.map(:name).should == %w[ def hig abc ]
1487
+ @c.map(:name).must_equal %w[ def hig abc ]
1482
1488
 
1483
- proc { @c[:name => "abc"].move_to(-1) }.should raise_error(Sequel::Error)
1484
- proc { @c[:name => "abc"].move_to(10) }.should raise_error(Sequel::Error)
1489
+ @c[:name => "abc"].move_to(-1)
1490
+ @c.map(:name).must_equal %w[ abc def hig ]
1491
+ @c[:name => "abc"].move_to(10)
1492
+ @c.map(:name).must_equal %w[ def hig abc ]
1485
1493
  end
1486
1494
 
1487
1495
  it "should define move_to_top and move_to_bottom" do
1488
1496
  @c[:name => "def"].move_to_top
1489
- @c.map(:name).should == %w[ def abc hig ]
1497
+ @c.map(:name).must_equal %w[ def abc hig ]
1490
1498
 
1491
1499
  @c[:name => "def"].move_to_bottom
1492
- @c.map(:name).should == %w[ abc hig def ]
1500
+ @c.map(:name).must_equal %w[ abc hig def ]
1493
1501
  end
1494
1502
 
1495
1503
  it "should define move_up and move_down" do
1496
1504
  @c[:name => "def"].move_up
1497
- @c.map(:name).should == %w[ def abc hig ]
1505
+ @c.map(:name).must_equal %w[ def abc hig ]
1498
1506
 
1499
1507
  @c[:name => "abc"].move_down
1500
- @c.map(:name).should == %w[ def hig abc ]
1508
+ @c.map(:name).must_equal %w[ def hig abc ]
1501
1509
 
1502
1510
  @c[:name => "abc"].move_up(2)
1503
- @c.map(:name).should == %w[ abc def hig ]
1511
+ @c.map(:name).must_equal %w[ abc def hig ]
1504
1512
 
1505
1513
  @c[:name => "abc"].move_down(2)
1506
- @c.map(:name).should == %w[ def hig abc ]
1514
+ @c.map(:name).must_equal %w[ def hig abc ]
1507
1515
 
1508
- proc { @c[:name => "def"].move_up(10) }.should raise_error(Sequel::Error)
1509
- proc { @c[:name => "def"].move_down(10) }.should raise_error(Sequel::Error)
1516
+ @c[:name => "abc"].move_up(10)
1517
+ @c.map(:name).must_equal %w[ abc def hig ]
1518
+ @c[:name => "abc"].move_down(10)
1519
+ @c.map(:name).must_equal %w[ def hig abc ]
1510
1520
  end
1511
1521
 
1512
1522
  it "should update positions on destroy" do
1513
1523
  @c[:name => "def"].destroy
1514
- @c.select_map([:position, :name]).should == [[1, 'abc'], [2, 'hig']]
1524
+ @c.select_map([:position, :name]).must_equal [[1, 'abc'], [2, 'hig']]
1515
1525
  end
1516
1526
  end
1517
1527
 
@@ -1541,102 +1551,106 @@ describe "List plugin with a scope" do
1541
1551
  @db.drop_table?(:pages)
1542
1552
  end
1543
1553
 
1544
- specify "should return rows in order of position" do
1545
- @c.map(:name).should == %w[ Hm Ps Au P1 P2 P3 ]
1554
+ it "should return rows in order of position" do
1555
+ @c.map(:name).must_equal %w[ Hm Ps Au P1 P2 P3 ]
1546
1556
  end
1547
1557
 
1548
1558
  it "should define prev and next" do
1549
- @c[:name => "Ps"].next.name.should == 'Au'
1550
- @c[:name => "Au"].prev.name.should == 'Ps'
1551
- @c[:name => "P1"].next.name.should == 'P2'
1552
- @c[:name => "P2"].prev.name.should == 'P1'
1559
+ @c[:name => "Ps"].next.name.must_equal 'Au'
1560
+ @c[:name => "Au"].prev.name.must_equal 'Ps'
1561
+ @c[:name => "P1"].next.name.must_equal 'P2'
1562
+ @c[:name => "P2"].prev.name.must_equal 'P1'
1553
1563
 
1554
- @c[:name => "P1"].next(2).name.should == 'P3'
1555
- @c[:name => "P2"].next(-1).name.should == 'P1'
1556
- @c[:name => "P3"].prev(2).name.should == 'P1'
1557
- @c[:name => "P2"].prev(-1).name.should == 'P3'
1564
+ @c[:name => "P1"].next(2).name.must_equal 'P3'
1565
+ @c[:name => "P2"].next(-1).name.must_equal 'P1'
1566
+ @c[:name => "P3"].prev(2).name.must_equal 'P1'
1567
+ @c[:name => "P2"].prev(-1).name.must_equal 'P3'
1558
1568
 
1559
- @c[:name => "Ps"].prev.should == nil
1560
- @c[:name => "Au"].next.should == nil
1561
- @c[:name => "P1"].prev.should == nil
1562
- @c[:name => "P3"].next.should == nil
1569
+ @c[:name => "Ps"].prev.must_equal nil
1570
+ @c[:name => "Au"].next.must_equal nil
1571
+ @c[:name => "P1"].prev.must_equal nil
1572
+ @c[:name => "P3"].next.must_equal nil
1563
1573
  end
1564
1574
 
1565
- specify "should define move_to" do
1575
+ it "should define move_to" do
1566
1576
  @c[:name => "P2"].move_to(1)
1567
- @c.map(:name).should == %w[ Hm Ps Au P2 P1 P3 ]
1577
+ @c.map(:name).must_equal %w[ Hm Ps Au P2 P1 P3 ]
1568
1578
 
1569
1579
  @c[:name => "P2"].move_to(3)
1570
- @c.map(:name).should == %w[ Hm Ps Au P1 P3 P2 ]
1580
+ @c.map(:name).must_equal %w[ Hm Ps Au P1 P3 P2 ]
1571
1581
 
1572
- proc { @c[:name => "P2"].move_to(-1) }.should raise_error(Sequel::Error)
1573
- proc { @c[:name => "P2"].move_to(10) }.should raise_error(Sequel::Error)
1582
+ @c[:name => "P2"].move_to(-1)
1583
+ @c.map(:name).must_equal %w[ Hm Ps Au P2 P1 P3 ]
1584
+ @c[:name => "P2"].move_to(10)
1585
+ @c.map(:name).must_equal %w[ Hm Ps Au P1 P3 P2 ]
1574
1586
  end
1575
1587
 
1576
- specify "should define move_to_top and move_to_bottom" do
1588
+ it "should define move_to_top and move_to_bottom" do
1577
1589
  @c[:name => "Au"].move_to_top
1578
- @c.map(:name).should == %w[ Hm Au Ps P1 P2 P3 ]
1590
+ @c.map(:name).must_equal %w[ Hm Au Ps P1 P2 P3 ]
1579
1591
 
1580
1592
  @c[:name => "Au"].move_to_bottom
1581
- @c.map(:name).should == %w[ Hm Ps Au P1 P2 P3 ]
1593
+ @c.map(:name).must_equal %w[ Hm Ps Au P1 P2 P3 ]
1582
1594
  end
1583
1595
 
1584
- specify "should define move_up and move_down" do
1596
+ it "should define move_up and move_down" do
1585
1597
  @c[:name => "P2"].move_up
1586
- @c.map(:name).should == %w[ Hm Ps Au P2 P1 P3 ]
1598
+ @c.map(:name).must_equal %w[ Hm Ps Au P2 P1 P3 ]
1587
1599
 
1588
1600
  @c[:name => "P1"].move_down
1589
- @c.map(:name).should == %w[ Hm Ps Au P2 P3 P1 ]
1601
+ @c.map(:name).must_equal %w[ Hm Ps Au P2 P3 P1 ]
1590
1602
 
1591
- proc { @c[:name => "P1"].move_up(10) }.should raise_error(Sequel::Error)
1592
- proc { @c[:name => "P1"].move_down(10) }.should raise_error(Sequel::Error)
1603
+ @c[:name => "P1"].move_up(10)
1604
+ @c.map(:name).must_equal %w[ Hm Ps Au P1 P2 P3 ]
1605
+ @c[:name => "P1"].move_down(10)
1606
+ @c.map(:name).must_equal %w[ Hm Ps Au P2 P3 P1 ]
1593
1607
  end
1594
1608
 
1595
1609
  it "should update positions on destroy" do
1596
1610
  @c[:name => "P2"].destroy
1597
- @c.select_order_map([:pos, :name]).should == [[1, "Hm"], [1, "P1"], [1, "Ps"], [2, "Au"], [2, "P3"]]
1611
+ @c.select_order_map([:pos, :name]).must_equal [[1, "Hm"], [1, "P1"], [1, "Ps"], [2, "Au"], [2, "P3"]]
1598
1612
  end
1599
1613
  end
1600
1614
 
1601
1615
  describe "Sequel::Plugins::Tree" do
1602
- shared_examples_for "tree plugin" do
1616
+ TreePluginSpecs = shared_description do
1603
1617
  it "should instantiate" do
1604
- @Node.all.size.should == 12
1618
+ @Node.all.size.must_equal 12
1605
1619
  end
1606
1620
 
1607
1621
  it "should find all descendants of a node" do
1608
- @Node.find(:name => 'two').descendants.map{|m| m.name}.should == %w'two.one two.two two.three two.two.one'
1622
+ @Node.find(:name => 'two').descendants.map{|m| m.name}.must_equal %w'two.one two.two two.three two.two.one'
1609
1623
  end
1610
1624
 
1611
1625
  it "should find all ancestors of a node" do
1612
- @Node.find(:name => "two.two.one").ancestors.map{|m| m.name}.should == %w'two.two two'
1626
+ @Node.find(:name => "two.two.one").ancestors.map{|m| m.name}.must_equal %w'two.two two'
1613
1627
  end
1614
1628
 
1615
1629
  it "should find all siblings of a node, excepting self" do
1616
- @Node.find(:name=>"two.one").siblings.map{|m| m.name}.should == %w'two.two two.three'
1630
+ @Node.find(:name=>"two.one").siblings.map{|m| m.name}.must_equal %w'two.two two.three'
1617
1631
  end
1618
1632
 
1619
1633
  it "should find all siblings of a node, including self" do
1620
- @Node.find(:name=>"two.one").self_and_siblings.map{|m| m.name}.should == %w'two.one two.two two.three'
1634
+ @Node.find(:name=>"two.one").self_and_siblings.map{|m| m.name}.must_equal %w'two.one two.two two.three'
1621
1635
  end
1622
1636
 
1623
1637
  it "should find siblings for root nodes" do
1624
- @Node.find(:name=>'three').self_and_siblings.map{|m| m.name}.should == %w'one two three four five'
1638
+ @Node.find(:name=>'three').self_and_siblings.map{|m| m.name}.must_equal %w'one two three four five'
1625
1639
  end
1626
1640
 
1627
1641
  it "should find correct root for a node" do
1628
- @Node.find(:name=>"two.two.one").root.name.should == 'two'
1629
- @Node.find(:name=>"three").root.name.should == 'three'
1630
- @Node.find(:name=>"five.one").root.name.should == 'five'
1642
+ @Node.find(:name=>"two.two.one").root.name.must_equal 'two'
1643
+ @Node.find(:name=>"three").root.name.must_equal 'three'
1644
+ @Node.find(:name=>"five.one").root.name.must_equal 'five'
1631
1645
  end
1632
1646
 
1633
1647
  it "iterate top-level nodes in order" do
1634
- @Node.roots_dataset.count.should == 5
1635
- @Node.roots.map{|p| p.name}.should == %w'one two three four five'
1648
+ @Node.roots_dataset.count.must_equal 5
1649
+ @Node.roots.map{|p| p.name}.must_equal %w'one two three four five'
1636
1650
  end
1637
1651
 
1638
1652
  it "should have children" do
1639
- @Node.find(:name=>'one').children.map{|m| m.name}.should == %w'one.one one.two'
1653
+ @Node.find(:name=>'one').children.map{|m| m.name}.must_equal %w'one.one one.two'
1640
1654
  end
1641
1655
  end
1642
1656
 
@@ -1671,7 +1685,7 @@ describe "Sequel::Plugins::Tree" do
1671
1685
  @db.drop_table?(:nodes)
1672
1686
  end
1673
1687
 
1674
- it_should_behave_like "tree plugin"
1688
+ include TreePluginSpecs
1675
1689
  end
1676
1690
 
1677
1691
  describe "with composite key" do
@@ -1708,7 +1722,34 @@ describe "Sequel::Plugins::Tree" do
1708
1722
  @db.drop_table?(:nodes)
1709
1723
  end
1710
1724
 
1711
- it_should_behave_like "tree plugin"
1725
+ include TreePluginSpecs
1726
+ end
1727
+ end
1728
+
1729
+ describe "Sequel::Plugins::UpdateRefresh" do
1730
+ before(:all) do
1731
+ @db = DB
1732
+ @db.create_table!(:tests) do
1733
+ primary_key :id
1734
+ String :name
1735
+ Integer :i
1736
+ end
1737
+ @c = Class.new(Sequel::Model(@db[:tests]))
1738
+ @c.plugin :update_refresh
1739
+ end
1740
+ before do
1741
+ @c.dataset.delete
1742
+ @foo = @c.create(:name=>'foo', :i=>10)
1743
+ end
1744
+ after(:all) do
1745
+ @db.drop_table?(:tests)
1746
+ end
1747
+
1748
+ it "should refresh when updating" do
1749
+ @foo.this.update(:i=>20)
1750
+ @foo.update(:name=>'bar')
1751
+ @foo.name.must_equal 'bar'
1752
+ @foo.i.must_equal 20
1712
1753
  end
1713
1754
  end
1714
1755
 
@@ -1733,55 +1774,55 @@ describe "Sequel::Plugins::PreparedStatements" do
1733
1774
  end
1734
1775
 
1735
1776
  it "should work with looking up using Model.[]" do
1736
- @c[@foo.id].should == @foo
1737
- @c[@bar.id].should == @bar
1738
- @c[0].should == nil
1739
- @c[nil].should == nil
1777
+ @c[@foo.id].must_equal @foo
1778
+ @c[@bar.id].must_equal @bar
1779
+ @c[0].must_equal nil
1780
+ @c[nil].must_equal nil
1740
1781
  end
1741
1782
 
1742
1783
  it "should work with looking up using Dataset#with_pk" do
1743
- @c.dataset.with_pk(@foo.id).should == @foo
1744
- @c.dataset.with_pk(@bar.id).should == @bar
1745
- @c.dataset.with_pk(0).should == nil
1746
- @c.dataset.with_pk(nil).should == nil
1784
+ @c.dataset.with_pk(@foo.id).must_equal @foo
1785
+ @c.dataset.with_pk(@bar.id).must_equal @bar
1786
+ @c.dataset.with_pk(0).must_equal nil
1787
+ @c.dataset.with_pk(nil).must_equal nil
1747
1788
 
1748
- @c.dataset.filter(:i=>0).with_pk(@foo.id).should == nil
1749
- @c.dataset.filter(:i=>10).with_pk(@foo.id).should == @foo
1750
- @c.dataset.filter(:i=>20).with_pk(@bar.id).should == @bar
1751
- @c.dataset.filter(:i=>10).with_pk(nil).should == nil
1752
- @c.dataset.filter(:name=>'foo').with_pk(@foo.id).should == @foo
1753
- @c.dataset.filter(:name=>'bar').with_pk(@bar.id).should == @bar
1754
- @c.dataset.filter(:name=>'baz').with_pk(@bar.id).should == nil
1755
- @c.dataset.filter(:name=>'bar').with_pk(nil).should == nil
1789
+ @c.dataset.filter(:i=>0).with_pk(@foo.id).must_equal nil
1790
+ @c.dataset.filter(:i=>10).with_pk(@foo.id).must_equal @foo
1791
+ @c.dataset.filter(:i=>20).with_pk(@bar.id).must_equal @bar
1792
+ @c.dataset.filter(:i=>10).with_pk(nil).must_equal nil
1793
+ @c.dataset.filter(:name=>'foo').with_pk(@foo.id).must_equal @foo
1794
+ @c.dataset.filter(:name=>'bar').with_pk(@bar.id).must_equal @bar
1795
+ @c.dataset.filter(:name=>'baz').with_pk(@bar.id).must_equal nil
1796
+ @c.dataset.filter(:name=>'bar').with_pk(nil).must_equal nil
1756
1797
  end
1757
1798
 
1758
1799
  it "should work with Model#destroy" do
1759
1800
  @foo.destroy
1760
1801
  @bar.destroy
1761
- @c[@foo.id].should == nil
1762
- @c[@bar.id].should == nil
1802
+ @c[@foo.id].must_equal nil
1803
+ @c[@bar.id].must_equal nil
1763
1804
  end
1764
1805
 
1765
1806
  it "should work with Model#update" do
1766
1807
  @foo.update(:name=>'foo2', :i=>30)
1767
- @c[@foo.id].should == @c.load(:id=>@foo.id, :name=>'foo2', :i=>30)
1808
+ @c[@foo.id].must_equal @c.load(:id=>@foo.id, :name=>'foo2', :i=>30)
1768
1809
  @foo.update(:name=>'foo3')
1769
- @c[@foo.id].should == @c.load(:id=>@foo.id, :name=>'foo3', :i=>30)
1810
+ @c[@foo.id].must_equal @c.load(:id=>@foo.id, :name=>'foo3', :i=>30)
1770
1811
  @foo.update(:i=>40)
1771
- @c[@foo.id].should == @c.load(:id=>@foo.id, :name=>'foo3', :i=>40)
1812
+ @c[@foo.id].must_equal @c.load(:id=>@foo.id, :name=>'foo3', :i=>40)
1772
1813
  @foo.update(:i=>nil)
1773
- @c[@foo.id].should == @c.load(:id=>@foo.id, :name=>'foo3', :i=>nil)
1814
+ @c[@foo.id].must_equal @c.load(:id=>@foo.id, :name=>'foo3', :i=>nil)
1774
1815
  end
1775
1816
 
1776
1817
  it "should work with Model#create" do
1777
1818
  o = @c.create(:name=>'foo2', :i=>30)
1778
- @c[o.id].should == @c.load(:id=>o.id, :name=>'foo2', :i=>30)
1819
+ @c[o.id].must_equal @c.load(:id=>o.id, :name=>'foo2', :i=>30)
1779
1820
  o = @c.create(:name=>'foo2')
1780
- @c[o.id].should == @c.load(:id=>o.id, :name=>'foo2', :i=>nil)
1821
+ @c[o.id].must_equal @c.load(:id=>o.id, :name=>'foo2', :i=>nil)
1781
1822
  o = @c.create(:i=>30)
1782
- @c[o.id].should == @c.load(:id=>o.id, :name=>nil, :i=>30)
1823
+ @c[o.id].must_equal @c.load(:id=>o.id, :name=>nil, :i=>30)
1783
1824
  o = @c.create(:name=>nil, :i=>40)
1784
- @c[o.id].should == @c.load(:id=>o.id, :name=>nil, :i=>40)
1825
+ @c[o.id].must_equal @c.load(:id=>o.id, :name=>nil, :i=>40)
1785
1826
  end
1786
1827
  end
1787
1828
 
@@ -1805,26 +1846,26 @@ describe "Sequel::Plugins::PreparedStatements with schema changes" do
1805
1846
 
1806
1847
  it "should handle added columns" do
1807
1848
  foo = @c.create(:name=>'foo')
1808
- @c[foo.id].name.should == 'foo'
1809
- foo.ps_test.name.should == 'foo'
1810
- foo.ps_tests.map{|x| x.name}.should == %w'foo'
1811
- foo.mps_tests.map{|x| x.name}.should == %w'foo'
1849
+ @c[foo.id].name.must_equal 'foo'
1850
+ foo.ps_test.name.must_equal 'foo'
1851
+ foo.ps_tests.map{|x| x.name}.must_equal %w'foo'
1852
+ foo.mps_tests.map{|x| x.name}.must_equal %w'foo'
1812
1853
  foo.update(:name=>'foo2')
1813
- @c[foo.id].name.should == 'foo2'
1854
+ @c[foo.id].name.must_equal 'foo2'
1814
1855
  foo.delete
1815
- foo.exists?.should == false
1856
+ foo.exists?.must_equal false
1816
1857
 
1817
1858
  @db.alter_table(:ps_test){add_column :i, Integer}
1818
1859
 
1819
1860
  foo = @c.create(:name=>'foo')
1820
- @c[foo.id].name.should == 'foo'
1821
- foo.ps_test.name.should == 'foo'
1822
- foo.ps_tests.map{|x| x.name}.should == %w'foo'
1823
- foo.mps_tests.map{|x| x.name}.should == %w'foo'
1861
+ @c[foo.id].name.must_equal 'foo'
1862
+ foo.ps_test.name.must_equal 'foo'
1863
+ foo.ps_tests.map{|x| x.name}.must_equal %w'foo'
1864
+ foo.mps_tests.map{|x| x.name}.must_equal %w'foo'
1824
1865
  foo.update(:name=>'foo2')
1825
- @c[foo.id].name.should == 'foo2'
1866
+ @c[foo.id].name.must_equal 'foo2'
1826
1867
  foo.delete
1827
- foo.exists?.should == false
1868
+ foo.exists?.must_equal false
1828
1869
  end
1829
1870
  end
1830
1871
 
@@ -1850,17 +1891,17 @@ describe "Caching plugins" do
1850
1891
  @db.drop_table?(:albums, :artists)
1851
1892
  end
1852
1893
 
1853
- shared_examples_for "a caching plugin" do
1894
+ CachingPluginSpecs = shared_description do
1854
1895
  it "should work with looking up using Model.[]" do
1855
- @Artist[1].should equal(@Artist[1])
1856
- @Artist[:id=>1].should == @Artist[1]
1857
- @Artist[0].should == nil
1858
- @Artist[nil].should == nil
1896
+ @Artist[1].must_be_same_as(@Artist[1])
1897
+ @Artist[:id=>1].must_equal @Artist[1]
1898
+ @Artist[0].must_equal nil
1899
+ @Artist[nil].must_equal nil
1859
1900
  end
1860
1901
 
1861
1902
  it "should work with lookup up many_to_one associated objects" do
1862
1903
  a = @Artist[1]
1863
- @Album.first.artist.should equal(a)
1904
+ @Album.first.artist.must_be_same_as(a)
1864
1905
  end
1865
1906
  end
1866
1907
 
@@ -1877,7 +1918,7 @@ describe "Caching plugins" do
1877
1918
  @Album.many_to_one :artist, :class=>@Artist
1878
1919
  end
1879
1920
 
1880
- it_should_behave_like "a caching plugin"
1921
+ include CachingPluginSpecs
1881
1922
  end
1882
1923
 
1883
1924
  describe "static_cache plugin" do
@@ -1887,7 +1928,7 @@ describe "Caching plugins" do
1887
1928
  @Album.many_to_one :artist, :class=>@Artist
1888
1929
  end
1889
1930
 
1890
- it_should_behave_like "a caching plugin"
1931
+ include CachingPluginSpecs
1891
1932
  end
1892
1933
  end
1893
1934
 
@@ -1937,12 +1978,12 @@ describe "Sequel::Plugins::ConstraintValidations" do
1937
1978
  @db.drop_constraint_validations_table
1938
1979
  end
1939
1980
 
1940
- shared_examples_for "constraint validations" do
1981
+ ConstraintValidationsSpecs = shared_description do
1941
1982
  cspecify "should set up constraints that work even outside the model", :mysql do
1942
- proc{@ds.insert(@valid_row)}.should_not raise_error
1983
+ @ds.insert(@valid_row)
1943
1984
 
1944
1985
  # Test for unique constraint
1945
- proc{@ds.insert(@valid_row)}.should raise_error(Sequel::DatabaseError)
1986
+ proc{@ds.insert(@valid_row)}.must_raise(Sequel::DatabaseError, Sequel::UniqueConstraintViolation, Sequel::ConstraintViolation)
1946
1987
 
1947
1988
  @ds.delete
1948
1989
  @violations.each do |col, vals|
@@ -1950,24 +1991,25 @@ describe "Sequel::Plugins::ConstraintValidations" do
1950
1991
  vals += ['1234567'] if col == :minlen
1951
1992
  vals.each do |val|
1952
1993
  next if val.nil? && @validation_opts[:allow_nil]
1994
+ next if val == '' && @validation_opts[:allow_nil] && @db.database_type == :oracle
1953
1995
  try[col] = val
1954
- proc{@ds.insert(try)}.should raise_error(Sequel::DatabaseError)
1996
+ proc{@ds.insert(try)}.must_raise(Sequel::DatabaseError, Sequel::CheckConstraintViolation, Sequel::ConstraintViolation)
1955
1997
  end
1956
1998
  end
1957
1999
 
1958
2000
  # Test for dropping of constraint
1959
2001
  @db.alter_table(:cv_test){validate{drop :maxl2}}
1960
- proc{@ds.insert(@valid_row.merge(:minlen=>'1234567'))}.should_not raise_error
2002
+ @ds.insert(@valid_row.merge(:minlen=>'1234567'))
1961
2003
  end
1962
2004
 
1963
2005
  it "should set up automatic validations inside the model" do
1964
2006
  c = Class.new(Sequel::Model(@ds))
1965
2007
  c.plugin :constraint_validations
1966
2008
  c.dataset.delete
1967
- proc{c.create(@valid_row)}.should_not raise_error
2009
+ c.create(@valid_row)
1968
2010
 
1969
2011
  # Test for unique validation
1970
- c.new(@valid_row).should_not be_valid
2012
+ c.new(@valid_row).wont_be :valid?
1971
2013
 
1972
2014
  c.dataset.delete
1973
2015
  @violations.each do |col, vals|
@@ -1975,7 +2017,7 @@ describe "Sequel::Plugins::ConstraintValidations" do
1975
2017
  vals.each do |val|
1976
2018
  next if val.nil? && @validation_opts[:allow_nil]
1977
2019
  try[col] = val
1978
- c.new(try).should_not be_valid
2020
+ c.new(try).wont_be :valid?
1979
2021
  end
1980
2022
  end
1981
2023
  c.db.constraint_validations = nil
@@ -2015,13 +2057,13 @@ describe "Sequel::Plugins::ConstraintValidations" do
2015
2057
  @validation_opts = {:allow_nil=>true}
2016
2058
  @table_block.call
2017
2059
  end
2018
- it_should_behave_like "constraint validations"
2060
+ include ConstraintValidationsSpecs
2019
2061
  end
2020
2062
  describe "with :allow_nil=>false" do
2021
2063
  before(:all) do
2022
2064
  @table_block.call
2023
2065
  end
2024
- it_should_behave_like "constraint validations"
2066
+ include ConstraintValidationsSpecs
2025
2067
  end
2026
2068
  end
2027
2069
 
@@ -2060,16 +2102,16 @@ describe "Sequel::Plugins::ConstraintValidations" do
2060
2102
  @validation_opts = {:allow_nil=>true}
2061
2103
  @table_block.call
2062
2104
  end
2063
- it_should_behave_like "constraint validations"
2105
+ include ConstraintValidationsSpecs
2064
2106
  end
2065
2107
  describe "with :allow_nil=>false" do
2066
2108
  before(:all) do
2067
2109
  @table_block.call
2068
2110
  end
2069
- it_should_behave_like "constraint validations"
2111
+ include ConstraintValidationsSpecs
2070
2112
  end
2071
2113
  end
2072
- end unless DB.database_type == :fdbsql # doesn't handle check constraints
2114
+ end
2073
2115
 
2074
2116
  describe "date_arithmetic extension" do
2075
2117
  asd = begin
@@ -2104,12 +2146,12 @@ describe "date_arithmetic extension" do
2104
2146
  @check = lambda do |meth, in_date, in_interval, should|
2105
2147
  output = @db.get(Sequel.send(meth, in_date, in_interval))
2106
2148
  output = Time.parse(output.to_s) unless output.is_a?(Time) || output.is_a?(DateTime)
2107
- output.year.should == should.year
2108
- output.month.should == should.month
2109
- output.day.should == should.day
2110
- output.hour.should == should.hour
2111
- output.min.should == should.min
2112
- output.sec.should == should.sec
2149
+ output.year.must_equal should.year
2150
+ output.month.must_equal should.month
2151
+ output.day.must_equal should.day
2152
+ output.hour.must_equal should.hour
2153
+ output.min.must_equal should.min
2154
+ output.sec.must_equal should.sec
2113
2155
  end
2114
2156
  end
2115
2157
  after(:all) do
@@ -2119,7 +2161,7 @@ describe "date_arithmetic extension" do
2119
2161
  end
2120
2162
 
2121
2163
  if asd
2122
- specify "be able to use Sequel.date_add to add ActiveSupport::Duration objects to dates and datetimes" do
2164
+ it "be able to use Sequel.date_add to add ActiveSupport::Duration objects to dates and datetimes" do
2123
2165
  @check.call(:date_add, @date, @d0, @dt)
2124
2166
  @check.call(:date_add, @date, @d1, @a1)
2125
2167
  @check.call(:date_add, @date, @d2, @a2)
@@ -2129,7 +2171,7 @@ describe "date_arithmetic extension" do
2129
2171
  @check.call(:date_add, @dt, @d2, @a2)
2130
2172
  end
2131
2173
 
2132
- specify "be able to use Sequel.date_sub to subtract ActiveSupport::Duration objects from dates and datetimes" do
2174
+ it "be able to use Sequel.date_sub to subtract ActiveSupport::Duration objects from dates and datetimes" do
2133
2175
  @check.call(:date_sub, @date, @d0, @dt)
2134
2176
  @check.call(:date_sub, @date, @d1, @s1)
2135
2177
  @check.call(:date_sub, @date, @d2, @s2)
@@ -2140,7 +2182,7 @@ describe "date_arithmetic extension" do
2140
2182
  end
2141
2183
  end
2142
2184
 
2143
- specify "be able to use Sequel.date_add to add interval hashes to dates and datetimes" do
2185
+ it "be able to use Sequel.date_add to add interval hashes to dates and datetimes" do
2144
2186
  @check.call(:date_add, @date, @h0, @dt)
2145
2187
  @check.call(:date_add, @date, @h1, @a1)
2146
2188
  @check.call(:date_add, @date, @h2, @a2)
@@ -2150,7 +2192,7 @@ describe "date_arithmetic extension" do
2150
2192
  @check.call(:date_add, @dt, @h2, @a2)
2151
2193
  end
2152
2194
 
2153
- specify "be able to use Sequel.date_sub to subtract interval hashes from dates and datetimes" do
2195
+ it "be able to use Sequel.date_sub to subtract interval hashes from dates and datetimes" do
2154
2196
  @check.call(:date_sub, @date, @h0, @dt)
2155
2197
  @check.call(:date_sub, @date, @h1, @s1)
2156
2198
  @check.call(:date_sub, @date, @h2, @s2)