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
@@ -14,38 +14,38 @@ describe "Model#before_create && Model#after_create" do
14
14
  DB.reset
15
15
  end
16
16
 
17
- specify "should be called around new record creation" do
17
+ it "should be called around new record creation" do
18
18
  @c.send(:define_method, :before_create){DB << "BLAH before"}
19
19
  @c.create(:x => 2)
20
- DB.sqls.should == ['BLAH before', 'INSERT INTO items (x) VALUES (2)', 'BLAH after', 'SELECT * FROM items WHERE (x = 2) LIMIT 1']
20
+ DB.sqls.must_equal ['BLAH before', 'INSERT INTO items (x) VALUES (2)', 'BLAH after', 'SELECT * FROM items WHERE (x = 2) LIMIT 1']
21
21
  end
22
22
 
23
- specify ".create should cancel the save and raise an error if before_create returns false and raise_on_save_failure is true" do
23
+ it ".create should cancel the save and raise an error if before_create returns false and raise_on_save_failure is true" do
24
24
  @c.send(:define_method, :before_create){false}
25
- proc{@c.create(:x => 2)}.should raise_error(Sequel::HookFailed)
26
- DB.sqls.should == []
27
- proc{@c.load(:id => 2233).save}.should_not raise_error
25
+ proc{@c.create(:x => 2)}.must_raise(Sequel::HookFailed)
26
+ DB.sqls.must_equal []
27
+ @c.load(:id => 2233).save
28
28
  end
29
29
 
30
- specify ".create should cancel the save and raise an error if before_create calls cancel_action and raise_on_save_failure is true" do
30
+ it ".create should cancel the save and raise an error if before_create calls cancel_action and raise_on_save_failure is true" do
31
31
  @c.send(:define_method, :before_create){cancel_action 'not good'}
32
- proc{@c.create(:x => 2)}.should raise_error(Sequel::HookFailed, 'not good')
33
- DB.sqls.should == []
34
- proc{@c.load(:id => 2233).save}.should_not raise_error
32
+ proc{@c.create(:x => 2)}.must_raise(Sequel::HookFailed, 'not good')
33
+ DB.sqls.must_equal []
34
+ @c.load(:id => 2233).save
35
35
  end
36
36
 
37
- specify ".create should cancel the save and return nil if before_create returns false and raise_on_save_failure is false" do
37
+ it ".create should cancel the save and return nil if before_create returns false and raise_on_save_failure is false" do
38
38
  @c.send(:define_method, :before_create){false}
39
39
  @c.raise_on_save_failure = false
40
- @c.create(:x => 2).should == nil
41
- DB.sqls.should == []
40
+ @c.create(:x => 2).must_equal nil
41
+ DB.sqls.must_equal []
42
42
  end
43
43
 
44
- specify ".create should cancel the save and return nil if before_create calls cancel_action and raise_on_save_failure is false" do
44
+ it ".create should cancel the save and return nil if before_create calls cancel_action and raise_on_save_failure is false" do
45
45
  @c.send(:define_method, :before_create){cancel_action}
46
46
  @c.raise_on_save_failure = false
47
- @c.create(:x => 2).should == nil
48
- DB.sqls.should == []
47
+ @c.create(:x => 2).must_equal nil
48
+ DB.sqls.must_equal []
49
49
  end
50
50
  end
51
51
 
@@ -60,44 +60,44 @@ describe "Model#before_update && Model#after_update" do
60
60
  DB.reset
61
61
  end
62
62
 
63
- specify "should be called around record update" do
63
+ it "should be called around record update" do
64
64
  @c.send(:define_method, :before_update){DB << "BLAH before"}
65
65
  m = @c.load(:id => 2233, :x=>123)
66
66
  m.save
67
- DB.sqls.should == ['BLAH before', 'UPDATE items SET x = 123 WHERE (id = 2233)', 'BLAH after']
67
+ DB.sqls.must_equal ['BLAH before', 'UPDATE items SET x = 123 WHERE (id = 2233)', 'BLAH after']
68
68
  end
69
69
 
70
- specify "#save should cancel the save and raise an error if before_update returns false and raise_on_save_failure is true" do
70
+ it "#save should cancel the save and raise an error if before_update returns false and raise_on_save_failure is true" do
71
71
  @c.send(:define_method, :before_update){false}
72
- proc{@c.load(:id => 2233).save}.should raise_error(Sequel::HookFailed)
73
- DB.sqls.should == []
72
+ proc{@c.load(:id => 2233).save}.must_raise(Sequel::HookFailed)
73
+ DB.sqls.must_equal []
74
74
  end
75
75
 
76
- specify "#save should cancel the save and raise an error if before_update calls cancel_action and raise_on_save_failure is true" do
76
+ it "#save should cancel the save and raise an error if before_update calls cancel_action and raise_on_save_failure is true" do
77
77
  @c.send(:define_method, :before_update){cancel_action}
