Skip to content
This repository
Browse code

Fisting arel specs -- still needs tree_manager and cleanup

  • Loading branch information...
commit e1ebe6e949ef3674434bfa90d271a7b74c2ac153 1 parent 7959e55
Ryan Davis zenspider authored

Showing 35 changed files with 6,108 additions and 404 deletions. Show diff stats Hide diff stats

  1. +26 0 .autotest
  2. +5 1 Rakefile
  3. +5,725 0 TAGS
  4. +1 5 lib/arel/table.rb
  5. +0 21 spec/nodes/select_core_spec.rb
  6. +0 3  spec/spec.opts
  7. +0 18 spec/spec_helper.rb
  8. +0 6 spec/support/check.rb
  9. +0 1  spec/support/matchers.rb
  10. +0 24 spec/support/matchers/be_like.rb
  11. +83 83 spec/attributes/attribute_spec.rb → test/attributes/test_attribute.rb
  12. +2 2 spec/nodes/count_spec.rb → test/nodes/test_count.rb
  13. +2 3 spec/nodes/delete_statement_spec.rb → test/nodes/test_delete_statement.rb
  14. +10 8 spec/nodes/equality_spec.rb → test/nodes/test_equality.rb
  15. +5 5 spec/nodes/insert_statement_spec.rb → test/nodes/test_insert_statement.rb
  16. +6 4 spec/nodes/or_spec.rb → test/nodes/test_or.rb
  17. +22 0 test/nodes/test_select_core.rb
  18. +2 3 spec/nodes/select_statement_spec.rb → test/nodes/test_select_statement.rb
  19. +5 3 spec/nodes/sql_literal_spec.rb → test/nodes/test_sql_literal.rb
  20. +1 1  spec/nodes/sum_spec.rb → test/nodes/test_sum.rb
  21. +5 5 spec/nodes/update_statement_spec.rb → test/nodes/test_update_statement.rb
  22. +21 0 test/spec_helper.rb
  23. 0  {spec → test}/support/fake_record.rb
  24. +1 1  spec/activerecord_compat_spec.rb → test/test_activerecord_compat.rb
  25. +6 6 spec/attributes_spec.rb → test/test_attributes.rb
  26. +3 3 spec/crud_spec.rb → test/test_crud.rb
  27. +15 14 spec/delete_manager_spec.rb → test/test_delete_manager.rb
  28. +22 23 spec/insert_manager_spec.rb → test/test_insert_manager.rb
  29. +65 65 spec/select_manager_spec.rb → test/test_select_manager.rb
  30. +31 53 spec/table_spec.rb → test/test_table.rb
  31. +20 19 spec/update_manager_spec.rb → test/test_update_manager.rb
  32. +2 2 spec/visitors/join_sql_spec.rb → test/visitors/test_join_sql.rb
  33. +9 9 spec/visitors/oracle_spec.rb → test/visitors/test_oracle.rb
  34. +1 1  spec/visitors/postgres_spec.rb → test/visitors/test_postgres.rb
  35. +12 12 spec/visitors/to_sql_spec.rb → test/visitors/test_to_sql.rb
26 .autotest
... ... @@ -0,0 +1,26 @@
  1 +# -*- ruby -*-
  2 +
  3 +# require 'autotest/restart'
  4 +
  5 +ENV['GEM_PATH'] = "tmp/isolate/ruby-1.8"
  6 +
  7 +module Autotest::Restart
  8 + Autotest.add_hook :updated do |at, *args|
  9 + if args.flatten.include? ".autotest" then
  10 + warn "Detected change to .autotest, restarting"
  11 + cmd = %w(autotest)
  12 + cmd << " -v" if $v
  13 + cmd += ARGV
  14 +
  15 + exec(*cmd)
  16 + end
  17 + end
  18 +end
  19 +
  20 +Autotest.add_hook :initialize do |at|
  21 + at.add_exception 'tmp'
  22 + at.testlib = "minitest/autorun"
  23 +
  24 + at.find_directories = ARGV unless ARGV.empty?
  25 +end
  26 +
6 Rakefile
@@ -2,6 +2,7 @@ require "rubygems"
2 2 gem 'hoe', '>= 2.1.0'
3 3 require 'hoe'
4 4
  5 +Hoe.plugin :isolate
5 6 Hoe.plugin :gemspec # `gem install hoe-gemspec`
6 7
7 8 Hoe.spec 'arel' do
@@ -13,5 +14,8 @@ Hoe.spec 'arel' do
13 14 self.readme_file = 'README.markdown'
14 15 self.extra_rdoc_files = FileList['README.markdown']
15 16 self.extra_dev_deps << ['rspec', '~> 1.3.0']
16   - self.testlib = :rspec
  17 + self.extra_dev_deps << ['ZenTest']
  18 + self.extra_dev_deps << ['minitest']
  19 + self.extra_dev_deps << ['hoe-gemspec']
  20 + self.testlib = :minitest
17 21 end
5,725 TAGS
5,725 additions, 0 deletions not shown
6 lib/arel/table.rb
... ... @@ -1,8 +1,4 @@
1   -def Table(name, engine = Arel::Table.engine)
2   - Arel::Table.new(name, engine)
3   -end
4   -
5   -module Arel
  1 +module Arel
