sequel 4.22.0 → 4.23.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (214) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGELOG +22 -0
  3. data/README.rdoc +6 -0
  4. data/Rakefile +59 -81
  5. data/doc/migration.rdoc +2 -0
  6. data/doc/release_notes/4.23.0.txt +65 -0
  7. data/doc/sharding.rdoc +16 -14
  8. data/doc/testing.rdoc +61 -77
  9. data/lib/sequel/adapters/jdbc.rb +1 -0
  10. data/lib/sequel/adapters/mock.rb +0 -1
  11. data/lib/sequel/adapters/postgres.rb +1 -0
  12. data/lib/sequel/adapters/postgresql.rb +1 -0
  13. data/lib/sequel/adapters/shared/postgres.rb +3 -3
  14. data/lib/sequel/connection_pool/sharded_threaded.rb +5 -0
  15. data/lib/sequel/connection_pool/threaded.rb +9 -1
  16. data/lib/sequel/database/connecting.rb +1 -1
  17. data/lib/sequel/database/transactions.rb +2 -1
  18. data/lib/sequel/dataset/prepared_statements.rb +1 -1
  19. data/lib/sequel/extensions/constraint_validations.rb +12 -12
  20. data/lib/sequel/extensions/date_arithmetic.rb +0 -4
  21. data/lib/sequel/extensions/pagination.rb +14 -2
  22. data/lib/sequel/extensions/pg_enum.rb +2 -2
  23. data/lib/sequel/extensions/pg_hstore.rb +1 -1
  24. data/lib/sequel/extensions/pg_json_ops.rb +2 -2
  25. data/lib/sequel/plugins/csv_serializer.rb +2 -0
  26. data/lib/sequel/plugins/delay_add_association.rb +50 -0
  27. data/lib/sequel/plugins/list.rb +2 -2
  28. data/lib/sequel/plugins/nested_attributes.rb +8 -28
  29. data/lib/sequel/plugins/update_refresh.rb +50 -0
  30. data/lib/sequel/plugins/validate_associated.rb +55 -0
  31. data/lib/sequel/version.rb +1 -1
  32. data/spec/adapters/db2_spec.rb +29 -29
  33. data/spec/adapters/firebird_spec.rb +97 -103
  34. data/spec/adapters/informix_spec.rb +25 -25
  35. data/spec/adapters/mssql_spec.rb +156 -172
  36. data/spec/adapters/mysql_spec.rb +334 -359
  37. data/spec/adapters/oracle_spec.rb +67 -69
  38. data/spec/adapters/postgres_spec.rb +1298 -1249
  39. data/spec/adapters/spec_helper.rb +2 -35
  40. data/spec/adapters/sqlanywhere_spec.rb +39 -39
  41. data/spec/adapters/sqlite_spec.rb +203 -200
  42. data/spec/bin_spec.rb +57 -59
  43. data/spec/core/connection_pool_spec.rb +402 -401
  44. data/spec/core/database_spec.rb +953 -944
  45. data/spec/core/dataset_spec.rb +2178 -2168
  46. data/spec/core/deprecated_spec.rb +19 -19
  47. data/spec/core/expression_filters_spec.rb +415 -415
  48. data/spec/core/mock_adapter_spec.rb +212 -212
  49. data/spec/core/object_graph_spec.rb +73 -73
  50. data/spec/core/placeholder_literalizer_spec.rb +71 -71
  51. data/spec/core/schema_generator_spec.rb +44 -44
  52. data/spec/core/schema_spec.rb +470 -472
  53. data/spec/core/spec_helper.rb +5 -20
  54. data/spec/core/version_spec.rb +2 -2
  55. data/spec/core_extensions_spec.rb +320 -320
  56. data/spec/extensions/accessed_columns_spec.rb +12 -12
  57. data/spec/extensions/active_model_spec.rb +3 -3
  58. data/spec/extensions/after_initialize_spec.rb +2 -2
  59. data/spec/extensions/arbitrary_servers_spec.rb +23 -23
  60. data/spec/extensions/association_dependencies_spec.rb +34 -34
  61. data/spec/extensions/association_pks_spec.rb +98 -98
  62. data/spec/extensions/association_proxies_spec.rb +33 -33
  63. data/spec/extensions/auto_validations_spec.rb +46 -46
  64. data/spec/extensions/blacklist_security_spec.rb +19 -18
  65. data/spec/extensions/blank_spec.rb +36 -36
  66. data/spec/extensions/boolean_readers_spec.rb +36 -36
  67. data/spec/extensions/caching_spec.rb +82 -82
  68. data/spec/extensions/class_table_inheritance_spec.rb +72 -72
  69. data/spec/extensions/column_conflicts_spec.rb +19 -14
  70. data/spec/extensions/column_select_spec.rb +19 -19
  71. data/spec/extensions/columns_introspection_spec.rb +43 -43
  72. data/spec/extensions/composition_spec.rb +64 -64
  73. data/spec/extensions/connection_validator_spec.rb +92 -90
  74. data/spec/extensions/constraint_validations_plugin_spec.rb +92 -92
  75. data/spec/extensions/constraint_validations_spec.rb +80 -80
  76. data/spec/extensions/core_refinements_spec.rb +220 -220
  77. data/spec/extensions/csv_serializer_spec.rb +44 -44
  78. data/spec/extensions/current_datetime_timestamp_spec.rb +8 -8
  79. data/spec/extensions/dataset_associations_spec.rb +65 -65
  80. data/spec/extensions/dataset_source_alias_spec.rb +16 -16
  81. data/spec/extensions/date_arithmetic_spec.rb +51 -58
  82. data/spec/extensions/defaults_setter_spec.rb +19 -19
  83. data/spec/extensions/delay_add_association_spec.rb +52 -0
  84. data/spec/extensions/dirty_spec.rb +51 -51
  85. data/spec/extensions/eager_each_spec.rb +8 -8
  86. data/spec/extensions/empty_array_ignore_nulls_spec.rb +10 -10
  87. data/spec/extensions/error_splitter_spec.rb +2 -2
  88. data/spec/extensions/error_sql_spec.rb +4 -4
  89. data/spec/extensions/eval_inspect_spec.rb +3 -3
  90. data/spec/extensions/filter_having_spec.rb +8 -8
  91. data/spec/extensions/force_encoding_spec.rb +30 -30
  92. data/spec/extensions/from_block_spec.rb +7 -7
  93. data/spec/extensions/graph_each_spec.rb +19 -19
  94. data/spec/extensions/hash_aliases_spec.rb +5 -5
  95. data/spec/extensions/hook_class_methods_spec.rb +100 -100
  96. data/spec/extensions/inflector_spec.rb +54 -54
  97. data/spec/extensions/input_transformer_spec.rb +10 -10
  98. data/spec/extensions/insert_returning_select_spec.rb +8 -8
  99. data/spec/extensions/instance_filters_spec.rb +26 -26
  100. data/spec/extensions/instance_hooks_spec.rb +85 -85
  101. data/spec/extensions/json_serializer_spec.rb +68 -68
  102. data/spec/extensions/lazy_attributes_spec.rb +49 -49
  103. data/spec/extensions/list_spec.rb +77 -75
  104. data/spec/extensions/looser_typecasting_spec.rb +16 -16
  105. data/spec/extensions/many_through_many_spec.rb +627 -627
  106. data/spec/extensions/meta_def_spec.rb +7 -7
  107. data/spec/extensions/migration_spec.rb +217 -217
  108. data/spec/extensions/modification_detection_spec.rb +20 -20
  109. data/spec/extensions/mssql_optimistic_locking_spec.rb +21 -21
  110. data/spec/extensions/named_timezones_spec.rb +18 -18
  111. data/spec/extensions/nested_attributes_spec.rb +107 -107
  112. data/spec/extensions/null_dataset_spec.rb +24 -24
  113. data/spec/extensions/optimistic_locking_spec.rb +21 -21
  114. data/spec/extensions/pagination_spec.rb +52 -52
  115. data/spec/extensions/pg_array_associations_spec.rb +273 -273
  116. data/spec/extensions/pg_array_ops_spec.rb +52 -52
  117. data/spec/extensions/pg_array_spec.rb +152 -152
  118. data/spec/extensions/pg_enum_spec.rb +13 -13
  119. data/spec/extensions/pg_hstore_ops_spec.rb +63 -63
  120. data/spec/extensions/pg_hstore_spec.rb +84 -84
  121. data/spec/extensions/pg_inet_spec.rb +15 -15
  122. data/spec/extensions/pg_interval_spec.rb +29 -29
  123. data/spec/extensions/pg_json_ops_spec.rb +86 -84
  124. data/spec/extensions/pg_json_spec.rb +104 -104
  125. data/spec/extensions/pg_loose_count_spec.rb +6 -6
  126. data/spec/extensions/pg_range_ops_spec.rb +24 -24
  127. data/spec/extensions/pg_range_spec.rb +143 -143
  128. data/spec/extensions/pg_row_ops_spec.rb +14 -14
  129. data/spec/extensions/pg_row_plugin_spec.rb +12 -12
  130. data/spec/extensions/pg_row_spec.rb +118 -118
  131. data/spec/extensions/pg_static_cache_updater_spec.rb +28 -28
  132. data/spec/extensions/pg_typecast_on_load_spec.rb +21 -21
  133. data/spec/extensions/prepared_statements_associations_spec.rb +42 -42
  134. data/spec/extensions/prepared_statements_safe_spec.rb +18 -18
  135. data/spec/extensions/prepared_statements_spec.rb +28 -28
  136. data/spec/extensions/prepared_statements_with_pk_spec.rb +11 -11
  137. data/spec/extensions/pretty_table_spec.rb +16 -16
  138. data/spec/extensions/query_literals_spec.rb +37 -37
  139. data/spec/extensions/query_spec.rb +32 -32
  140. data/spec/extensions/rcte_tree_spec.rb +141 -141
  141. data/spec/extensions/round_timestamps_spec.rb +21 -21
  142. data/spec/extensions/schema_caching_spec.rb +8 -8
  143. data/spec/extensions/schema_dumper_spec.rb +78 -78
  144. data/spec/extensions/schema_spec.rb +31 -27
  145. data/spec/extensions/scissors_spec.rb +3 -3
  146. data/spec/extensions/select_remove_spec.rb +14 -14
  147. data/spec/extensions/sequel_3_dataset_methods_spec.rb +28 -28
  148. data/spec/extensions/serialization_modification_detection_spec.rb +33 -33
  149. data/spec/extensions/serialization_spec.rb +79 -78
  150. data/spec/extensions/server_block_spec.rb +17 -17
  151. data/spec/extensions/set_overrides_spec.rb +30 -30
  152. data/spec/extensions/sharding_spec.rb +65 -65
  153. data/spec/extensions/shared_caching_spec.rb +29 -29
  154. data/spec/extensions/single_table_inheritance_spec.rb +79 -79
  155. data/spec/extensions/skip_create_refresh_spec.rb +3 -3
  156. data/spec/extensions/spec_helper.rb +4 -29
  157. data/spec/extensions/split_array_nil_spec.rb +9 -9
  158. data/spec/extensions/split_values_spec.rb +7 -7
  159. data/spec/extensions/sql_expr_spec.rb +32 -32
  160. data/spec/extensions/static_cache_spec.rb +123 -123
  161. data/spec/extensions/string_date_time_spec.rb +34 -34
  162. data/spec/extensions/string_stripper_spec.rb +15 -15
  163. data/spec/extensions/subclasses_spec.rb +31 -31
  164. data/spec/extensions/table_select_spec.rb +15 -15
  165. data/spec/extensions/tactical_eager_loading_spec.rb +23 -23
  166. data/spec/extensions/thread_local_timezones_spec.rb +13 -13
  167. data/spec/extensions/timestamps_spec.rb +40 -40
  168. data/spec/extensions/to_dot_spec.rb +34 -34
  169. data/spec/extensions/touch_spec.rb +52 -52
  170. data/spec/extensions/tree_spec.rb +72 -72
  171. data/spec/extensions/typecast_on_load_spec.rb +25 -25
  172. data/spec/extensions/unlimited_update_spec.rb +2 -2
  173. data/spec/extensions/update_or_create_spec.rb +36 -36
  174. data/spec/extensions/update_primary_key_spec.rb +35 -35
  175. data/spec/extensions/update_refresh_spec.rb +41 -0
  176. data/spec/extensions/validate_associated_spec.rb +52 -0
  177. data/spec/extensions/validation_class_methods_spec.rb +314 -317
  178. data/spec/extensions/validation_helpers_spec.rb +195 -195
  179. data/spec/extensions/xml_serializer_spec.rb +48 -48
  180. data/spec/guards_helper.rb +55 -0
  181. data/spec/integration/associations_test.rb +1089 -1088
  182. data/spec/integration/database_test.rb +29 -29
  183. data/spec/integration/dataset_test.rb +661 -661
  184. data/spec/integration/eager_loader_test.rb +147 -147
  185. data/spec/integration/migrator_test.rb +122 -122
  186. data/spec/integration/model_test.rb +70 -70
  187. data/spec/integration/plugin_test.rb +682 -640
  188. data/spec/integration/prepared_statement_test.rb +172 -172
  189. data/spec/integration/schema_test.rb +245 -245
  190. data/spec/integration/spec_helper.rb +1 -64
  191. data/spec/integration/timezone_test.rb +17 -17
  192. data/spec/integration/transaction_test.rb +87 -87
  193. data/spec/integration/type_test.rb +33 -33
  194. data/spec/model/association_reflection_spec.rb +130 -121
  195. data/spec/model/associations_spec.rb +1112 -1113
  196. data/spec/model/base_spec.rb +197 -196
  197. data/spec/model/class_dataset_methods_spec.rb +118 -118
  198. data/spec/model/dataset_methods_spec.rb +49 -49
  199. data/spec/model/eager_loading_spec.rb +705 -702
  200. data/spec/model/hooks_spec.rb +169 -168
  201. data/spec/model/inflector_spec.rb +5 -5
  202. data/spec/model/model_spec.rb +287 -297
  203. data/spec/model/plugins_spec.rb +47 -47
  204. data/spec/model/record_spec.rb +534 -535
  205. data/spec/model/spec_helper.rb +3 -21
  206. data/spec/model/validations_spec.rb +72 -70
  207. data/spec/spec_config.rb +8 -0
  208. metadata +41 -9
  209. data/lib/sequel/adapters/fdbsql.rb +0 -286
  210. data/lib/sequel/adapters/jdbc/fdbsql.rb +0 -66
  211. data/lib/sequel/adapters/openbase.rb +0 -54
  212. data/lib/sequel/adapters/shared/fdbsql.rb +0 -550
  213. data/spec/adapters/fdbsql_spec.rb +0 -429
  214. data/spec/rspec_helper.rb +0 -22