78
- proc{@c.load(:id => 2233).save}.should raise_error(Sequel::HookFailed)
79
- DB.sqls.should == []
78
+ proc{@c.load(:id => 2233).save}.must_raise(Sequel::HookFailed)
79
+ DB.sqls.must_equal []
80
80
  end
81
81
 
82
- specify "#save should cancel the save and raise an error if before_update returns false and raise_on_failure option is true" do
82
+ it "#save should cancel the save and raise an error if before_update returns false and raise_on_failure option is true" do
83
83
  @c.send(:define_method, :before_update){false}
84
84
  @c.raise_on_save_failure = false
85
- proc{@c.load(:id => 2233).save(:raise_on_failure => true)}.should raise_error(Sequel::HookFailed)
86
- DB.sqls.should == []
85
+ proc{@c.load(:id => 2233).save(:raise_on_failure => true)}.must_raise(Sequel::HookFailed)
86
+ DB.sqls.must_equal []
87
87
  end
88
88
 
89
- specify "#save should cancel the save and return nil if before_update returns false and raise_on_save_failure is false" do
89
+ it "#save should cancel the save and return nil if before_update returns false and raise_on_save_failure is false" do
90
90
  @c.send(:define_method, :before_update){false}
91
91
  @c.raise_on_save_failure = false
92
- @c.load(:id => 2233).save.should == nil
93
- DB.sqls.should == []
92
+ @c.load(:id => 2233).save.must_equal nil
93
+ DB.sqls.must_equal []
94
94
  end
95
95
 
96
- specify "#save should cancel the save and return nil if before_update calls cancel_action and raise_on_save_failure is false" do
96
+ it "#save should cancel the save and return nil if before_update calls cancel_action and raise_on_save_failure is false" do
97
97
  @c.send(:define_method, :before_update){cancel_action}
98
98
  @c.raise_on_save_failure = false
99
- @c.load(:id => 2233).save.should == nil
100
- DB.sqls.should == []
99
+ @c.load(:id => 2233).save.must_equal nil
100
+ DB.sqls.must_equal []
101
101
  end
102
102
  end
103
103
 
@@ -112,59 +112,59 @@ describe "Model#before_save && Model#after_save" do
112
112
  DB.reset
113
113
  end
114
114
 
115
- specify "should be called around record update" do
115
+ it "should be called around record update" do
116
116
  @c.send(:define_method, :before_save){DB << "BLAH before"}
117
117
  m = @c.load(:id => 2233, :x=>123)
118
118
  m.save
119
- DB.sqls.should == ['BLAH before', 'UPDATE items SET x = 123 WHERE (id = 2233)', 'BLAH after']
119
+ DB.sqls.must_equal ['BLAH before', 'UPDATE items SET x = 123 WHERE (id = 2233)', 'BLAH after']
120
120
  end
121
121
 
122
- specify "should be called around record creation" do
122
+ it "should be called around record creation" do
123
123
  @c.send(:define_method, :before_save){DB << "BLAH before"}
124
124
  @c.set_primary_key :x
125
125
  @c.unrestrict_primary_key
126
126
  @c.create(:x => 2)
127
- DB.sqls.should == ['BLAH before', 'INSERT INTO items (x) VALUES (2)', 'BLAH after', 'SELECT * FROM items WHERE (x = 2) LIMIT 1']
127
+ DB.sqls.must_equal ['BLAH before', 'INSERT INTO items (x) VALUES (2)', 'BLAH after', 'SELECT * FROM items WHERE (x = 2) LIMIT 1']
128
128
  end
129
129
 
130
- specify "#save should cancel the save and raise an error if before_save returns false and raise_on_save_failure is true" do
130
+ it "#save should cancel the save and raise an error if before_save returns false and raise_on_save_failure is true" do
131
131
  @c.send(:define_method, :before_save){false}
132
- proc{@c.load(:id => 2233).save}.should raise_error(Sequel::HookFailed)
133
- DB.sqls.should == []
132
+ proc{@c.load(:id => 2233).save}.must_raise(Sequel::HookFailed)
133
+ DB.sqls.must_equal []
134
134
  end
135
135
 
136
- specify "#save should cancel the save and raise an error if before_save returns false and raise_on_failure option is true" do
136
+ it "#save should cancel the save and raise an error if before_save returns false and raise_on_failure option is true" do
137
137
  @c.send(:define_method, :before_save){false}
138
138
  @c.raise_on_save_failure = false
139
- proc{@c.load(:id => 2233).save(:raise_on_failure => true)}.should raise_error(Sequel::HookFailed)
140
- DB.sqls.should == []
139
+ proc{@c.load(:id => 2233).save(:raise_on_failure => true)}.must_raise(Sequel::HookFailed)
140
+ DB.sqls.must_equal []
141
141
  end
142
142
 