6 2 class Table
7 3 include Arel::Crud
8 4
21 spec/nodes/select_core_spec.rb
... ... @@ -1,21 +0,0 @@
1   -require 'spec_helper'
2   -
3   -describe Arel::Nodes::SelectCore do
4   - describe "#clone" do
5   - it "clones froms, projections and wheres" do
6   - core = Arel::Nodes::SelectCore.new
7   - core.instance_variable_set "@froms", %w[a b c]
8   - core.instance_variable_set "@projections", %w[d e f]
9   - core.instance_variable_set "@wheres", %w[g h i]
10   -
11   - [:froms, :projections, :wheres].each do |array_attr|
12   - core.send(array_attr).should_receive(:clone).and_return([array_attr])
13   - end
14   -
15   - dolly = core.clone
16   - check dolly.froms.should == [:froms]
17   - check dolly.projections.should == [:projections]
18   - check dolly.wheres.should == [:wheres]
19   - end
20   - end
21   -end
3  spec/spec.opts
... ... @@ -1,3 +0,0 @@
1   ---backtrace
2   ---diff
3   ---color
18 spec/spec_helper.rb
... ... @@ -1,18 +0,0 @@
1   -require 'rubygems'
2   -require 'spec'
3   -require 'fileutils'
4   -require 'arel'
5   -
6   -require 'support/matchers/be_like'
7   -require 'support/check'
8   -require 'support/fake_record'
9   -require 'support/shared/tree_manager_shared'
10   -
11   -Spec::Runner.configure do |config|
12   - config.include Matchers
13   - config.include Check
14   -
15   - config.before do
16   - Arel::Table.engine = Arel::Sql::Engine.new(FakeRecord::Base.new)
17   - end
18   -end
6 spec/support/check.rb
... ... @@ -1,6 +0,0 @@
1   -module Check
2   - # This is used to eliminate Ruby warnings on some RSpec assertion lines
3   - # See: https://rspec.lighthouseapp.com/projects/5645/tickets/504
4   - def check(*args)
5   - end
6   -end
1  spec/support/matchers.rb
... ... @@ -1 +0,0 @@
1   -require "support/matchers/be_like"
24 spec/support/matchers/be_like.rb
... ... @@ -1,24 +0,0 @@
1   -module Matchers
2   - class BeLike
3   - def initialize(expected)
4   - @expected = expected.gsub(/\s+/, ' ').strip
5   - end
6   -
7   - def matches?(actual)
8   - @actual = actual.gsub(/\s+/, ' ').strip
9   - @expected == @actual
10   - end
11   -
12   - def failure_message
13   - "expected\n#{@actual}\nto be like\n#{@expected}"
14   - end
15   -
16   - def negative_failure_message
17   - "expected\n#{@actual}\nto be unlike\n#{@expected}"
18   - end
19   - end
20   -
21   - def be_like(expected)
22   - BeLike.new(expected)
23   - end
24   -end
166 spec/attributes/attribute_spec.rb → test/attributes/test_attribute.rb
@@ -6,14 +6,14 @@ module Attributes
6 6 describe '#not_eq' do
7 7 it 'should create a NotEqual node' do
8 8 relation = Table.new(:users)
9   - relation[:id].not_eq(10).should be_kind_of Nodes::NotEqual
  9 + relation[:id].not_eq(10).must_be_kind_of Nodes::NotEqual