@@ -1,336 +1,336 @@
1
1
  require File.join(File.dirname(File.expand_path(__FILE__)), "spec_helper")
2
2
 
3
3
  describe "Sequel Mock Adapter" do
4
- specify "should have an adapter method" do
4
+ it "should have an adapter method" do
5
5
  db = Sequel.mock
6
- db.should be_a_kind_of(Sequel::Mock::Database)
7
- db.adapter_scheme.should == :mock
6
+ db.must_be_kind_of(Sequel::Mock::Database)
7
+ db.adapter_scheme.must_equal :mock
8
8
  end
9
9
 
10
- specify "should have constructor accept no arguments" do
11
- Sequel::Mock::Database.new.should be_a_kind_of(Sequel::Mock::Database)
10
+ it "should have constructor accept no arguments" do
11
+ Sequel::Mock::Database.new.must_be_kind_of(Sequel::Mock::Database)
12
12
  end
13
13
 
14
- specify "should each not return any rows by default" do
14
+ it "should each not return any rows by default" do
15
15
  called = false
16
16
  Sequel.mock[:t].each{|r| called = true}
17
- called.should == false
17
+ called.must_equal false
18
18
  end
19
19
 
20
- specify "should return 0 for update/delete/with_sql_delete/execute_dui by default" do
21
- Sequel.mock[:t].update(:a=>1).should == 0
22
- Sequel.mock[:t].delete.should == 0
23
- Sequel.mock[:t].with_sql_delete('DELETE FROM t').should == 0
24
- Sequel.mock.execute_dui('DELETE FROM t').should == 0
20
+ it "should return 0 for update/delete/with_sql_delete/execute_dui by default" do
21
+ Sequel.mock[:t].update(:a=>1).must_equal 0
22
+ Sequel.mock[:t].delete.must_equal 0
23
+ Sequel.mock[:t].with_sql_delete('DELETE FROM t').must_equal 0
24
+ Sequel.mock.execute_dui('DELETE FROM t').must_equal 0
25
25
  end