143
- specify "#save should cancel the save and raise an error if before_save calls cancel_action and raise_on_failure option is true" do
143
+ it "#save should cancel the save and raise an error if before_save calls cancel_action and raise_on_failure option is true" do
144
144
  @c.send(:define_method, :before_save){cancel_action}
145
145
  @c.raise_on_save_failure = false
146
- proc{@c.load(:id => 2233).save(:raise_on_failure => true)}.should raise_error(Sequel::HookFailed)
147
- DB.sqls.should == []
146
+ proc{@c.load(:id => 2233).save(:raise_on_failure => true)}.must_raise(Sequel::HookFailed)
147
+ DB.sqls.must_equal []
148
148
  end
149
149
 
150
- specify "#save should cancel the save and return nil if before_save returns false and raise_on_save_failure is false" do
150
+ it "#save should cancel the save and return nil if before_save returns false and raise_on_save_failure is false" do
151
151
  @c.send(:define_method, :before_save){false}
152
152
  @c.raise_on_save_failure = false
153
- @c.load(:id => 2233).save.should == nil
154
- DB.sqls.should == []
153
+ @c.load(:id => 2233).save.must_equal nil
154
+ DB.sqls.must_equal []
155
155
  end
156
156
 
157
- specify "#save should cancel the save and return nil if before_save calls cancel_action and raise_on_save_failure is false" do
157
+ it "#save should cancel the save and return nil if before_save calls cancel_action and raise_on_save_failure is false" do
158
158
  @c.send(:define_method, :before_save){cancel_action}
159
159
  @c.raise_on_save_failure = false
160
- @c.load(:id => 2233).save.should == nil
161
- DB.sqls.should == []
160
+ @c.load(:id => 2233).save.must_equal nil
161
+ DB.sqls.must_equal []
162
162
  end
163
163
 
164
- specify "#save should have a raised exception reference the model instance" do
164
+ it "#save should have a raised exception reference the model instance" do
165
165
  @c.send(:define_method, :before_save){false}
166
- proc{@c.create(:x => 2233)}.should raise_error(Sequel::HookFailed){|e| e.model.should == @c.load(:x=>2233)}
167
- DB.sqls.should == []
166
+ proc{@c.create(:x => 2233)}.must_raise(Sequel::HookFailed){|e| e.model.must_equal @c.load(:x=>2233)}
167
+ DB.sqls.must_equal []
168
168
  end
169
169
  end
170
170
 
@@ -178,44 +178,44 @@ describe "Model#before_destroy && Model#after_destroy" do
178
178
  DB.reset
179
179
  end
180
180
 
181
- specify "should be called around record destruction" do
181
+ it "should be called around record destruction" do
182
182
  @c.send(:define_method, :before_destroy){DB << "BLAH before"}
183
183
  m = @c.load(:id => 2233)
184
184
  m.destroy
185
- DB.sqls.should == ['BLAH before', 'DELETE FROM items WHERE id = 2233', 'BLAH after']
185
+ DB.sqls.must_equal ['BLAH before', 'DELETE FROM items WHERE id = 2233', 'BLAH after']
186
186
  end
187
187
 
188
- specify "#destroy should cancel the destroy and raise an error if before_destroy returns false and raise_on_save_failure is true" do
188
+ it "#destroy should cancel the destroy and raise an error if before_destroy returns false and raise_on_save_failure is true" do
189
189
  @c.send(:define_method, :before_destroy){false}
190
- proc{@c.load(:id => 2233).destroy}.should raise_error(Sequel::HookFailed)
191
- DB.sqls.should == []
190
+ proc{@c.load(:id => 2233).destroy}.must_raise(Sequel::HookFailed)
191
+ DB.sqls.must_equal []
192
192
  end
193
193
 
194
- specify "#destroy should cancel the destroy and raise an error if before_destroy calls cancel_action and raise_on_save_failure is true" do
194
+ it "#destroy should cancel the destroy and raise an error if before_destroy calls cancel_action and raise_on_save_failure is true" do
195
195
  @c.send(:define_method, :before_destroy){cancel_action; true}
196
- proc{@c.load(:id => 2233).destroy}.should raise_error(Sequel::HookFailed)
197
- DB.sqls.should == []
196
+ proc{@c.load(:id => 2233).destroy}.must_raise(Sequel::HookFailed)
197
+ DB.sqls.must_equal []
198
198
  end
199
199
 
200
- specify "#destroy should cancel the destroy and raise an error if before_destroy returns false and raise_on_failure option is true" do
200
+ it "#destroy should cancel the destroy and raise an error if before_destroy returns false and raise_on_failure option is true" do
201
201
  @c.send(:define_method, :before_destroy){false}
202
202
  @c.raise_on_save_failure = false