10 10 end
11 11
12 12 it 'should generate != in sql' do
13 13 relation = Table.new(:users)
14 14 mgr = relation.project relation[:id]
15 15 mgr.where relation[:id].not_eq(10)
16   - mgr.to_sql.should be_like %{
  16 + mgr.to_sql.must_be_like %{
17 17 SELECT "users"."id" FROM "users" WHERE "users"."id" != 10
18 18 }
19 19 end
@@ -22,7 +22,7 @@ module Attributes
22 22 relation = Table.new(:users)
23 23 mgr = relation.project relation[:id]
24 24 mgr.where relation[:id].not_eq(nil)
25   - mgr.to_sql.should be_like %{
  25 + mgr.to_sql.must_be_like %{
26 26 SELECT "users"."id" FROM "users" WHERE "users"."id" IS NOT NULL
27 27 }
28 28 end
@@ -31,14 +31,14 @@ module Attributes
31 31 describe '#not_eq_any' do
32 32 it 'should create a Grouping node' do
33 33 relation = Table.new(:users)
34   - relation[:id].not_eq_any([1,2]).should be_kind_of Nodes::Grouping
  34 + relation[:id].not_eq_any([1,2]).must_be_kind_of Nodes::Grouping
35 35 end
36 36
37 37 it 'should generate ORs in sql' do
38 38 relation = Table.new(:users)
39 39 mgr = relation.project relation[:id]
40 40 mgr.where relation[:id].not_eq_any([1,2])
41   - mgr.to_sql.should be_like %{
  41 + mgr.to_sql.must_be_like %{
42 42 SELECT "users"."id" FROM "users" WHERE ("users"."id" != 1 OR "users"."id" != 2)
43 43 }
44 44 end
@@ -47,14 +47,14 @@ module Attributes
47 47 describe '#not_eq_all' do
48 48 it 'should create a Grouping node' do
49 49 relation = Table.new(:users)
50   - relation[:id].not_eq_all([1,2]).should be_kind_of Nodes::Grouping
  50 + relation[:id].not_eq_all([1,2]).must_be_kind_of Nodes::Grouping
51 51 end
52 52
53 53 it 'should generate ANDs in sql' do
54 54 relation = Table.new(:users)
55 55 mgr = relation.project relation[:id]
56 56 mgr.where relation[:id].not_eq_all([1,2])
57   - mgr.to_sql.should be_like %{
  57 + mgr.to_sql.must_be_like %{
58 58 SELECT "users"."id" FROM "users" WHERE ("users"."id" != 1 AND "users"."id" != 2)
59 59 }
60 60 end
@@ -63,14 +63,14 @@ module Attributes
63 63 describe '#gt' do
64 64 it 'should create a GreaterThan node' do
65 65 relation = Table.new(:users)
66   - relation[:id].gt(10).should be_kind_of Nodes::GreaterThan
  66 + relation[:id].gt(10).must_be_kind_of Nodes::GreaterThan
67 67 end
68 68
69 69 it 'should generate >= in sql' do
70 70 relation = Table.new(:users)
71 71 mgr = relation.project relation[:id]
72 72 mgr.where relation[:id].gt(10)
73   - mgr.to_sql.should be_like %{
  73 + mgr.to_sql.must_be_like %{
74 74 SELECT "users"."id" FROM "users" WHERE "users"."id" > 10
75 75 }
76 76 end
@@ -79,14 +79,14 @@ module Attributes
79 79 describe '#gt_any' do
80 80 it 'should create a Grouping node' do
81 81 relation = Table.new(:users)
82   - relation[:id].gt_any([1,2]).should be_kind_of Nodes::Grouping
  82 + relation[:id].gt_any([1,2]).must_be_kind_of Nodes::Grouping
83 83 end
84 84
85 85 it 'should generate ORs in sql' do
86 86 relation = Table.new(:users)
87 87 mgr = relation.project relation[:id]
88 88 mgr.where relation[:id].gt_any([1,2])
89   - mgr.to_sql.should be_like %{
  89 + mgr.to_sql.must_be_like %{
90 90 SELECT "users"."id" FROM "users" WHERE ("users"."id" > 1 OR "users"."id" > 2)
91 91 }
92 92 end
@@ -95,14 +95,14 @@ module Attributes
95 95 describe '#gt_all' do
96 96 it 'should create a Grouping node' do
97 97 relation = Table.new(:users)
98   - relation[:id].gt_all([1,2]).should be_kind_of Nodes::Grouping
  98 + relation[:id].gt_all([1,2]).must_be_kind_of Nodes::Grouping
99 99 end
100 100
101 101 it 'should generate ANDs in sql' do
102 102 relation = Table.new(:users)
103 103 mgr = relation.project relation[:id]
104 104 mgr.where relation[:id].gt_all([1,2])
105   - mgr.to_sql.should be_like %{
  105 + mgr.to_sql.must_be_like %{
106 106 SELECT "users"."id" FROM "users" WHERE ("users"."id" > 1 AND "users"."id" > 2)
107 107 }
108 108 end
@@ -111,14 +111,14 @@ module Attributes
111 111 describe '#gteq' do
112 112 it 'should create a GreaterThanOrEqual node' do
113 113 relation = Table.new(:users)
114   - relation[:id].gteq(10).should be_kind_of Nodes::GreaterThanOrEqual
  114 + relation[:id].gteq(10).must_be_kind_of Nodes::GreaterThanOrEqual
115 115 end
116 116
117 117 it 'should generate >= in sql' do
118 118 relation = Table.new(:users)
119 119 mgr = relation.project relation[:id]
120 120 mgr.where relation[:id].gteq(10)
121   - mgr.to_sql.should be_like %{
  121 + mgr.to_sql.must_be_like %{
122 122 SELECT "users"."id" FROM "users" WHERE "users"."id" >= 10
123 123 }
124 124 end
@@ -127,14 +127,14 @@ module Attributes
127 127 describe '#gteq_any' do
128 128 it 'should create a Grouping node' do
129 129 relation = Table.new(:users)
130   - relation[:id].gteq_any([1,2]).should be_kind_of Nodes::Grouping
  130 + relation[:id].gteq_any([1,2]).must_be_kind_of Nodes::Grouping
131 131 end
132 132
133 133 it 'should generate ORs in sql' do
134 134 relation = Table.new(:users)
135 135 mgr = relation.project relation[:id]
136 136 mgr.where relation[:id].gteq_any([1,2])
137   - mgr.to_sql.should be_like %{
  137 + mgr.to_sql.must_be_like %{
138 138 SELECT "users"."id" FROM "users" WHERE ("users"."id" >= 1 OR "users"."id" >= 2)
139 139 }
140 140 end
@@ -143,14 +143,14 @@ module Attributes
143 143 describe '#gteq_all' do
144 144 it 'should create a Grouping node' do
145 145 relation = Table.new(:users)
146   - relation[:id].gteq_all([1,2]).should be_kind_of Nodes::Grouping
  146 + relation[:id].gteq_all([1,2]).must_be_kind_of Nodes::Grouping
147 147 end
148 148
149 149 it 'should generate ANDs in sql' do
150 150 relation = Table.new(:users)
151 151 mgr = relation.project relation[:id]
152 152 mgr.where relation[:id].gteq_all([1,2])
153   - mgr.to_sql.should be_like %{
  153 + mgr.to_sql.must_be_like %{
154 154 SELECT "users"."id" FROM "users" WHERE ("users"."id" >= 1 AND "users"."id" >= 2)
155 155 }
156 156 end
@@ -159,14 +159,14 @@ module Attributes
159 159 describe '#lt' do
160 160 it 'should create a LessThan node' do
161 161 relation = Table.new(:users)
162   - relation[:id].lt(10).should be_kind_of Nodes::LessThan
  162 + relation[:id].lt(10).must_be_kind_of Nodes::LessThan
163 163 end
164 164
165 165 it 'should generate < in sql' do
166 166 relation = Table.new(:users)
167 167 mgr = relation.project relation[:id]
168 168 mgr.where relation[:id].lt(10)
169   - mgr.to_sql.should be_like %{
  169 + mgr.to_sql.must_be_like %{
170 170 SELECT "users"."id" FROM "users" WHERE "users"."id" < 10
171 171 }
172 172 end
@@ -175,14 +175,14 @@ module Attributes
175 175 describe '#lt_any' do
176 176 it 'should create a Grouping node' do
177 177 relation = Table.new(:users)
178   - relation[:id].lt_any([1,2]).should be_kind_of Nodes::Grouping
  178 + relation[:id].lt_any([1,2]).must_be_kind_of Nodes::Grouping
179 179 end
180 180
181 181 it 'should generate ORs in sql' do
182 182 relation = Table.new(:users)
183 183 mgr = relation.project relation[:id]
184 184 mgr.where relation[:id].lt_any([1,2])
185   - mgr.to_sql.should be_like %{
  185 + mgr.to_sql.must_be_like %{
186 186 SELECT "users"."id" FROM "users" WHERE ("users"."id" < 1 OR "users"."id" < 2)
187 187 }
188 188 end
@@ -191,14 +191,14 @@ module Attributes
191 191 describe '#lt_all' do
192 192 it 'should create a Grouping node' do
193 193 relation = Table.new(:users)
194   - relation[:id].lt_all([1,2]).should be_kind_of Nodes::Grouping
  194 + relation[:id].lt_all([1,2]).must_be_kind_of Nodes::Grouping
195 195 end
196 196
197 197 it 'should generate ANDs in sql' do
198 198 relation = Table.new(:users)
199 199 mgr = relation.project relation[:id]
200 200 mgr.where relation[:id].lt_all([1,2])
201   - mgr.to_sql.should be_like %{
  201 + mgr.to_sql.must_be_like %{
202 202 SELECT "users"."id" FROM "users" WHERE ("users"."id" < 1 AND "users"."id" < 2)
203 203 }
204 204 end
@@ -207,14 +207,14 @@ module Attributes
207 207 describe '#lteq' do
208 208 it 'should create a LessThanOrEqual node' do
209 209 relation = Table.new(:users)
210   - relation[:id].lteq(10).should be_kind_of Nodes::LessThanOrEqual
  210 + relation[:id].lteq(10).must_be_kind_of Nodes::LessThanOrEqual
211 211 end
212 212
213 213 it 'should generate <= in sql' do
214 214 relation = Table.new(:users)
215 215 mgr = relation.project relation[:id]
216 216 mgr.where relation[:id].lteq(10)
217   - mgr.to_sql.should be_like %{
  217 + mgr.to_sql.must_be_like %{
218 218 SELECT "users"."id" FROM "users" WHERE "users"."id" <= 10
219 219 }
220 220 end
@@ -223,14 +223,14 @@ module Attributes
223 223 describe '#lteq_any' do
224 224 it 'should create a Grouping node' do
225 225 relation = Table.new(:users)
226   - relation[:id].lteq_any([1,2]).should be_kind_of Nodes::Grouping
  226 + relation[:id].lteq_any([1,2]).must_be_kind_of Nodes::Grouping
227 227 end
228 228
229 229 it 'should generate ORs in sql' do
230 230 relation = Table.new(:users)
231 231 mgr = relation.project relation[:id]
232 232 mgr.where relation[:id].lteq_any([1,2])
233   - mgr.to_sql.should be_like %{
  233 + mgr.to_sql.must_be_like %{
234 234 SELECT "users"."id" FROM "users" WHERE ("users"."id" <= 1 OR "users"."id" <= 2)
235 235 }
236 236 end
@@ -239,14 +239,14 @@ module Attributes
239 239 describe '#lteq_all' do
240 240 it 'should create a Grouping node' do
241 241 relation = Table.new(:users)
242   - relation[:id].lteq_all([1,2]).should be_kind_of Nodes::Grouping
  242 + relation[:id].lteq_all([1,2]).must_be_kind_of Nodes::Grouping
243 243 end
244 244
245 245 it 'should generate ANDs in sql' do
246 246 relation = Table.new(:users)
247 247 mgr = relation.project relation[:id]
248 248 mgr.where relation[:id].lteq_all([1,2])
249   - mgr.to_sql.should be_like %{
  249 + mgr.to_sql.must_be_like %{
250 250 SELECT "users"."id" FROM "users" WHERE ("users"."id" <= 1 AND "users"."id" <= 2)
251 251 }
252 252 end
@@ -255,14 +255,14 @@ module Attributes
255 255 describe '#average' do
256 256 it 'should create a AVG node' do
257 257 relation = Table.new(:users)
258   - relation[:id].average.should be_kind_of Nodes::Avg
  258 + relation[:id].average.must_be_kind_of Nodes::Avg
259 259 end
260 260
261 261 # FIXME: backwards compat. Is this really necessary?
262 262 it 'should set the alias to "avg_id"' do
263 263 relation = Table.new(:users)
264 264 mgr = relation.project relation[:id].average
265   - mgr.to_sql.should be_like %{
  265 + mgr.to_sql.must_be_like %{
266 266 SELECT AVG("users"."id") AS avg_id
267 267 FROM "users"
268 268 }
@@ -272,14 +272,14 @@ module Attributes
272 272 describe '#maximum' do
273 273 it 'should create a MAX node' do
274 274 relation = Table.new(:users)
275   - relation[:id].maximum.should be_kind_of Nodes::Max
  275 + relation[:id].maximum.must_be_kind_of Nodes::Max
276 276 end
277 277
278 278 # FIXME: backwards compat. Is this really necessary?
279 279 it 'should set the alias to "max_id"' do
280 280 relation = Table.new(:users)
281 281 mgr = relation.project relation[:id].maximum
282   - mgr.to_sql.should be_like %{
  282 + mgr.to_sql.must_be_like %{
283 283 SELECT MAX("users"."id") AS max_id
284 284 FROM "users"
285 285 }
@@ -289,21 +289,21 @@ module Attributes
289 289 describe '#minimum' do
290 290 it 'should create a Min node' do
291 291 relation = Table.new(:users)
292   - relation[:id].minimum.should be_kind_of Nodes::Min
  292 + relation[:id].minimum.must_be_kind_of Nodes::Min
293 293 end
294 294 end
295 295
296 296 describe '#sum' do
297 297 it 'should create a SUM node' do
298 298 relation = Table.new(:users)
299   - relation[:id].sum.should be_kind_of Nodes::Sum
  299 + relation[:id].sum.must_be_kind_of Nodes::Sum
300 300 end
301 301
302 302 # FIXME: backwards compat. Is this really necessary?
303 303 it 'should set the alias to "sum_id"' do
304 304 relation = Table.new(:users)
305 305 mgr = relation.project relation[:id].sum
306   - mgr.to_sql.should be_like %{
  306 + mgr.to_sql.must_be_like %{
307 307 SELECT SUM("users"."id") AS sum_id
308 308 FROM "users"
309 309 }
@@ -313,14 +313,14 @@ module Attributes
313 313 describe '#count' do
314 314 it 'should return a count node' do
315 315 relation = Table.new(:users)
316   - relation[:id].count.should be_kind_of Nodes::Count
  316 + relation[:id].count.must_be_kind_of Nodes::Count
317 317 end
318 318
319 319 it 'should take a distinct param' do
320 320 relation = Table.new(:users)
321 321 count = relation[:id].count(nil)
322   - count.should be_kind_of Nodes::Count
323   - count.distinct.should be_nil
  322 + count.must_be_kind_of Nodes::Count
  323 + count.distinct.must_be_nil
324 324 end
325 325 end
326 326
@@ -328,16 +328,16 @@ module Attributes
328 328 it 'should return an equality node' do
329 329 attribute = Attribute.new nil, nil, nil
330 330 equality = attribute.eq 1
331   - check equality.left.should == attribute
332   - check equality.right.should == 1
333   - equality.should be_kind_of Nodes::Equality
  331 + check equality.left.must_equal attribute
  332 + check equality.right.must_equal 1
  333 + equality.must_be_kind_of Nodes::Equality
334 334 end
335 335
336 336 it 'should generate = in sql' do
337 337 relation = Table.new(:users)
338 338 mgr = relation.project relation[:id]
339 339 mgr.where relation[:id].eq(10)
340   - mgr.to_sql.should be_like %{
  340 + mgr.to_sql.must_be_like %{
341 341 SELECT "users"."id" FROM "users" WHERE "users"."id" = 10
342 342 }
343 343 end
@@ -346,7 +346,7 @@ module Attributes
346 346 relation = Table.new(:users)
347 347 mgr = relation.project relation[:id]
348 348 mgr.where relation[:id].eq(nil)
349   - mgr.to_sql.should be_like %{
  349 + mgr.to_sql.must_be_like %{
350 350 SELECT "users"."id" FROM "users" WHERE "users"."id" IS NULL
351 351 }
352 352 end
@@ -355,14 +355,14 @@ module Attributes
355 355 describe '#eq_any' do
356 356 it 'should create a Grouping node' do
357 357 relation = Table.new(:users)
358   - relation[:id].eq_any([1,2]).should be_kind_of Nodes::Grouping
  358 + relation[:id].eq_any([1,2]).must_be_kind_of Nodes::Grouping
359 359 end
360 360
361 361 it 'should generate ORs in sql' do
362 362 relation = Table.new(:users)
363 363 mgr = relation.project relation[:id]
364 364 mgr.where relation[:id].eq_any([1,2])
365   - mgr.to_sql.should be_like %{
  365 + mgr.to_sql.must_be_like %{
366 366 SELECT "users"."id" FROM "users" WHERE ("users"."id" = 1 OR "users"."id" = 2)
367 367 }
368 368 end
@@ -371,14 +371,14 @@ module Attributes
371 371 describe '#eq_all' do
372 372 it 'should create a Grouping node' do
373 373 relation = Table.new(:users)
374   - relation[:id].eq_all([1,2]).should be_kind_of Nodes::Grouping
  374 + relation[:id].eq_all([1,2]).must_be_kind_of Nodes::Grouping
375 375 end
376 376
377 377 it 'should generate ANDs in sql' do
378 378 relation = Table.new(:users)
379 379 mgr = relation.project relation[:id]
380 380 mgr.where relation[:id].eq_all([1,2])
381   - mgr.to_sql.should be_like %{
  381 + mgr.to_sql.must_be_like %{
382 382 SELECT "users"."id" FROM "users" WHERE ("users"."id" = 1 AND "users"."id" = 2)
383 383 }
384 384 end
@@ -387,14 +387,14 @@ module Attributes
387 387 describe '#matches' do
388 388 it 'should create a Matches node' do
389 389 relation = Table.new(:users)
390   - relation[:name].matches('%bacon%').should be_kind_of Nodes::Matches
  390 + relation[:name].matches('%bacon%').must_be_kind_of Nodes::Matches
391 391 end
392 392
393 393 it 'should generate LIKE in sql' do
394 394 relation = Table.new(:users)
395 395 mgr = relation.project relation[:id]
396 396 mgr.where relation[:name].matches('%bacon%')
397   - mgr.to_sql.should be_like %{
  397 + mgr.to_sql.must_be_like %{
398 398 SELECT "users"."id" FROM "users" WHERE "users"."name" LIKE '%bacon%'
399 399 }
400 400 end
@@ -403,14 +403,14 @@ module Attributes
403 403 describe '#matches_any' do
404 404 it 'should create a Grouping node' do
405 405 relation = Table.new(:users)
406   - relation[:name].matches_any(['%chunky%','%bacon%']).should be_kind_of Nodes::Grouping
  406 + relation[:name].matches_any(['%chunky%','%bacon%']).must_be_kind_of Nodes::Grouping
407 407 end
408 408
409 409 it 'should generate ORs in sql' do
410 410 relation = Table.new(:users)
411 411 mgr = relation.project relation[:id]
412 412 mgr.where relation[:name].matches_any(['%chunky%','%bacon%'])
413   - mgr.to_sql.should be_like %{
  413 + mgr.to_sql.must_be_like %{
414 414 SELECT "users"."id" FROM "users" WHERE ("users"."name" LIKE '%chunky%' OR "users"."name" LIKE '%bacon%')
415 415 }
416 416 end
@@ -419,14 +419,14 @@ module Attributes
419 419 describe '#matches_all' do
420 420 it 'should create a Grouping node' do
421 421 relation = Table.new(:users)
422   - relation[:name].matches_all(['%chunky%','%bacon%']).should be_kind_of Nodes::Grouping
  422 + relation[:name].matches_all(['%chunky%','%bacon%']).must_be_kind_of Nodes::Grouping
423 423 end
424 424
425 425 it 'should generate ANDs in sql' do
426 426 relation = Table.new(:users)
427 427 mgr = relation.project relation[:id]
428 428 mgr.where relation[:name].matches_all(['%chunky%','%bacon%'])
429   - mgr.to_sql.should be_like %{
  429 + mgr.to_sql.must_be_like %{
430 430 SELECT "users"."id" FROM "users" WHERE ("users"."name" LIKE '%chunky%' AND "users"."name" LIKE '%bacon%')
431 431 }
432 432 end
@@ -435,14 +435,14 @@ module Attributes
435 435 describe '#does_not_match' do
436 436 it 'should create a DoesNotMatch node' do
437 437 relation = Table.new(:users)
438   - relation[:name].does_not_match('%bacon%').should be_kind_of Nodes::DoesNotMatch
  438 + relation[:name].does_not_match('%bacon%').must_be_kind_of Nodes::DoesNotMatch
439 439 end
440 440
441 441 it 'should generate NOT LIKE in sql' do
442 442 relation = Table.new(:users)
443 443 mgr = relation.project relation[:id]
444 444 mgr.where relation[:name].does_not_match('%bacon%')
445   - mgr.to_sql.should be_like %{
  445 + mgr.to_sql.must_be_like %{
446 446 SELECT "users"."id" FROM "users" WHERE "users"."name" NOT LIKE '%bacon%'
447 447 }
448 448 end
@@ -451,14 +451,14 @@ module Attributes
451 451 describe '#does_not_match_any' do
452 452 it 'should create a Grouping node' do
453 453 relation = Table.new(:users)
454   - relation[:name].does_not_match_any(['%chunky%','%bacon%']).should be_kind_of Nodes::Grouping
  454 + relation[:name].does_not_match_any(['%chunky%','%bacon%']).must_be_kind_of Nodes::Grouping
455 455 end
456 456
457 457 it 'should generate ORs in sql' do
458 458 relation = Table.new(:users)
459 459 mgr = relation.project relation[:id]
460 460 mgr.where relation[:name].does_not_match_any(['%chunky%','%bacon%'])
461   - mgr.to_sql.should be_like %{
  461 + mgr.to_sql.must_be_like %{
462 462 SELECT "users"."id" FROM "users" WHERE ("users"."name" NOT LIKE '%chunky%' OR "users"."name" NOT LIKE '%bacon%')
463 463 }
464 464 end
@@ -467,14 +467,14 @@ module Attributes
467 467 describe '#does_not_match_all' do
468 468 it 'should create a Grouping node' do
469 469 relation = Table.new(:users)
470   - relation[:name].does_not_match_all(['%chunky%','%bacon%']).should be_kind_of Nodes::Grouping
  470 + relation[:name].does_not_match_all(['%chunky%','%bacon%']).must_be_kind_of Nodes::Grouping
471 471 end
472 472
473 473 it 'should generate ANDs in sql' do
474 474 relation = Table.new(:users)
475 475 mgr = relation.project relation[:id]
476 476 mgr.where relation[:name].does_not_match_all(['%chunky%','%bacon%'])
477   - mgr.to_sql.should be_like %{
  477 + mgr.to_sql.must_be_like %{
478 478 SELECT "users"."id" FROM "users" WHERE ("users"."name" NOT LIKE '%chunky%' AND "users"."name" NOT LIKE '%bacon%')
479 479 }
480 480 end
@@ -487,15 +487,15 @@ module Attributes
487 487 it 'should return an in node' do
488 488 attribute = Attribute.new nil, nil, nil
489 489 node = Nodes::In.new attribute, [1,2,3]
490   - check node.left.should == attribute
491   - check node.right.should == [1, 2, 3]
  490 + check node.left.must_equal attribute
  491 + check node.right.must_equal [1, 2, 3]
492 492 end
493 493
494 494 it 'should generate IN in sql' do
495 495 relation = Table.new(:users)
496 496 mgr = relation.project relation[:id]
497 497 mgr.where relation[:id].in([1,2,3])
498   - mgr.to_sql.should be_like %{
  498 + mgr.to_sql.must_be_like %{
499 499 SELECT "users"."id" FROM "users" WHERE "users"."id" IN (1, 2, 3)
500 500 }
501 501 end
@@ -504,14 +504,14 @@ module Attributes
504 504 describe '#in_any' do
505 505 it 'should create a Grouping node' do
506 506 relation = Table.new(:users)
507   - relation[:id].in_any([1,2]).should be_kind_of Nodes::Grouping
  507 + relation[:id].in_any([1,2]).must_be_kind_of Nodes::Grouping
508 508 end
509 509
510 510 it 'should generate ORs in sql' do
511 511 relation = Table.new(:users)
512 512 mgr = relation.project relation[:id]
513 513 mgr.where relation[:id].in_any([[1,2], [3,4]])
514   - mgr.to_sql.should be_like %{
  514 + mgr.to_sql.must_be_like %{
515 515 SELECT "users"."id" FROM "users" WHERE ("users"."id" IN (1, 2) OR "users"."id" IN (3, 4))
516 516 }
517 517 end
@@ -520,14 +520,14 @@ module Attributes
520 520 describe '#in_all' do
521 521 it 'should create a Grouping node' do
522 522 relation = Table.new(:users)
523   - relation[:id].in_all([1,2]).should be_kind_of Nodes::Grouping
  523 + relation[:id].in_all([1,2]).must_be_kind_of Nodes::Grouping
524 524 end
525 525
526 526 it 'should generate ANDs in sql' do
527 527 relation = Table.new(:users)
528 528 mgr = relation.project relation[:id]
529 529 mgr.where relation[:id].in_all([[1,2], [3,4]])
530   - mgr.to_sql.should be_like %{
  530 + mgr.to_sql.must_be_like %{
531 531 SELECT "users"."id" FROM "users" WHERE ("users"."id" IN (1, 2) AND "users"."id" IN (3, 4))
532 532 }
533 533 end
@@ -540,15 +540,15 @@ module Attributes
540 540 it 'should return a NotIn node' do
541 541 attribute = Attribute.new nil, nil, nil
542 542 node = Nodes::NotIn.new attribute, [1,2,3]
543   - check node.left.should == attribute
544   - check node.right.should == [1, 2, 3]
  543 + check node.left.must_equal attribute
  544 + check node.right.must_equal [1, 2, 3]
545 545 end
546 546
547 547 it 'should generate NOT IN in sql' do
548 548 relation = Table.new(:users)
549 549 mgr = relation.project relation[:id]
550 550 mgr.where relation[:id].not_in([1,2,3])
551   - mgr.to_sql.should be_like %{
  551 + mgr.to_sql.must_be_like %{
552 552 SELECT "users"."id" FROM "users" WHERE "users"."id" NOT IN (1, 2, 3)
553 553 }
554 554 end
@@ -557,14 +557,14 @@ module Attributes
557 557 describe '#not_in_any' do
558 558 it 'should create a Grouping node' do
559 559 relation = Table.new(:users)
560   - relation[:id].not_in_any([1,2]).should be_kind_of Nodes::Grouping
  560 + relation[:id].not_in_any([1,2]).must_be_kind_of Nodes::Grouping
561 561 end
562 562
563 563 it 'should generate ORs in sql' do
564 564 relation = Table.new(:users)
565 565 mgr = relation.project relation[:id]
566 566 mgr.where relation[:id].not_in_any([[1,2], [3,4]])
567   - mgr.to_sql.should be_like %{
  567 + mgr.to_sql.must_be_like %{
568 568 SELECT "users"."id" FROM "users" WHERE ("users"."id" NOT IN (1, 2) OR "users"."id" NOT IN (3, 4))
569 569 }
570 570 end
@@ -573,14 +573,14 @@ module Attributes
573 573 describe '#not_in_all' do
574 574 it 'should create a Grouping node' do
575 575 relation = Table.new(:users)
576   - relation[:id].not_in_all([1,2]).should be_kind_of Nodes::Grouping
  576 + relation[:id].not_in_all([1,2]).must_be_kind_of Nodes::Grouping
577 577 end
578 578
579 579 it 'should generate ANDs in sql' do
580 580 relation = Table.new(:users)
581 581 mgr = relation.project relation[:id]
582 582 mgr.where relation[:id].not_in_all([[1,2], [3,4]])
583   - mgr.to_sql.should be_like %{
  583 + mgr.to_sql.must_be_like %{
584 584 SELECT "users"."id" FROM "users" WHERE ("users"."id" NOT IN (1, 2) AND "users"."id" NOT IN (3, 4))
585 585 }
586 586 end
@@ -589,14 +589,14 @@ module Attributes
589 589 describe '#eq_all' do
590 590 it 'should create a Grouping node' do
591 591 relation = Table.new(:users)
592   - relation[:id].eq_all([1,2]).should be_kind_of Nodes::Grouping
  592 + relation[:id].eq_all([1,2]).must_be_kind_of Nodes::Grouping
593 593 end
594 594
595 595 it 'should generate ANDs in sql' do
596 596 relation = Table.new(:users)
597 597 mgr = relation.project relation[:id]
598 598 mgr.where relation[:id].eq_all([1,2])
599   - mgr.to_sql.should be_like %{
  599 + mgr.to_sql.must_be_like %{
600 600 SELECT "users"."id" FROM "users" WHERE ("users"."id" = 1 AND "users"."id" = 2)
601 601 }
602 602 end
@@ -605,14 +605,14 @@ module Attributes
605 605 describe '#asc' do
606 606 it 'should create an Ordering node' do
607 607 relation = Table.new(:users)
608   - relation[:id].asc.should be_kind_of Nodes::Ordering
  608 + relation[:id].asc.must_be_kind_of Nodes::Ordering
609 609 end
610 610
611 611 it 'should generate ASC in sql' do
612 612 relation = Table.new(:users)
613 613 mgr = relation.project relation[:id]
614 614 mgr.order relation[:id].asc
615   - mgr.to_sql.should be_like %{
  615 + mgr.to_sql.must_be_like %{
616 616 SELECT "users"."id" FROM "users" ORDER BY "users"."id" ASC
617 617 }
618 618 end
@@ -621,14 +621,14 @@ module Attributes
621 621 describe '#desc' do
622 622 it 'should create an Ordering node' do
623 623 relation = Table.new(:users)
624   - relation[:id].desc.should be_kind_of Nodes::Ordering
  624 + relation[:id].desc.must_be_kind_of Nodes::Ordering
625 625 end
626 626
627 627 it 'should generate DESC in sql' do
628 628 relation = Table.new(:users)
629 629 mgr = relation.project relation[:id]
630 630 mgr.order relation[:id].desc
631   - mgr.to_sql.should be_like %{
  631 + mgr.to_sql.must_be_like %{
632 632 SELECT "users"."id" FROM "users" ORDER BY "users"."id" DESC
633 633 }
634 634 end
@@ -640,7 +640,7 @@ module Attributes
640 640 it 'should produce sql' do
641 641 table = Table.new :users
642 642 condition = table['id'].eq 1
643   - condition.to_sql.should == '"users"."id" = 1'
  643 + condition.to_sql.must_equal '"users"."id" = 1'
644 644 end
645 645 end
646 646 end
4 spec/nodes/count_spec.rb → test/nodes/test_count.rb
@@ -3,14 +3,14 @@
3 3 describe Arel::Nodes::Count do
4 4 describe 'backwards compatibility' do
5 5 it 'must be an expression' do
6   - Arel::Nodes::Count.new('foo').should be_kind_of Arel::Expression
  6 + Arel::Nodes::Count.new('foo').must_be_kind_of Arel::Expression
7 7 end
8 8 end
9 9
10 10 describe "as" do
11 11 it 'should alias the count' do
12 12 table = Arel::Table.new :users
13   - table[:id].count.as('foo').to_sql.should be_like %{
  13 + table[:id].count.as('foo').to_sql.must_be_like %{
14 14 COUNT("users"."id") AS foo
15 15 }
16 16 end
5 spec/nodes/delete_statement_spec.rb → test/nodes/test_delete_statement.rb
@@ -6,10 +6,9 @@
6 6 statement = Arel::Nodes::DeleteStatement.new
7 7 statement.wheres = %w[a b c]
8 8
9   - statement.wheres.should_receive(:clone).and_return([:wheres])
10   -
11 9 dolly = statement.clone
12   - dolly.wheres.should == [:wheres]
  10 + dolly.wheres.must_equal statement.wheres
  11 + dolly.wheres.wont_be_same_as statement.wheres
13 12 end
14 13 end
15 14 end
18 spec/nodes/equality_spec.rb → test/nodes/test_equality.rb
... ... @@ -1,3 +1,5 @@
  1 +require 'spec_helper'
  2 +
1 3 module Arel
2 4 module Nodes
3 5 describe 'equality' do
@@ -7,7 +9,7 @@ module Nodes
7 9 it 'returns :==' do
8 10 attr = Table.new(:users)[:id]
9 11 left = attr.eq(10)
10   - check left.operator.should == :==
  12 + check left.operator.must_equal :==
11 13 end
12 14 end
13 15
@@ -15,7 +17,7 @@ module Nodes
15 17 it "should equal left" do
16 18 attr = Table.new(:users)[:id]
17 19 left = attr.eq(10)
18   - check left.left.should == left.operand1
  20 + check left.left.must_equal left.operand1
19 21 end
20 22 end
21 23
@@ -23,7 +25,7 @@ module Nodes
23 25 it "should equal right" do
24 26 attr = Table.new(:users)[:id]
25 27 left = attr.eq(10)
26   - check left.right.should == left.operand2
  28 + check left.right.must_equal left.operand2
27 29 end
28 30 end
29 31
@@ -41,7 +43,7 @@ def quote_table_name(*args) @quote_count += 1; super; end
41 43 attr = Table.new(:users)[:id]
42 44 test = attr.eq(10)
43 45 test.to_sql engine
44   - check engine.connection.quote_count.should == 2
  46 + check engine.connection.quote_count.must_equal 2
45 47 end
46 48 end
47 49 end
@@ -52,8 +54,8 @@ def quote_table_name(*args) @quote_count += 1; super; end
52 54 left = attr.eq(10)
53 55 right = attr.eq(11)
54 56 node = left.or right
55   - check node.expr.left.should == left
56   - check node.expr.right.should == right
  57 + check node.expr.left.must_equal left
  58 + check node.expr.right.must_equal right
57 59 end
58 60 end
59 61
@@ -63,8 +65,8 @@ def quote_table_name(*args) @quote_count += 1; super; end
63 65 left = attr.eq(10)
64 66 right = attr.eq(11)
65 67 node = left.and right
66   - check node.left.should == left
67   - check node.right.should == right
  68 + check node.left.must_equal left
  69 + check node.right.must_equal right
68 70 end
69 71 end
70 72 end
10 spec/nodes/insert_statement_spec.rb → test/nodes/test_insert_statement.rb
@@ -7,12 +7,12 @@
7 7 statement.columns = %w[a b c]
8 8 statement.values = %w[x y z]
9 9
10   - statement.columns.should_receive(:clone).and_return([:columns])
11   - statement.values.should_receive(:clone).and_return([:values])
12   -
13 10 dolly = statement.clone
14   - check dolly.columns.should == [:columns]
15   - check dolly.values.should == [:values]
  11 + dolly.columns.must_equal statement.columns
  12 + dolly.values.must_equal statement.values
  13 +
  14 + dolly.columns.wont_be_same_as statement.columns
  15 + dolly.values.wont_be_same_as statement.values
16 16 end
17 17 end
18 18 end
10 spec/nodes/or_spec.rb → test/nodes/test_or.rb
... ... @@ -1,3 +1,5 @@
  1 +require 'spec_helper'
  2 +
1 3 module Arel
2 4 module Nodes
3 5 describe 'or' do
@@ -7,12 +9,12 @@ module Nodes
7 9 left = attr.eq(10)
8 10 right = attr.eq(11)
9 11 node = left.or right
10   - check node.expr.left.should == left
11   - check node.expr.right.should == right
  12 + check node.expr.left.must_equal left
  13 + check node.expr.right.must_equal right
12 14
13 15 oror = node.or(right)
14   - check oror.expr.left == node
15   - check oror.expr.right == right
  16 + check oror.expr.left.must_equal node
  17 + check oror.expr.right.must_equal right
16 18 end
17 19 end
18 20 end
22 test/nodes/test_select_core.rb
... ... @@ -0,0 +1,22 @@
  1 +require 'spec_helper'
  2 +
  3 +describe Arel::Nodes::SelectCore do
  4 + describe "#clone" do
  5 + it "clones froms, projections and wheres" do
  6 + core = Arel::Nodes::SelectCore.new
  7 + core.froms = %w[a b c]
  8 + core.projections = %w[d e f]
  9 + core.wheres = %w[g h i]
  10 +
  11 + dolly = core.clone
  12 +
  13 + dolly.froms.must_equal core.froms
  14 + dolly.projections.must_equal core.projections
  15 + dolly.wheres.must_equal core.wheres
  16 +
  17 + dolly.froms.wont_be_same_as core.froms
  18 + dolly.projections.wont_be_same_as core.projections
  19 + dolly.wheres.wont_be_same_as core.wheres
  20 + end
  21 + end
  22 +end
5 spec/nodes/select_statement_spec.rb → test/nodes/test_select_statement.rb
@@ -5,10 +5,9 @@
5 5 it "clones cores" do
6 6 statement = Arel::Nodes::SelectStatement.new %w[a b c]
7 7
8   - statement.cores.map { |x| x.should_receive(:clone).and_return(:f) }
9   -
10 8 dolly = statement.clone
11   - dolly.cores.should == [:f, :f, :f]
  9 + dolly.cores.must_equal statement.cores
  10 + dolly.cores.wont_be_same_as statement.cores
12 11 end
13 12 end
14 13 end
8 spec/nodes/sql_literal_spec.rb → test/nodes/test_sql_literal.rb
... ... @@ -1,10 +1,12 @@
  1 +require 'spec_helper'
  2 +
1 3 module Arel
2 4 module Nodes
3 5 describe 'sql literal' do
4 6 describe 'sql' do
5 7 it 'makes a sql literal node' do
6 8 sql = Arel.sql 'foo'
7   - sql.should be_kind_of Arel::Nodes::SqlLiteral
  9 + sql.must_be_kind_of Arel::Nodes::SqlLiteral
8 10 end
9 11 end
10 12
@@ -12,13 +14,13 @@ module Nodes
12 14 it 'makes a count node' do
13 15 node = SqlLiteral.new('*').count
14 16 viz = Visitors::ToSql.new Table.engine
15   - viz.accept(node).should be_like %{ COUNT(*) }
  17 + viz.accept(node).must_be_like %{ COUNT(*) }
16 18 end
17 19
18 20 it 'makes a distinct node' do
19 21 node = SqlLiteral.new('*').count true
20 22 viz = Visitors::ToSql.new Table.engine
21   - viz.accept(node).should be_like %{ COUNT(DISTINCT *) }
  23 + viz.accept(node).must_be_like %{ COUNT(DISTINCT *) }
22 24 end
23 25 end
24 26 end
2  spec/nodes/sum_spec.rb → test/nodes/test_sum.rb
@@ -4,7 +4,7 @@
4 4 describe "as" do
5 5 it 'should alias the sum' do
6 6 table = Arel::Table.new :users
7   - table[:id].sum.as('foo').to_sql.should be_like %{
  7 + table[:id].sum.as('foo').to_sql.must_be_like %{
8 8 SUM("users"."id") AS foo
9 9 }
10 10 end
10 spec/nodes/update_statement_spec.rb → test/nodes/test_update_statement.rb
@@ -7,12 +7,12 @@
7 7 statement.wheres = %w[a b c]
8 8 statement.values = %w[x y z]
9 9
10   - statement.wheres.should_receive(:clone).and_return([:wheres])
11   - statement.values.should_receive(:clone).and_return([:values])
12   -
13 10 dolly = statement.clone
14   - check dolly.wheres.should == [:wheres]
15   - check dolly.values.should == [:values]
  11 + dolly.wheres.must_equal statement.wheres
  12 + dolly.wheres.wont_be_same_as statement.wheres
  13 +
  14 + dolly.values.must_equal statement.values
  15 + dolly.values.wont_be_same_as statement.values
16 16 end
17 17 end
18 18 end
21 test/spec_helper.rb
... ... @@ -0,0 +1,21 @@
  1 +require 'rubygems'
  2 +require 'minitest/autorun'
  3 +require 'fileutils'
  4 +require 'arel'
  5 +
  6 +require 'support/fake_record'
  7 +Arel::Table.engine = Arel::Sql::Engine.new(FakeRecord::Base.new)
  8 +
  9 +# HACK require 'support/shared/tree_manager_shared'
  10 +
  11 +class Object
  12 + def must_be_like other
  13 + self.gsub(/\s+/, ' ').strip.must_equal other.gsub(/\s+/, ' ').strip
  14 + end
  15 +
  16 + # TODO: remove
  17 + def check truthiness
  18 + raise "not truthy" unless truthiness
  19 + end
  20 +end
  21 +
0  spec/support/fake_record.rb → test/support/fake_record.rb
File renamed without changes
2  spec/activerecord_compat_spec.rb → test/test_activerecord_compat.rb
@@ -11,7 +11,7 @@ module Arel
11 11
12 12 check manager.wheres.map { |x|
13 13 x.value
14   - }.join(', ').should == "\"users\".\"id\" = 1, \"users\".\"name\" = 'Aaron'"
  14 + }.join(', ').must_equal "\"users\".\"id\" = 1, \"users\".\"name\" = 'Aaron'"
15 15 end
16 16 end
17 17 end
12 spec/attributes_spec.rb → test/test_attributes.rb
@@ -6,34 +6,34 @@ module Arel
6 6 it 'returns the correct constant for strings' do
7 7 [:string, :text, :binary].each do |type|
8 8 column = Struct.new(:type).new type
9   - Attributes.for(column).should == Attributes::String
  9 + Attributes.for(column).must_equal Attributes::String
10 10 end
11 11 end
12 12
13 13 it 'returns the correct constant for ints' do
14 14 column = Struct.new(:type).new :integer
15   - Attributes.for(column).should == Attributes::Integer
  15 + Attributes.for(column).must_equal Attributes::Integer
16 16 end
17 17
18 18 it 'returns the correct constant for floats' do
19 19 column = Struct.new(:type).new :float
20   - Attributes.for(column).should == Attributes::Float
  20 + Attributes.for(column).must_equal Attributes::Float
21 21 end
22 22
23 23 it 'returns the correct constant for decimals' do
24 24 column = Struct.new(:type).new :decimal
25   - Attributes.for(column).should == Attributes::Decimal
  25 + Attributes.for(column).must_equal Attributes::Decimal