26
26
 
27
- specify "should return nil for insert/execute_insert by default" do
28
- Sequel.mock[:t].insert(:a=>1).should be_nil
29
- Sequel.mock.execute_insert('INSERT INTO a () DEFAULT VALUES').should be_nil
27
+ it "should return nil for insert/execute_insert by default" do
28
+ Sequel.mock[:t].insert(:a=>1).must_equal nil
29
+ Sequel.mock.execute_insert('INSERT INTO a () DEFAULT VALUES').must_equal nil
30
30
  end
31
31
 
32
- specify "should be able to set the rows returned by each using :fetch option with a single hash" do
32
+ it "should be able to set the rows returned by each using :fetch option with a single hash" do
33
33
  rs = []
34
34
  db = Sequel.mock(:fetch=>{:a=>1})
35
35
  db[:t].each{|r| rs << r}
36
- rs.should == [{:a=>1}]
36
+ rs.must_equal [{:a=>1}]
37
37
  db[:t].each{|r| rs << r}
38
- rs.should == [{:a=>1}, {:a=>1}]
38
+ rs.must_equal [{:a=>1}, {:a=>1}]
39
39
  db[:t].each{|r| r[:a] = 2; rs << r}
40
- rs.should == [{:a=>1}, {:a=>1}, {:a=>2}]
40
+ rs.must_equal [{:a=>1}, {:a=>1}, {:a=>2}]
41
41
  db[:t].each{|r| rs << r}
42
- rs.should == [{:a=>1}, {:a=>1}, {:a=>2}, {:a=>1}]
42
+ rs.must_equal [{:a=>1}, {:a=>1}, {:a=>2}, {:a=>1}]
43
43
  end
44
44
 
45
- specify "should be able to set the rows returned by each using :fetch option with an array of hashes" do
45
+ it "should be able to set the rows returned by each using :fetch option with an array of hashes" do
46
46
  rs = []
47
47
  db = Sequel.mock(:fetch=>[{:a=>1}, {:a=>2}])
48
48
  db[:t].each{|r| rs << r}
49
- rs.should == [{:a=>1}, {:a=>2}]
49
+ rs.must_equal [{:a=>1}, {:a=>2}]
50
50
  db[:t].each{|r| rs << r}
51
- rs.should == [{:a=>1}, {:a=>2}, {:a=>1}, {:a=>2}]
51
+ rs.must_equal [{:a=>1}, {:a=>2}, {:a=>1}, {:a=>2}]
52
52
  db[:t].each{|r| r[:a] += 2; rs << r}
53
- rs.should == [{:a=>1}, {:a=>2}, {:a=>1}, {:a=>2}, {:a=>3}, {:a=>4}]
53
+ rs.must_equal [{:a=>1}, {:a=>2}, {:a=>1}, {:a=>2}, {:a=>3}, {:a=>4}]
54
54
  db[:t].each{|r| rs << r}
55
- rs.should == [{:a=>1}, {:a=>2}, {:a=>1}, {:a=>2}, {:a=>3}, {:a=>4}, {:a=>1}, {:a=>2}]
55
+ rs.must_equal [{:a=>1}, {:a=>2}, {:a=>1}, {:a=>2}, {:a=>3}, {:a=>4}, {:a=>1}, {:a=>2}]
56
56
  end
57
57
 
58
- specify "should be able to set the rows returned by each using :fetch option with an array or arrays of hashes" do
58
+ it "should be able to set the rows returned by each using :fetch option with an array or arrays of hashes" do
59
59
  rs = []
60
60
  db = Sequel.mock(:fetch=>[[{:a=>1}, {:a=>2}], [{:a=>3}, {:a=>4}]])
61
61
  db[:t].each{|r| rs << r}
62
- rs.should == [{:a=>1}, {:a=>2}]
62
+ rs.must_equal [{:a=>1}, {:a=>2}]
63
63
  db[:t].each{|r| rs << r}
64
- rs.should == [{:a=>1}, {:a=>2}, {:a=>3}, {:a=>4}]
64
+ rs.must_equal [{:a=>1}, {:a=>2}, {:a=>3}, {:a=>4}]
65
65
  db[:t].each{|r| rs << r}
66
- rs.should == [{:a=>1}, {:a=>2}, {:a=>3}, {:a=>4}]
66
+ rs.must_equal [{:a=>1}, {:a=>2}, {:a=>3}, {:a=>4}]
67
67
  end
68
68
 
69
- specify "should be able to set the rows returned by each using :fetch option with a proc that takes sql" do
69
+ it "should be able to set the rows returned by each using :fetch option with a proc that takes sql" do
70
70
  rs = []
71
71
  db = Sequel.mock(:fetch=>proc{|sql| sql =~ /FROM t/ ? {:b=>1} : [{:a=>1}, {:a=>2}]})
72
72
  db[:t].each{|r| rs << r}
73
- rs.should == [{:b=>1}]
73
+ rs.must_equal [{:b=>1}]
74
74
  db[:b].each{|r| rs << r}
75
- rs.should == [{:b=>1}, {:a=>1}, {:a=>2}]
75
+ rs.must_equal [{:b=>1}, {:a=>1}, {:a=>2}]
76
76
  db[:t].each{|r| r[:b] += 1; rs << r}