203
- proc{@c.load(:id => 2233).destroy(:raise_on_failure => true)}.should raise_error(Sequel::HookFailed)
204
- DB.sqls.should == []
203
+ proc{@c.load(:id => 2233).destroy(:raise_on_failure => true)}.must_raise(Sequel::HookFailed)
204
+ DB.sqls.must_equal []
205
205
  end
206
206
 
207
- specify "#destroy should cancel the destroy and return nil if before_destroy returns false and raise_on_save_failure is false" do
207
+ it "#destroy should cancel the destroy and return nil if before_destroy returns false and raise_on_save_failure is false" do
208
208
  @c.send(:define_method, :before_destroy){false}
209
209
  @c.raise_on_save_failure = false
210
- @c.load(:id => 2233).destroy.should == nil
211
- DB.sqls.should == []
210
+ @c.load(:id => 2233).destroy.must_equal nil
211
+ DB.sqls.must_equal []
212
212
  end
213
213
 
214
- specify "#destroy should cancel the destroy and return nil if before_destroy calls cancel_action and raise_on_save_failure is false" do
214
+ it "#destroy should cancel the destroy and return nil if before_destroy calls cancel_action and raise_on_save_failure is false" do
215
215
  @c.send(:define_method, :before_destroy){cancel_action; true}
216
216
  @c.raise_on_save_failure = false
217
- @c.load(:id => 2233).destroy.should == nil
218
- DB.sqls.should == []
217
+ @c.load(:id => 2233).destroy.must_equal nil
218
+ DB.sqls.must_equal []
219
219
  end
220
220
  end
221
221
 
@@ -231,67 +231,68 @@ describe "Model#before_validation && Model#after_validation" do
231
231
  errors.add(:id, 'not valid') unless id == 2233
232
232
  end
233
233
  end
234
+ DB.reset
234
235
  end
235
236
 
236
- specify "should be called around validation" do
237
+ it "should be called around validation" do
237
238
  @c.send(:define_method, :before_validation){DB << "BLAH before"}
238
239
  m = @c.load(:id => 2233)
239
- m.should be_valid
240
- DB.sqls.should == ['BLAH before', 'BLAH after']
240
+ m.must_be :valid?
241
+ DB.sqls.must_equal ['BLAH before', 'BLAH after']
241
242
 
242
243
  m = @c.load(:id => 22)
243
- m.should_not be_valid
244
- DB.sqls.should == ['BLAH before', 'BLAH after']
244
+ m.wont_be :valid?
245
+ DB.sqls.must_equal ['BLAH before', 'BLAH after']
245
246
  end
246
247
 
247
- specify "should be called when calling save" do
248
+ it "should be called when calling save" do
248
249
  @c.send(:define_method, :before_validation){DB << "BLAH before"}
249
250
  m = @c.load(:id => 2233, :x=>123)
250
- m.save.should == m
251
- DB.sqls.should == ['BLAH before', 'BLAH after', 'UPDATE items SET x = 123 WHERE (id = 2233)']
251
+ m.save.must_equal m
252
+ DB.sqls.must_equal ['BLAH before', 'BLAH after', 'UPDATE items SET x = 123 WHERE (id = 2233)']
252
253
 
253
254
  m = @c.load(:id => 22)
254
255
  m.raise_on_save_failure = false
255
- m.save.should == nil
256
- DB.sqls.should == ['BLAH before', 'BLAH after']
256
+ m.save.must_equal nil
257
+ DB.sqls.must_equal ['BLAH before', 'BLAH after']
257
258
  end
258
259
 
259
- specify "#save should cancel the save and raise an error if before_validation returns false and raise_on_save_failure is true" do
260
+ it "#save should cancel the save and raise an error if before_validation returns false and raise_on_save_failure is true" do
260
261
  @c.send(:define_method, :before_validation){false}
261
- proc{@c.load(:id => 2233).save}.should raise_error(Sequel::HookFailed)
262
- DB.sqls.should == []
262
+ proc{@c.load(:id => 2233).save}.must_raise(Sequel::HookFailed)
263
+ DB.sqls.must_equal []
263
264
  end
264
265
 
265
- specify "#save should cancel the save and raise an error if before_validation returns false and raise_on_failure option is true" do
266
+ it "#save should cancel the save and raise an error if before_validation returns false and raise_on_failure option is true" do
266
267
  @c.send(:define_method, :before_validation){false}
267
268
  @c.raise_on_save_failure = false
268
- proc{@c.load(:id => 2233).save(:raise_on_failure => true)}.should raise_error(Sequel::HookFailed)
269
- DB.sqls.should == []
269
+ proc{@c.load(:id => 2233).save(:raise_on_failure => true)}.must_raise(Sequel::HookFailed)
270
+ DB.sqls.must_equal []
270
271
  end
271
272
 
272
- specify "#save should cancel the save and raise an error if before_validation calls cancel_action and raise_on_save_failure is true" do
273
+ it "#save should cancel the save and raise an error if before_validation calls cancel_action and raise_on_save_failure is true" do
273
274
  @c.send(:define_method, :before_validation){cancel_action}