77
77
  db[:b].each{|r| r[:a] += 2; rs << r}
78
- rs.should == [{:b=>1}, {:a=>1}, {:a=>2}, {:b=>2}, {:a=>3}, {:a=>4}]
78
+ rs.must_equal [{:b=>1}, {:a=>1}, {:a=>2}, {:b=>2}, {:a=>3}, {:a=>4}]
79
79
  db[:t].each{|r| rs << r}
80
80
  db[:b].each{|r| rs << r}
81
- rs.should == [{:b=>1}, {:a=>1}, {:a=>2}, {:b=>2}, {:a=>3}, {:a=>4}, {:b=>1}, {:a=>1}, {:a=>2}]
81
+ rs.must_equal [{:b=>1}, {:a=>1}, {:a=>2}, {:b=>2}, {:a=>3}, {:a=>4}, {:b=>1}, {:a=>1}, {:a=>2}]
82
82
  end
83
83
 
84
- specify "should have a fetch= method for setting rows returned by each after the fact" do
84
+ it "should have a fetch= method for setting rows returned by each after the fact" do
85
85
  rs = []
86
86
  db = Sequel.mock
87
87
  db.fetch = {:a=>1}
88
88
  db[:t].each{|r| rs << r}
89
- rs.should == [{:a=>1}]
89
+ rs.must_equal [{:a=>1}]
90
90
  db[:t].each{|r| rs << r}
91
- rs.should == [{:a=>1}] * 2
91
+ rs.must_equal [{:a=>1}] * 2
92
92
  end
93
93
 
94
- specify "should be able to set an exception to raise by setting the :fetch option to an exception class " do
94
+ it "should be able to set an exception to raise by setting the :fetch option to an exception class " do
95
95
  db = Sequel.mock(:fetch=>ArgumentError)
96
- proc{db[:t].all}.should raise_error(Sequel::DatabaseError)
96
+ proc{db[:t].all}.must_raise(Sequel::DatabaseError)
97
97
  begin
98
98
  db[:t].all
99
99
  rescue => e
100
100
  end
101
- e.should be_a_kind_of(Sequel::DatabaseError)
102
- e.wrapped_exception.should be_a_kind_of(ArgumentError)
101
+ e.must_be_kind_of(Sequel::DatabaseError)
102
+ e.wrapped_exception.must_be_kind_of(ArgumentError)
103
103
  end
104
104
 
105
- specify "should be able to set separate kinds of results for fetch using an array" do
105
+ it "should be able to set separate kinds of results for fetch using an array" do
106
106
  rs = []
107
107
  db = Sequel.mock(:fetch=>[{:a=>1}, [{:a=>2}, {:a=>3}], proc{|s| {:a=>4}}, proc{|s| }, nil, ArgumentError])
108
108
  db[:t].each{|r| rs << r}
109
- rs.should == [{:a=>1}]
109
+ rs.must_equal [{:a=>1}]
110
110
  db[:t].each{|r| rs << r}
111
- rs.should == [{:a=>1}, {:a=>2}, {:a=>3}]
111
+ rs.must_equal [{:a=>1}, {:a=>2}, {:a=>3}]
112
112
  db[:t].each{|r| rs << r}
113
- rs.should == [{:a=>1}, {:a=>2}, {:a=>3}, {:a=>4}]
113
+ rs.must_equal [{:a=>1}, {:a=>2}, {:a=>3}, {:a=>4}]
114
114
  db[:t].each{|r| rs << r}
115
- rs.should == [{:a=>1}, {:a=>2}, {:a=>3}, {:a=>4}]
115
+ rs.must_equal [{:a=>1}, {:a=>2}, {:a=>3}, {:a=>4}]
116
116
  db[:t].each{|r| rs << r}
117
- rs.should == [{:a=>1}, {:a=>2}, {:a=>3}, {:a=>4}]
118
- proc{db[:t].all}.should raise_error(Sequel::DatabaseError)
117
+ rs.must_equal [{:a=>1}, {:a=>2}, {:a=>3}, {:a=>4}]
118
+ proc{db[:t].all}.must_raise(Sequel::DatabaseError)
119
119
  end
120
120
 
121
- specify "should be able to set the rows returned by each on a per dataset basis using _fetch" do
121
+ it "should be able to set the rows returned by each on a per dataset basis using _fetch" do
122
122
  rs = []
123
123
  db = Sequel.mock(:fetch=>{:a=>1})
124
124
  ds = db[:t]
125
125
  ds.each{|r| rs << r}
126
- rs.should == [{:a=>1}]
126
+ rs.must_equal [{:a=>1}]
127
127
  ds._fetch = {:b=>2}
128
128
  ds.each{|r| rs << r}
129
- rs.should == [{:a=>1}, {:b=>2}]
129
+ rs.must_equal [{:a=>1}, {:b=>2}]
130
130
  end
131
131
 
132
- specify "should raise Error if given an invalid object to fetch" do
133
- proc{Sequel.mock(:fetch=>Class.new).get(:a)}.should raise_error(Sequel::Error)
134
- proc{Sequel.mock(:fetch=>Object.new).get(:a)}.should raise_error(Sequel::Error)
132
+ it "should raise Error if given an invalid object to fetch" do
133
+ proc{Sequel.mock(:fetch=>Class.new).get(:a)}.must_raise(Sequel::DatabaseError)
134
+ proc{Sequel.mock(:fetch=>Object.new).get(:a)}.must_raise(Sequel::DatabaseError)
135
135
  end
136
136
 
137
- specify "should be able to set the number of rows modified by update and delete using :numrows option as an integer" do
137
+ it "should be able to set the number of rows modified by update and delete using :numrows option as an integer" do
138
138
  db = Sequel.mock(:numrows=>2)
139
- db[:t].update(:a=>1).should == 2
140
- db[:t].delete.should == 2
141
- db[:t].update(:a=>1).should == 2
142
- db[:t].delete.should == 2
139
+ db[:t].update(:a=>1).must_equal 2
140
+ db[:t].delete.must_equal 2
141
+ db[:t].update(:a=>1).must_equal 2
142
+ db[:t].delete.must_equal 2
143
143
  end
144
144
 
145
- specify "should be able to set the number of rows modified by update and delete using :numrows option as an array of integers" do
145
+ it "should be able to set the number of rows modified by update and delete using :numrows option as an array of integers" do
146
146
  db = Sequel.mock(:numrows=>[2, 1])
147
- db[:t].update(:a=>1).should == 2
148
- db[:t].delete.should == 1
149
- db[:t].update(:a=>1).should == 0
150
- db[:t].delete.should == 0
147
+ db[:t].update(:a=>1).must_equal 2
148
+ db[:t].delete.must_equal 1
149
+ db[:t].update(:a=>1).must_equal 0
150
+ db[:t].delete.must_equal 0
151
151
  end
152
152
 
153
- specify "should be able to set the number of rows modified by update and delete using :numrows option as a proc" do
153
+ it "should be able to set the number of rows modified by update and delete using :numrows option as a proc" do
154
154
  db = Sequel.mock(:numrows=>proc{|sql| sql =~ / t/ ? 2 : 1})
155
- db[:t].update(:a=>1).should == 2
156
- db[:t].delete.should == 2
157
- db[:b].update(:a=>1).should == 1
158
- db[:b].delete.should == 1
155
+ db[:t].update(:a=>1).must_equal 2
156
+ db[:t].delete.must_equal 2
157
+ db[:b].update(:a=>1).must_equal 1
158
+ db[:b].delete.must_equal 1
159
159
  end