274
- proc{@c.load(:id => 2233).save}.should raise_error(Sequel::HookFailed)
275
- DB.sqls.should == []
275
+ proc{@c.load(:id => 2233).save}.must_raise(Sequel::HookFailed)
276
+ DB.sqls.must_equal []
276
277
  end
277
278
 
278
- specify "#save should cancel the save and return nil if before_validation returns false and raise_on_save_failure is false" do
279
+ it "#save should cancel the save and return nil if before_validation returns false and raise_on_save_failure is false" do
279
280
  @c.send(:define_method, :before_validation){false}
280
281
  @c.raise_on_save_failure = false
281
- @c.load(:id => 2233).save.should == nil
282
- DB.sqls.should == []
282
+ @c.load(:id => 2233).save.must_equal nil
283
+ DB.sqls.must_equal []
283
284
  end
284
285
 
285
- specify "#save should cancel the save and return nil if before_validation calls cancel_action and raise_on_save_failure is false" do
286
+ it "#save should cancel the save and return nil if before_validation calls cancel_action and raise_on_save_failure is false" do
286
287
  @c.send(:define_method, :before_validation){cancel_action}
287
288
  @c.raise_on_save_failure = false
288
- @c.load(:id => 2233).save.should == nil
289
- DB.sqls.should == []
289
+ @c.load(:id => 2233).save.must_equal nil
290
+ DB.sqls.must_equal []
290
291
  end
291
292
 
292
- specify "#valid? should return false if before_validation returns false" do
293
+ it "#valid? should return false if before_validation returns false" do
293
294
  @c.send(:define_method, :before_validation){false}
294
- @c.load(:id => 2233).valid?.should == false
295
+ @c.load(:id => 2233).valid?.must_equal false
295
296
  end
296
297
  end
297
298
 
@@ -303,7 +304,7 @@ describe "Model around filters" do
303
304
  DB.reset
304
305
  end
305
306
 
306
- specify "around_create should be called around new record creation" do
307
+ it "around_create should be called around new record creation" do
307
308
  @c.class_eval do
308
309
  def around_create
309
310
  DB << 'ac_before'
@@ -312,10 +313,10 @@ describe "Model around filters" do
312
313
  end
313
314
  end
314
315
  @c.create(:x => 2)
315
- DB.sqls.should == ['ac_before', 'INSERT INTO items (x) VALUES (2)', 'ac_after', "SELECT * FROM items WHERE (id = 10) LIMIT 1"]
316
+ DB.sqls.must_equal ['ac_before', 'INSERT INTO items (x) VALUES (2)', 'ac_after', "SELECT * FROM items WHERE (id = 10) LIMIT 1"]
316
317
  end
317
318
 
318
- specify "around_delete should be called around record destruction" do
319
+ it "around_delete should be called around record destruction" do
319
320
  @c.class_eval do
320
321
  def around_destroy
321
322
  DB << 'ad_before'
@@ -324,10 +325,10 @@ describe "Model around filters" do
324
325
  end
325
326
  end
326
327
  @c.load(:id=>1, :x => 2).destroy
327
- DB.sqls.should == ['ad_before', 'DELETE FROM items WHERE id = 1', 'ad_after']
328
+ DB.sqls.must_equal ['ad_before', 'DELETE FROM items WHERE id = 1', 'ad_after']
328
329
  end
329
330
 
330
- specify "around_update should be called around updating existing records" do
331
+ it "around_update should be called around updating existing records" do
331
332
  @c.class_eval do
332
333
  def around_update
333
334
  DB << 'au_before'
@@ -336,10 +337,10 @@ describe "Model around filters" do
336
337
  end
337
338
  end
338
339
  @c.load(:id=>1, :x => 2).save
339
- DB.sqls.should == ['au_before', 'UPDATE items SET x = 2 WHERE (id = 1)', 'au_after']
340
+ DB.sqls.must_equal ['au_before', 'UPDATE items SET x = 2 WHERE (id = 1)', 'au_after']
340
341
  end
341
342
 
342
- specify "around_save should be called around saving both new and existing records, around either after_create and after_update" do
343
+ it "around_save should be called around saving both new and existing records, around either after_create and after_update" do
343
344
  @c.class_eval do
344
345
  def around_update
345
346
  DB << 'au_before'
@@ -358,12 +359,12 @@ describe "Model around filters" do
358
359
  end
359
360
  end
360
361
  @c.create(:x => 2)
361
- DB.sqls.should == ['as_before', 'ac_before', 'INSERT INTO items (x) VALUES (2)', 'ac_after', 'as_after', "SELECT * FROM items WHERE (id = 10) LIMIT 1"]
362
+ DB.sqls.must_equal ['as_before', 'ac_before', 'INSERT INTO items (x) VALUES (2)', 'ac_after', 'as_after', "SELECT * FROM items WHERE (id = 10) LIMIT 1"]
362
363
  @c.load(:id=>1, :x => 2).save