160
160
 
161
- specify "should be able to set an exception to raise by setting the :numrows option to an exception class " do
161
+ it "should be able to set an exception to raise by setting the :numrows option to an exception class " do
162
162
  db = Sequel.mock(:numrows=>ArgumentError)
163
- proc{db[:t].update(:a=>1)}.should raise_error(Sequel::DatabaseError)
163
+ proc{db[:t].update(:a=>1)}.must_raise(Sequel::DatabaseError)
164
164
  begin
165
165
  db[:t].delete
166
166
  rescue => e
167
167
  end
168
- e.should be_a_kind_of(Sequel::DatabaseError)
169
- e.wrapped_exception.should be_a_kind_of(ArgumentError)
168
+ e.must_be_kind_of(Sequel::DatabaseError)
169
+ e.wrapped_exception.must_be_kind_of(ArgumentError)
170
170
  end
171
171
 
172
- specify "should be able to set separate kinds of results for numrows using an array" do
172
+ it "should be able to set separate kinds of results for numrows using an array" do
173
173
  db = Sequel.mock(:numrows=>[1, proc{|s| 2}, nil, ArgumentError])
174
- db[:t].delete.should == 1
175
- db[:t].update(:a=>1).should == 2
176
- db[:t].delete.should == 0
177
- proc{db[:t].delete}.should raise_error(Sequel::DatabaseError)
174
+ db[:t].delete.must_equal 1
175
+ db[:t].update(:a=>1).must_equal 2
176
+ db[:t].delete.must_equal 0
177
+ proc{db[:t].delete}.must_raise(Sequel::DatabaseError)
178
178
  end
179
179
 
180
- specify "should have a numrows= method to set the number of rows modified by update and delete after the fact" do
180
+ it "should have a numrows= method to set the number of rows modified by update and delete after the fact" do
181
181
  db = Sequel.mock
182
182
  db.numrows = 2
183
- db[:t].update(:a=>1).should == 2
184
- db[:t].delete.should == 2
185
- db[:t].update(:a=>1).should == 2
186
- db[:t].delete.should == 2
183
+ db[:t].update(:a=>1).must_equal 2
184
+ db[:t].delete.must_equal 2
185
+ db[:t].update(:a=>1).must_equal 2
186
+ db[:t].delete.must_equal 2
187
187
  end
188
188
 
189
- specify "should be able to set the number of rows modified by update and delete on a per dataset basis" do
189
+ it "should be able to set the number of rows modified by update and delete on a per dataset basis" do
190
190
  db = Sequel.mock(:numrows=>2)
191
191
  ds = db[:t]
192
- ds.update(:a=>1).should == 2
193
- ds.delete.should == 2
192
+ ds.update(:a=>1).must_equal 2
193
+ ds.delete.must_equal 2
194
194
  ds.numrows = 3
195
- ds.update(:a=>1).should == 3
196
- ds.delete.should == 3
195
+ ds.update(:a=>1).must_equal 3
196
+ ds.delete.must_equal 3
197
197
  end
198
198
 
199
- specify "should raise Error if given an invalid object for numrows or autoid" do
200
- proc{Sequel.mock(:numrows=>Class.new)[:a].delete}.should raise_error(Sequel::Error)
201
- proc{Sequel.mock(:numrows=>Object.new)[:a].delete}.should raise_error(Sequel::Error)
202
- proc{Sequel.mock(:autoid=>Class.new)[:a].insert}.should raise_error(Sequel::Error)
203
- proc{Sequel.mock(:autoid=>Object.new)[:a].insert}.should raise_error(Sequel::Error)
199
+ it "should raise Error if given an invalid object for numrows or autoid" do
200
+ proc{Sequel.mock(:numrows=>Class.new)[:a].delete}.must_raise(Sequel::DatabaseError)
201
+ proc{Sequel.mock(:numrows=>Object.new)[:a].delete}.must_raise(Sequel::DatabaseError)
202
+ proc{Sequel.mock(:autoid=>Class.new)[:a].insert}.must_raise(Sequel::DatabaseError)
203
+ proc{Sequel.mock(:autoid=>Object.new)[:a].insert}.must_raise(Sequel::DatabaseError)
204
204
  end
205
205
 
206
- specify "should be able to set the autogenerated primary key returned by insert using :autoid option as an integer" do
206
+ it "should be able to set the autogenerated primary key returned by insert using :autoid option as an integer" do
207
207
  db = Sequel.mock(:autoid=>1)
208
- db[:t].insert(:a=>1).should == 1
209
- db[:t].insert(:a=>1).should == 2
210
- db[:t].insert(:a=>1).should == 3
208
+ db[:t].insert(:a=>1).must_equal 1
209
+ db[:t].insert(:a=>1).must_equal 2
210
+ db[:t].insert(:a=>1).must_equal 3
211
211
  end
212
212
 
213
- specify "should be able to set the autogenerated primary key returned by insert using :autoid option as an array of integers" do
213
+ it "should be able to set the autogenerated primary key returned by insert using :autoid option as an array of integers" do
214
214
  db = Sequel.mock(:autoid=>[1, 3, 5])
215
- db[:t].insert(:a=>1).should == 1
216
- db[:t].insert(:a=>1).should == 3
217
- db[:t].insert(:a=>1).should == 5
218
- db[:t].insert(:a=>1).should be_nil
215
+ db[:t].insert(:a=>1).must_equal 1
216
+ db[:t].insert(:a=>1).must_equal 3
217
+ db[:t].insert(:a=>1).must_equal 5
218
+ db[:t].insert(:a=>1).must_equal nil
219
219
  end
220
220
 
221
- specify "should be able to set the autogenerated primary key returned by insert using :autoid option as a proc" do
221
+ it "should be able to set the autogenerated primary key returned by insert using :autoid option as a proc" do
222
222
  db = Sequel.mock(:autoid=>proc{|sql| sql =~ /INTO t / ? 2 : 1})
223
- db[:t].insert(:a=>1).should == 2
224
- db[:t].insert(:a=>1).should == 2
225
- db[:b].insert(:a=>1).should == 1
226
- db[:b].insert(:a=>1).should == 1
223
+ db[:t].insert(:a=>1).must_equal 2
224
+ db[:t].insert(:a=>1).must_equal 2
225
+ db[:b].insert(:a=>1).must_equal 1
226
+ db[:b].insert(:a=>1).must_equal 1
227
227
  end
228
228
 
229
- specify "should be able to set an exception to raise by setting the :autoid option to an exception class " do
229
+ it "should be able to set an exception to raise by setting the :autoid option to an exception class " do
230
230
  db = Sequel.mock(:autoid=>ArgumentError)
231
- proc{db[:t].insert(:a=>1)}.should raise_error(Sequel::DatabaseError)
231
+ proc{db[:t].insert(:a=>1)}.must_raise(Sequel::DatabaseError)
232
232
  begin
233
233
  db[:t].insert
234
234
  rescue => e
235
235
  end
236
- e.should be_a_kind_of(Sequel::DatabaseError)
237
- e.wrapped_exception.should be_a_kind_of(ArgumentError)
236
+ e.must_be_kind_of(Sequel::DatabaseError)
237
+ e.wrapped_exception.must_be_kind_of(ArgumentError)
238
238
  end
239
239
 