363
- DB.sqls.should == ['as_before', 'au_before', 'UPDATE items SET x = 2 WHERE (id = 1)', 'au_after', 'as_after']
364
+ DB.sqls.must_equal ['as_before', 'au_before', 'UPDATE items SET x = 2 WHERE (id = 1)', 'au_after', 'as_after']
364
365
  end
365
366
 
366
- specify "around_validation should be called around validating records" do
367
+ it "around_validation should be called around validating records" do
367
368
  @c.class_eval do
368
369
  def around_validation
369
370
  DB << 'av_before'
@@ -374,75 +375,75 @@ describe "Model around filters" do
374
375
  DB << 'validate'
375
376
  end
376
377
  end
377
- @c.new(:x => 2).valid?.should == true
378
- DB.sqls.should == [ 'av_before', 'validate', 'av_after' ]
378
+ @c.new(:x => 2).valid?.must_equal true
379
+ DB.sqls.must_equal [ 'av_before', 'validate', 'av_after' ]
379
380
  end
380
381
 
381
- specify "around_validation should be able to catch validation errors and modify them" do
382
+ it "around_validation should be able to catch validation errors and modify them" do
382
383
  @c.class_eval do
383
384
  def validate
384
385
  errors.add(:x, 'foo')
385
386
  end
386
387
  end
387
- @c.new(:x => 2).valid?.should == false
388
+ @c.new(:x => 2).valid?.must_equal false
388
389
  @c.class_eval do
389
390
  def around_validation
390
391
  super
391
392
  errors.clear
392
393
  end
393
394
  end
394
- @c.new(:x => 2).valid?.should == true
395
+ @c.new(:x => 2).valid?.must_equal true
395
396
  end
396
397
 
397
- specify "around_create that doesn't call super should raise a HookFailed" do
398
+ it "around_create that doesn't call super should raise a HookFailed" do
398
399
  @c.send(:define_method, :around_create){}
399
- proc{@c.create(:x => 2)}.should raise_error(Sequel::HookFailed)
400
+ proc{@c.create(:x => 2)}.must_raise(Sequel::HookFailed)
400
401
  end
401
402
 
402
- specify "around_update that doesn't call super should raise a HookFailed" do
403
+ it "around_update that doesn't call super should raise a HookFailed" do
403
404
  @c.send(:define_method, :around_update){}
404
- proc{@c.load(:x => 2).save}.should raise_error(Sequel::HookFailed)
405
+ proc{@c.load(:x => 2).save}.must_raise(Sequel::HookFailed)
405
406
  end
406
407
 
407
- specify "around_save that doesn't call super should raise a HookFailed" do
408
+ it "around_save that doesn't call super should raise a HookFailed" do
408
409
  @c.send(:define_method, :around_save){}
409
- proc{@c.create(:x => 2)}.should raise_error(Sequel::HookFailed)
410
- proc{@c.load(:x => 2).save}.should raise_error(Sequel::HookFailed)
410
+ proc{@c.create(:x => 2)}.must_raise(Sequel::HookFailed)
411
+ proc{@c.load(:x => 2).save}.must_raise(Sequel::HookFailed)
411
412
  end
412
413
 
413
- specify "around_destroy that doesn't call super should raise a HookFailed" do
414
+ it "around_destroy that doesn't call super should raise a HookFailed" do
414
415
  @c.send(:define_method, :around_destroy){}
415
- proc{@c.load(:x => 2).destroy}.should raise_error(Sequel::HookFailed)
416
+ proc{@c.load(:x => 2).destroy}.must_raise(Sequel::HookFailed)
416
417
  end
417
418
 
418
- specify "around_validation that doesn't call super should raise a HookFailed" do
419
+ it "around_validation that doesn't call super should raise a HookFailed" do
419
420
  @c.send(:define_method, :around_validation){}
420
- proc{@c.new.save}.should raise_error(Sequel::HookFailed)
421
+ proc{@c.new.save}.must_raise(Sequel::HookFailed)
421
422
  end
422
423
 
423
- specify "around_validation that doesn't call super should have valid? return false" do
424
+ it "around_validation that doesn't call super should have valid? return false" do
424
425
  @c.send(:define_method, :around_validation){}
425
- @c.new.valid?.should == false
426
+ @c.new.valid?.must_equal false
426
427
  end
427
428
 
428
- specify "around_* that doesn't call super should return nil if raise_on_save_failure is false" do
429
+ it "around_* that doesn't call super should return nil if raise_on_save_failure is false" do
429
430
  @c.raise_on_save_failure = false
430
431
 
431
432
  o = @c.load(:id => 1)
432
433
  def o.around_save() end