240
- specify "should be able to set separate kinds of results for autoid using an array" do
240
+ it "should be able to set separate kinds of results for autoid using an array" do
241
241
  db = Sequel.mock(:autoid=>[1, proc{|s| 2}, nil, ArgumentError])
242
- db[:t].insert.should == 1
243
- db[:t].insert.should == 2
244
- db[:t].insert.should == nil
245
- proc{db[:t].insert}.should raise_error(Sequel::DatabaseError)
242
+ db[:t].insert.must_equal 1
243
+ db[:t].insert.must_equal 2
244
+ db[:t].insert.must_equal nil
245
+ proc{db[:t].insert}.must_raise(Sequel::DatabaseError)
246
246
  end
247
247
 
248
- specify "should have an autoid= method to set the autogenerated primary key returned by insert after the fact" do
248
+ it "should have an autoid= method to set the autogenerated primary key returned by insert after the fact" do
249
249
  db = Sequel.mock
250
250
  db.autoid = 1
251
- db[:t].insert(:a=>1).should == 1
252
- db[:t].insert(:a=>1).should == 2
253
- db[:t].insert(:a=>1).should == 3
251
+ db[:t].insert(:a=>1).must_equal 1
252
+ db[:t].insert(:a=>1).must_equal 2
253
+ db[:t].insert(:a=>1).must_equal 3
254
254
  end
255
255
 
256
- specify "should be able to set the autogenerated primary key returned by insert on a per dataset basis" do
256
+ it "should be able to set the autogenerated primary key returned by insert on a per dataset basis" do
257
257
  db = Sequel.mock(:autoid=>1)
258
258
  ds = db[:t]
259
- ds.insert(:a=>1).should == 1
259
+ ds.insert(:a=>1).must_equal 1
260
260
  ds.autoid = 5
261
- ds.insert(:a=>1).should == 5
262
- ds.insert(:a=>1).should == 6
263
- db[:t].insert(:a=>1).should == 2
261
+ ds.insert(:a=>1).must_equal 5
262
+ ds.insert(:a=>1).must_equal 6
263
+ db[:t].insert(:a=>1).must_equal 2
264
264
  end
265
265
 
266
- specify "should be able to set the columns to set in the dataset as an array of symbols" do
266
+ it "should be able to set the columns to set in the dataset as an array of symbols" do
267
267
  db = Sequel.mock(:columns=>[:a, :b])
268
- db[:t].columns.should == [:a, :b]
269
- db.sqls.should == ["SELECT * FROM t LIMIT 1"]
268
+ db[:t].columns.must_equal [:a, :b]
269
+ db.sqls.must_equal ["SELECT * FROM t LIMIT 1"]
270
270
  ds = db[:t]
271
271
  ds.all
272
- db.sqls.should == ["SELECT * FROM t"]
273
- ds.columns.should == [:a, :b]
274
- db.sqls.should == []
275
- db[:t].columns.should == [:a, :b]
272
+ db.sqls.must_equal ["SELECT * FROM t"]
273
+ ds.columns.must_equal [:a, :b]
274
+ db.sqls.must_equal []
275
+ db[:t].columns.must_equal [:a, :b]
276
276
  end
277
277
 
278
- specify "should be able to set the columns to set in the dataset as an array of arrays of symbols" do
278
+ it "should be able to set the columns to set in the dataset as an array of arrays of symbols" do
279
279
  db = Sequel.mock(:columns=>[[:a, :b], [:c, :d]])
280
- db[:t].columns.should == [:a, :b]
281
- db[:t].columns.should == [:c, :d]
280
+ db[:t].columns.must_equal [:a, :b]
281
+ db[:t].columns.must_equal [:c, :d]
282
282
  end
283
283
 
284
- specify "should be able to set the columns to set in the dataset as a proc" do
284
+ it "should be able to set the columns to set in the dataset as a proc" do
285
285
  db = Sequel.mock(:columns=>proc{|sql| (sql =~ / t/) ? [:a, :b] : [:c, :d]})
286
- db[:b].columns.should == [:c, :d]
287
- db[:t].columns.should == [:a, :b]
286
+ db[:b].columns.must_equal [:c, :d]
287
+ db[:t].columns.must_equal [:a, :b]
288
288
  end
289
289
 
290
- specify "should have a columns= method to set the columns to set after the fact" do
290
+ it "should have a columns= method to set the columns to set after the fact" do
291
291
  db = Sequel.mock
292
292
  db.columns = [[:a, :b], [:c, :d]]
293
- db[:t].columns.should == [:a, :b]
294
- db[:t].columns.should == [:c, :d]
293
+ db[:t].columns.must_equal [:a, :b]
294
+ db[:t].columns.must_equal [:c, :d]
295
295
  end
296
296
 
297
- specify "should raise Error if given an invalid columns" do
298
- proc{Sequel.mock(:columns=>Object.new)[:a].columns}.should raise_error(Sequel::Error)
297
+ it "should raise Error if given an invalid columns" do
298
+ proc{Sequel.mock(:columns=>Object.new)[:a].columns}.must_raise(Sequel::DatabaseError)
299
299
  end
300
300
 
301
- specify "should not quote identifiers by default" do
302
- Sequel.mock.send(:quote_identifiers_default).should == false
301
+ it "should not quote identifiers by default" do
302
+ Sequel.mock.send(:quote_identifiers_default).must_equal false
303
303
  end
304
304
 
305
- specify "should allow overriding of server_version" do
305
+ it "should allow overriding of server_version" do
306
306
  db = Sequel.mock
307
- db.server_version.should == nil
307
+ db.server_version.must_equal nil
308
308
  db.server_version = 80102
309
- db.server_version.should == 80102
309
+ db.server_version.must_equal 80102
310
310
  end
311
311
 
312
- specify "should not have identifier input/output methods by default" do
313
- Sequel.mock.send(:identifier_input_method_default).should be_nil
314
- Sequel.mock.send(:identifier_output_method_default).should be_nil
312
+ it "should not have identifier input/output methods by default" do
313
+ Sequel.mock.send(:identifier_input_method_default).must_equal nil
314
+ Sequel.mock.send(:identifier_output_method_default).must_equal nil
315
315
  end
316
316
 
317
- specify "should keep a record of all executed SQL in #sqls" do
317
+ it "should keep a record of all executed SQL in #sqls" do
318
318
  db = Sequel.mock
319
319
  db[:t].all
320
320
  db[:b].delete
321
321
  db[:c].insert(:a=>1)
322
322
  db[:d].update(:a=>1)
323
- db.sqls.should == ['SELECT * FROM t', 'DELETE FROM b', 'INSERT INTO c (a) VALUES (1)', 'UPDATE d SET a = 1']
323
+ db.sqls.must_equal ['SELECT * FROM t', 'DELETE FROM b', 'INSERT INTO c (a) VALUES (1)', 'UPDATE d SET a = 1']
324
324
  end
325
325
 
326
- specify "should clear sqls on retrieval" do
326
+ it "should clear sqls on retrieval" do
327
327
  db = Sequel.mock
328
328
  db[:t].all
329
- db.sqls.should == ['SELECT * FROM t']
330
- db.sqls.should == []
329
+ db.sqls.must_equal ['SELECT * FROM t']
330
+ db.sqls.must_equal []
331
331
  end
332
332
 
333
- specify "should also log SQL executed to the given loggers" do
333
+ it "should also log SQL executed to the given loggers" do
334
334
  a = []
335
335
  def a.method_missing(m, *x) push(*x) end
336
336
  db = Sequel.mock(:loggers=>[a])
@@ -338,84 +338,84 @@ describe "Sequel Mock Adapter" do
338
338
  db[:b].delete
339
339
  db[:c].insert(:a=>1)
340
340
  db[:d].update(:a=>1)
341
- a.should == ['SELECT * FROM t', 'DELETE FROM b', 'INSERT INTO c (a) VALUES (1)', 'UPDATE d SET a = 1']
341
+ a.must_equal ['SELECT * FROM t', 'DELETE FROM b', 'INSERT INTO c (a) VALUES (1)', 'UPDATE d SET a = 1']
342
342
  end
343
343
 
344
- specify "should correctly handle transactions" do
344
+ it "should correctly handle transactions" do
345
345
  db = Sequel.mock
346
346
  db.transaction{db[:a].all}
347
- db.sqls.should == ['BEGIN', 'SELECT * FROM a', 'COMMIT']
347
+ db.sqls.must_equal ['BEGIN', 'SELECT * FROM a', 'COMMIT']
348
348
  db.transaction{db[:a].all; raise Sequel::Rollback}
349
- db.sqls.should == ['BEGIN', 'SELECT * FROM a', 'ROLLBACK']
350
- proc{db.transaction{db[:a].all; raise ArgumentError}}.should raise_error(ArgumentError)
351
- db.sqls.should == ['BEGIN', 'SELECT * FROM a', 'ROLLBACK']
352
- proc{db.transaction(:rollback=>:reraise){db[:a].all; raise Sequel::Rollback}}.should raise_error(Sequel::Rollback)
353
- db.sqls.should == ['BEGIN', 'SELECT * FROM a', 'ROLLBACK']
349
+ db.sqls.must_equal ['BEGIN', 'SELECT * FROM a', 'ROLLBACK']
350
+ proc{db.transaction{db[:a].all; raise ArgumentError}}.must_raise(ArgumentError)
351
+ db.sqls.must_equal ['BEGIN', 'SELECT * FROM a', 'ROLLBACK']
352
+ proc{db.transaction(:rollback=>:reraise){db[:a].all; raise Sequel::Rollback}}.must_raise(Sequel::Rollback)
353
+ db.sqls.must_equal ['BEGIN', 'SELECT * FROM a', 'ROLLBACK']
354
354
  db.transaction(:rollback=>:always){db[:a].all}
355
- db.sqls.should == ['BEGIN', 'SELECT * FROM a', 'ROLLBACK']
355
+ db.sqls.must_equal ['BEGIN', 'SELECT * FROM a', 'ROLLBACK']
356
356
  db.transaction{db.transaction{db[:a].all; raise Sequel::Rollback}}
357
- db.sqls.should == ['BEGIN', 'SELECT * FROM a', 'ROLLBACK']
357
+ db.sqls.must_equal ['BEGIN', 'SELECT * FROM a', 'ROLLBACK']
358
358
  db.transaction{db.transaction(:savepoint=>true){db[:a].all; raise Sequel::Rollback}}
359
- db.sqls.should == ['BEGIN', 'SAVEPOINT autopoint_1', 'SELECT * FROM a', 'ROLLBACK TO SAVEPOINT autopoint_1', 'COMMIT']
359
+ db.sqls.must_equal ['BEGIN', 'SAVEPOINT autopoint_1', 'SELECT * FROM a', 'ROLLBACK TO SAVEPOINT autopoint_1', 'COMMIT']
360
360
  db.transaction{db.transaction(:savepoint=>true){db[:a].all}; raise Sequel::Rollback}
361
- db.sqls.should == ['BEGIN', 'SAVEPOINT autopoint_1', 'SELECT * FROM a', 'RELEASE SAVEPOINT autopoint_1', 'ROLLBACK']
361
+ db.sqls.must_equal ['BEGIN', 'SAVEPOINT autopoint_1', 'SELECT * FROM a', 'RELEASE SAVEPOINT autopoint_1', 'ROLLBACK']
362
362
  end
363
363
 
364
- specify "should correctly handle transactions when sharding" do
364
+ it "should correctly handle transactions when sharding" do
365
365
  db = Sequel.mock(:servers=>{:test=>{}})
366
366
  db.transaction{db.transaction(:server=>:test){db[:a].all; db[:t].server(:test).all}}
367
- db.sqls.should == ['BEGIN', 'BEGIN -- test', 'SELECT * FROM a', 'SELECT * FROM t -- test', 'COMMIT -- test', 'COMMIT']
367
+ db.sqls.must_equal ['BEGIN', 'BEGIN -- test', 'SELECT * FROM a', 'SELECT * FROM t -- test', 'COMMIT -- test', 'COMMIT']
368
368
  end
369
369
 
370
- specify "should yield a mock connection object from synchronize" do
370
+ it "should yield a mock connection object from synchronize" do
371
371
  c = Sequel.mock.synchronize{|conn| conn}
372
- c.should be_a_kind_of(Sequel::Mock::Connection)
372
+ c.must_be_kind_of(Sequel::Mock::Connection)
373
373
  end
374
374
 
375
- specify "should deal correctly with sharding" do
375
+ it "should deal correctly with sharding" do
376
376
  db = Sequel.mock(:servers=>{:test=>{}})
377
377
  c1 = db.synchronize{|conn| conn}
378
378
  c2 = db.synchronize(:test){|conn| conn}
379
- c1.server.should == :default
380
- c2.server.should == :test
379
+ c1.server.must_equal :default
380
+ c2.server.must_equal :test
381
381
  end
382
382
 
383
- specify "should disconnect correctly" do
383
+ it "should disconnect correctly" do
384
384
  db = Sequel.mock
385
385
  db.test_connection
386
- proc{db.disconnect}.should_not raise_error
386
+ db.disconnect
387
387
  end
388
388
 
389
- specify "should accept :extend option for extending the object with a module" do
390
- Sequel.mock(:extend=>Module.new{def foo(v) v * 2 end}).foo(3).should == 6
389
+ it "should accept :extend option for extending the object with a module" do
390
+ Sequel.mock(:extend=>Module.new{def foo(v) v * 2 end}).foo(3).must_equal 6
391
391
  end
392
392
 
393
- specify "should accept :sqls option for where to store the SQL queries" do
393
+ it "should accept :sqls option for where to store the SQL queries" do
394
394
  a = []
395
395
  Sequel.mock(:sqls=>a)[:t].all
396
- a.should == ['SELECT * FROM t']
396
+ a.must_equal ['SELECT * FROM t']
397
397
  end
398
398
 
399
- specify "should include :append option in SQL if it is given" do
399
+ it "should include :append option in SQL if it is given" do
400
400
  db = Sequel.mock(:append=>'a')
401
401
  db[:t].all
402
- db.sqls.should == ['SELECT * FROM t -- a']
402
+ db.sqls.must_equal ['SELECT * FROM t -- a']
403
403
  end
404
404
 
405
- specify "should append :arguments option to execute to the SQL if present" do
405
+ it "should append :arguments option to execute to the SQL if present" do
406
406
  db = Sequel.mock
407
407
  db.execute('SELECT * FROM t', :arguments=>[1, 2])
408
- db.sqls.should == ['SELECT * FROM t -- args: [1, 2]']
408
+ db.sqls.must_equal ['SELECT * FROM t -- args: [1, 2]']
409
409
  end