433
- o.save.should == nil
434
+ o.save.must_equal nil
434
435
 
435
436
  o = @c.load(:id => 1)
436
437
  def o.around_update() end
437
- o.save.should == nil
438
+ o.save.must_equal nil
438
439
 
439
440
  o = @c.new
440
441
  def o.around_create() end
441
- o.save.should == nil
442
+ o.save.must_equal nil
442
443
 
443
444
  o = @c.new
444
445
  def o.around_validation() end
445
- o.save.should == nil
446
+ o.save.must_equal nil
446
447
  end
447
448
  end
448
449
 
@@ -479,125 +480,125 @@ describe "Model#after_commit and #after_rollback" do
479
480
  @db.sqls
480
481
  end
481
482
 
482
- specify "should call after_commit for save after the transaction commits if it commits" do
483
+ it "should call after_commit for save after the transaction commits if it commits" do
483
484
  @o.save
484
- @db.sqls.should == ['BEGIN', 'as', 'COMMIT', 'ac']
485
+ @db.sqls.must_equal ['BEGIN', 'as', 'COMMIT', 'ac']
485
486
  end
486
487
 
487
- specify "should call after_rollback for save after the transaction rolls back if it rolls back" do
488
+ it "should call after_rollback for save after the transaction rolls back if it rolls back" do
488
489
  @o.rb = true
489
490
  @o.save
490
- @db.sqls.should == ['BEGIN', 'as', 'ROLLBACK', 'ar']
491
+ @db.sqls.must_equal ['BEGIN', 'as', 'ROLLBACK', 'ar']
491
492
  end
492
493
 
493
- specify "should have after_commit respect any surrounding transactions" do
494
+ it "should have after_commit respect any surrounding transactions" do
494
495
  @db.transaction do
495
496
  @o.save
496
497
  end
497
- @db.sqls.should == ['BEGIN', 'as', 'COMMIT', 'ac']
498
+ @db.sqls.must_equal ['BEGIN', 'as', 'COMMIT', 'ac']
498
499
  end
499
500
 
500
- specify "should have after_rollback respect any surrounding transactions" do
501
+ it "should have after_rollback respect any surrounding transactions" do
501
502
  @db.transaction do
502
503
  @o.rb = true
503
504
  @o.save
504
505
  end
505
- @db.sqls.should == ['BEGIN', 'as', 'ROLLBACK', 'ar']
506
+ @db.sqls.must_equal ['BEGIN', 'as', 'ROLLBACK', 'ar']
506
507
  end
507
508
 
508
- specify "should have after_commit work with surrounding transactions and sharding" do
509
+ it "should have after_commit work with surrounding transactions and sharding" do
509
510
  @db.transaction(:server=>:test) do
510
511
  @o.save
511
512
  end
512
- @db.sqls.should == ['BEGIN -- test', 'BEGIN', 'as', 'COMMIT', 'ac', 'COMMIT -- test']
513
+ @db.sqls.must_equal ['BEGIN -- test', 'BEGIN', 'as', 'COMMIT', 'ac', 'COMMIT -- test']
513
514
  end
514
515
 
515
- specify "should have after_rollback work with surrounding transactions and sharding" do
516
+ it "should have after_rollback work with surrounding transactions and sharding" do
516
517
  @db.transaction(:server=>:test) do
517
518
  @o.rb = true
518
519
  @o.save
519
520
  end
520
- @db.sqls.should == ['BEGIN -- test', 'BEGIN', 'as', 'ROLLBACK', 'ar', 'COMMIT -- test']
521
+ @db.sqls.must_equal ['BEGIN -- test', 'BEGIN', 'as', 'ROLLBACK', 'ar', 'COMMIT -- test']
521
522
  end
522
523
 
523
- specify "should call after_destroy_commit for destroy after the transaction commits if it commits" do
524
+ it "should call after_destroy_commit for destroy after the transaction commits if it commits" do
524
525
  @o.destroy
525
- @db.sqls.should == ['BEGIN', 'ad', 'COMMIT', 'adc']
526
+ @db.sqls.must_equal ['BEGIN', 'ad', 'COMMIT', 'adc']
526
527
  end
527
528
 
528
- specify "should call after_destroy_rollback for destroy after the transaction rolls back if it rolls back" do
529
+ it "should call after_destroy_rollback for destroy after the transaction rolls back if it rolls back" do
529
530
  @o.rb = true
530
531
  @o.destroy
531
- @db.sqls.should == ['BEGIN', 'ad', 'ROLLBACK', 'adr']
532
+ @db.sqls.must_equal ['BEGIN', 'ad', 'ROLLBACK', 'adr']
532
533
  end
533
534
 
534
- specify "should have after_destroy_commit respect any surrounding transactions" do
535
+ it "should have after_destroy_commit respect any surrounding transactions" do
535
536
  @db.transaction do