410
410
 
411
- specify "should have Dataset#columns take columns to set and return self" do
411
+ it "should have Dataset#columns take columns to set and return self" do
412
412
  db = Sequel.mock
413
413
  ds = db[:t].columns(:id, :a, :b)
414
- ds.should be_a_kind_of(Sequel::Mock::Dataset)
415
- ds.columns.should == [:id, :a, :b]
414
+ ds.must_be_kind_of(Sequel::Mock::Dataset)
415
+ ds.columns.must_equal [:id, :a, :b]
416
416
  end
417
417
 
418
- specify "should be able to load dialects based on the database name" do
418
+ it "should be able to load dialects based on the database name" do
419
419
  begin
420
420
  qi = class Sequel::Database; @quote_identifiers; end
421
421
  ii = class Sequel::Database; @identifier_input_method; end
@@ -423,17 +423,17 @@ describe "Sequel Mock Adapter" do
423
423
  Sequel.quote_identifiers = nil
424
424
  class Sequel::Database; @identifier_input_method=nil; end
425
425
  class Sequel::Database; @identifier_output_method=nil; end
426
- Sequel.mock(:host=>'access').select(Date.new(2011, 12, 13)).sql.should == 'SELECT #2011-12-13#'
427
- Sequel.mock(:host=>'cubrid').from(:a).offset(1).sql.should == 'SELECT * FROM "a" LIMIT 1,4294967295'
428
- Sequel.mock(:host=>'db2').select(1).sql.should == 'SELECT 1 FROM "SYSIBM"."SYSDUMMY1"'
429
- Sequel.mock(:host=>'firebird')[:a].distinct.limit(1, 2).sql.should == 'SELECT DISTINCT FIRST 1 SKIP 2 * FROM "A"'
430
- Sequel.mock(:host=>'informix')[:a].distinct.limit(1, 2).sql.should == 'SELECT SKIP 2 FIRST 1 DISTINCT * FROM A'
431
- Sequel.mock(:host=>'mssql')[:a].full_text_search(:b, 'c').sql.should == "SELECT * FROM [A] WHERE (CONTAINS ([B], 'c'))"
432
- Sequel.mock(:host=>'mysql')[:a].full_text_search(:b, 'c').sql.should == "SELECT * FROM `a` WHERE (MATCH (`b`) AGAINST ('c'))"
433
- Sequel.mock(:host=>'oracle')[:a].limit(1).sql.should == 'SELECT * FROM (SELECT * FROM "A") "T1" WHERE (ROWNUM <= 1)'
434
- Sequel.mock(:host=>'postgres')[:a].full_text_search(:b, 'c').sql.should == "SELECT * FROM \"a\" WHERE (to_tsvector(CAST('simple' AS regconfig), (COALESCE(\"b\", ''))) @@ to_tsquery(CAST('simple' AS regconfig), 'c'))"
435
- Sequel.mock(:host=>'sqlanywhere').from(:a).offset(1).sql.should == 'SELECT TOP 2147483647 START AT (1 + 1) * FROM "A"'
436
- Sequel.mock(:host=>'sqlite')[:a___b].sql.should == "SELECT * FROM `a` AS 'b'"
426
+ Sequel.mock(:host=>'access').select(Date.new(2011, 12, 13)).sql.must_equal 'SELECT #2011-12-13#'
427
+ Sequel.mock(:host=>'cubrid').from(:a).offset(1).sql.must_equal 'SELECT * FROM "a" LIMIT 1,4294967295'
428
+ Sequel.mock(:host=>'db2').select(1).sql.must_equal 'SELECT 1 FROM "SYSIBM"."SYSDUMMY1"'
429
+ Sequel.mock(:host=>'firebird')[:a].distinct.limit(1, 2).sql.must_equal 'SELECT DISTINCT FIRST 1 SKIP 2 * FROM "A"'
430
+ Sequel.mock(:host=>'informix')[:a].distinct.limit(1, 2).sql.must_equal 'SELECT SKIP 2 FIRST 1 DISTINCT * FROM A'
431
+ Sequel.mock(:host=>'mssql')[:a].full_text_search(:b, 'c').sql.must_equal "SELECT * FROM [A] WHERE (CONTAINS ([B], 'c'))"
432
+ Sequel.mock(:host=>'mysql')[:a].full_text_search(:b, 'c').sql.must_equal "SELECT * FROM `a` WHERE (MATCH (`b`) AGAINST ('c'))"
433
+ Sequel.mock(:host=>'oracle')[:a].limit(1).sql.must_equal 'SELECT * FROM (SELECT * FROM "A") "T1" WHERE (ROWNUM <= 1)'
434
+ Sequel.mock(:host=>'postgres')[:a].full_text_search(:b, 'c').sql.must_equal "SELECT * FROM \"a\" WHERE (to_tsvector(CAST('simple' AS regconfig), (COALESCE(\"b\", ''))) @@ to_tsquery(CAST('simple' AS regconfig), 'c'))"
435
+ Sequel.mock(:host=>'sqlanywhere').from(:a).offset(1).sql.must_equal 'SELECT TOP 2147483647 START AT (1 + 1) * FROM "A"'
436
+ Sequel.mock(:host=>'sqlite')[:a___b].sql.must_equal "SELECT * FROM `a` AS 'b'"
437
437
  ensure
438
438
  Sequel.quote_identifiers = qi
439
439
  Sequel::Database.send(:instance_variable_set, :@identifier_input_method, ii)
@@ -441,22 +441,22 @@ describe "Sequel Mock Adapter" do
441
441
  end
442
442
  end
443
443
 
444
- specify "should automatically set version for adapters nedding versions" do
445
- Sequel.mock(:host=>'postgres').server_version.should == 90400
446
- Sequel.mock(:host=>'mssql').server_version.should == 11000000
447
- Sequel.mock(:host=>'mysql').server_version.should == 50617
448
- Sequel.mock(:host=>'sqlite').sqlite_version.should == 30804
444
+ it "should automatically set version for adapters nedding versions" do
445
+ Sequel.mock(:host=>'postgres').server_version.must_equal 90400
446
+ Sequel.mock(:host=>'mssql').server_version.must_equal 11000000
447
+ Sequel.mock(:host=>'mysql').server_version.must_equal 50617
448
+ Sequel.mock(:host=>'sqlite').sqlite_version.must_equal 30804
449
449
  end
450
450
 
451
- specify "should stub out the primary_key method for postgres" do
452
- Sequel.mock(:host=>'postgres').primary_key(:t).should == :id
451
+ it "should stub out the primary_key method for postgres" do
452
+ Sequel.mock(:host=>'postgres').primary_key(:t).must_equal :id
453
453
  end
454
454
 
455
- specify "should stub out the bound_variable_arg method for postgres" do
456
- Sequel.mock(:host=>'postgres').bound_variable_arg(:t, nil).should == :t
455
+ it "should stub out the bound_variable_arg method for postgres" do
456
+ Sequel.mock(:host=>'postgres').bound_variable_arg(:t, nil).must_equal :t
457
457
  end
458
458
 
459
- specify "should handle creating tables on oracle" do
460
- proc{Sequel.mock(:host=>'oracle').create_table(:a){String :b}}.should_not raise_error
459
+ it "should handle creating tables on oracle" do
460
+ Sequel.mock(:host=>'oracle').create_table(:a){String :b}
461
461
  end
462
462
  end