536
537
  @o.destroy
537
538
  end
538
- @db.sqls.should == ['BEGIN', 'ad', 'COMMIT', 'adc']
539
+ @db.sqls.must_equal ['BEGIN', 'ad', 'COMMIT', 'adc']
539
540
  end
540
541
 
541
- specify "should have after_destroy_rollback respect any surrounding transactions" do
542
+ it "should have after_destroy_rollback respect any surrounding transactions" do
542
543
  @db.transaction do
543
544
  @o.rb = true
544
545
  @o.destroy
545
546
  end
546
- @db.sqls.should == ['BEGIN', 'ad', 'ROLLBACK', 'adr']
547
+ @db.sqls.must_equal ['BEGIN', 'ad', 'ROLLBACK', 'adr']
547
548
  end
548
549
 
549
- specify "should have after_destroy commit work with surrounding transactions and sharding" do
550
+ it "should have after_destroy commit work with surrounding transactions and sharding" do
550
551
  @db.transaction(:server=>:test) do
551
552
  @o.destroy
552
553
  end
553
- @db.sqls.should == ['BEGIN -- test', 'BEGIN', 'ad', 'COMMIT', 'adc', 'COMMIT -- test']
554
+ @db.sqls.must_equal ['BEGIN -- test', 'BEGIN', 'ad', 'COMMIT', 'adc', 'COMMIT -- test']
554
555
  end
555
556
 
556
- specify "should have after_destroy_rollback work with surrounding transactions and sharding" do
557
+ it "should have after_destroy_rollback work with surrounding transactions and sharding" do
557
558
  @db.transaction(:server=>:test) do
558
559
  @o.rb = true
559
560
  @o.destroy
560
561
  end
561
- @db.sqls.should == ['BEGIN -- test', 'BEGIN', 'ad', 'ROLLBACK', 'adr', 'COMMIT -- test']
562
+ @db.sqls.must_equal ['BEGIN -- test', 'BEGIN', 'ad', 'ROLLBACK', 'adr', 'COMMIT -- test']
562
563
  end
563
564
 
564
- specify "should not call after_commit if use_after_commit_rollback is false" do
565
+ it "should not call after_commit if use_after_commit_rollback is false" do
565
566
  @o.use_after_commit_rollback = false
566
567
  @o.save
567
- @db.sqls.should == ['BEGIN', 'as', 'COMMIT']
568
+ @db.sqls.must_equal ['BEGIN', 'as', 'COMMIT']
568
569
  end
569
570
 
570
- specify "should not call after_rollback if use_after_commit_rollback is false" do
571
+ it "should not call after_rollback if use_after_commit_rollback is false" do
571
572
  @o.use_after_commit_rollback = false
572
573
  @o.rb = true
573
574
  @o.save
574
- @db.sqls.should == ['BEGIN', 'as', 'ROLLBACK']
575
+ @db.sqls.must_equal ['BEGIN', 'as', 'ROLLBACK']
575
576
  end
576
577
 
577
- specify "should not call after_destroy_commit if use_after_commit_rollback is false" do
578
+ it "should not call after_destroy_commit if use_after_commit_rollback is false" do
578
579
  @o.use_after_commit_rollback = false
579
580
  @o.destroy
580
- @db.sqls.should == ['BEGIN', 'ad', 'COMMIT']
581
+ @db.sqls.must_equal ['BEGIN', 'ad', 'COMMIT']
581
582
  end
582
583
 
583
- specify "should not call after_destroy_rollback for save if use_after_commit_rollback is false" do
584
+ it "should not call after_destroy_rollback for save if use_after_commit_rollback is false" do
584
585
  @o.use_after_commit_rollback = false
585
586
  @o.rb = true
586
587
  @o.destroy
587
- @db.sqls.should == ['BEGIN', 'ad', 'ROLLBACK']
588
+ @db.sqls.must_equal ['BEGIN', 'ad', 'ROLLBACK']
588
589
  end
589
590
 
590
- specify "should handle use_after_commit_rollback at the class level" do
591
+ it "should handle use_after_commit_rollback at the class level" do
591
592
  @m.use_after_commit_rollback = false
592
593
  @o.save
593
- @db.sqls.should == ['BEGIN', 'as', 'COMMIT']
594
+ @db.sqls.must_equal ['BEGIN', 'as', 'COMMIT']
594
595
  end
595
596
 
596
- specify "should handle use_after_commit_rollback when subclassing" do
597
+ it "should handle use_after_commit_rollback when subclassing" do
597
598
  @m.use_after_commit_rollback = false
598
599
  o = Class.new(@m).load({})
599
600
  @db.sqls
600
601
  o.save
601
- @db.sqls.should == ['BEGIN', 'as', 'COMMIT']
602
+ @db.sqls.must_equal ['BEGIN', 'as', 'COMMIT']
602
603
  end
603
604
  end