arel 0.1.0 → 0.1.2

Sign up to get free protection for your applications and to get access to all the features.
Files changed (96) hide show
  1. data/.gitmodules +3 -0
  2. data/README.markdown +26 -26
  3. data/Rakefile +34 -46
  4. data/Thorfile +122 -0
  5. data/arel.gemspec +205 -201
  6. data/lib/arel.rb +11 -7
  7. data/lib/arel/algebra.rb +7 -2
  8. data/lib/arel/algebra/{primitives/attribute.rb → attribute.rb} +7 -7
  9. data/lib/arel/algebra/core_extensions.rb +4 -0
  10. data/lib/arel/algebra/{extensions → core_extensions}/class.rb +2 -2
  11. data/lib/arel/algebra/{extensions → core_extensions}/hash.rb +1 -1
  12. data/lib/arel/algebra/{extensions → core_extensions}/object.rb +1 -1
  13. data/lib/arel/algebra/{extensions → core_extensions}/symbol.rb +1 -1
  14. data/lib/arel/algebra/{primitives/expression.rb → expression.rb} +0 -0
  15. data/lib/arel/algebra/{primitives/ordering.rb → ordering.rb} +1 -1
  16. data/lib/arel/algebra/predicates.rb +32 -30
  17. data/lib/arel/algebra/relations/relation.rb +1 -1
  18. data/lib/arel/algebra/{primitives/value.rb → value.rb} +0 -0
  19. data/lib/arel/engines/memory/predicates.rb +26 -24
  20. data/lib/arel/engines/sql.rb +1 -1
  21. data/lib/arel/engines/sql/core_extensions.rb +4 -0
  22. data/lib/arel/engines/sql/{extensions → core_extensions}/array.rb +1 -1
  23. data/lib/arel/engines/sql/{extensions → core_extensions}/nil_class.rb +1 -1
  24. data/lib/arel/engines/sql/{extensions → core_extensions}/object.rb +1 -1
  25. data/lib/arel/engines/sql/{extensions → core_extensions}/range.rb +1 -1
  26. data/lib/arel/engines/sql/formatters.rb +6 -3
  27. data/lib/arel/engines/sql/predicates.rb +37 -35
  28. data/lib/arel/engines/sql/primitives.rb +10 -2
  29. data/lib/arel/engines/sql/relations/operations/join.rb +2 -2
  30. data/lib/arel/engines/sql/relations/relation.rb +33 -9
  31. data/lib/arel/engines/sql/relations/writes.rb +41 -10
  32. data/lib/arel/session.rb +9 -6
  33. data/spec/arel/algebra/unit/predicates/binary_spec.rb +23 -21
  34. data/spec/arel/algebra/unit/predicates/equality_spec.rb +20 -18
  35. data/spec/arel/algebra/unit/predicates/in_spec.rb +7 -5
  36. data/spec/arel/algebra/unit/primitives/attribute_spec.rb +10 -12
  37. data/spec/arel/algebra/unit/primitives/expression_spec.rb +1 -1
  38. data/spec/arel/algebra/unit/primitives/value_spec.rb +1 -1
  39. data/spec/arel/algebra/unit/relations/alias_spec.rb +2 -2
  40. data/spec/arel/algebra/unit/relations/delete_spec.rb +1 -1
  41. data/spec/arel/algebra/unit/relations/group_spec.rb +1 -1
  42. data/spec/arel/algebra/unit/relations/insert_spec.rb +1 -1
  43. data/spec/arel/algebra/unit/relations/join_spec.rb +1 -1
  44. data/spec/arel/algebra/unit/relations/order_spec.rb +2 -2
  45. data/spec/arel/algebra/unit/relations/project_spec.rb +1 -1
  46. data/spec/arel/algebra/unit/relations/relation_spec.rb +5 -5
  47. data/spec/arel/algebra/unit/relations/skip_spec.rb +1 -1
  48. data/spec/arel/algebra/unit/relations/table_spec.rb +2 -2
  49. data/spec/arel/algebra/unit/relations/take_spec.rb +1 -1
  50. data/spec/arel/algebra/unit/relations/update_spec.rb +1 -1
  51. data/spec/arel/algebra/unit/relations/where_spec.rb +1 -1
  52. data/spec/arel/algebra/unit/session/session_spec.rb +1 -1
  53. data/spec/arel/engines/memory/integration/joins/cross_engine_spec.rb +3 -4
  54. data/spec/arel/engines/memory/unit/relations/array_spec.rb +1 -1
  55. data/spec/arel/engines/memory/unit/relations/insert_spec.rb +8 -8
  56. data/spec/arel/engines/memory/unit/relations/join_spec.rb +1 -1
  57. data/spec/arel/engines/memory/unit/relations/order_spec.rb +1 -1
  58. data/spec/arel/engines/memory/unit/relations/project_spec.rb +1 -1
  59. data/spec/arel/engines/memory/unit/relations/skip_spec.rb +1 -1
  60. data/spec/arel/engines/memory/unit/relations/take_spec.rb +1 -1
  61. data/spec/arel/engines/memory/unit/relations/where_spec.rb +1 -1
  62. data/spec/arel/engines/sql/integration/joins/with_adjacency_spec.rb +1 -1
  63. data/spec/arel/engines/sql/integration/joins/with_aggregations_spec.rb +1 -1
  64. data/spec/arel/engines/sql/integration/joins/with_compounds_spec.rb +1 -1
  65. data/spec/arel/engines/sql/unit/engine_spec.rb +1 -1
  66. data/spec/arel/engines/sql/unit/predicates/binary_spec.rb +73 -70
  67. data/spec/arel/engines/sql/unit/predicates/equality_spec.rb +45 -28
  68. data/spec/arel/engines/sql/unit/predicates/in_spec.rb +57 -55
  69. data/spec/arel/engines/sql/unit/predicates/predicates_spec.rb +48 -46
  70. data/spec/arel/engines/sql/unit/primitives/attribute_spec.rb +1 -1
  71. data/spec/arel/engines/sql/unit/primitives/expression_spec.rb +1 -1
  72. data/spec/arel/engines/sql/unit/primitives/literal_spec.rb +13 -1
  73. data/spec/arel/engines/sql/unit/primitives/value_spec.rb +3 -3
  74. data/spec/arel/engines/sql/unit/relations/alias_spec.rb +1 -1
  75. data/spec/arel/engines/sql/unit/relations/delete_spec.rb +1 -1
  76. data/spec/arel/engines/sql/unit/relations/group_spec.rb +1 -1
  77. data/spec/arel/engines/sql/unit/relations/insert_spec.rb +1 -1
  78. data/spec/arel/engines/sql/unit/relations/join_spec.rb +1 -1
  79. data/spec/arel/engines/sql/unit/relations/order_spec.rb +1 -1
  80. data/spec/arel/engines/sql/unit/relations/project_spec.rb +1 -1
  81. data/spec/arel/engines/sql/unit/relations/skip_spec.rb +1 -1
  82. data/spec/arel/engines/sql/unit/relations/table_spec.rb +1 -1
  83. data/spec/arel/engines/sql/unit/relations/take_spec.rb +1 -1
  84. data/spec/arel/engines/sql/unit/relations/update_spec.rb +13 -7
  85. data/spec/arel/engines/sql/unit/relations/where_spec.rb +1 -1
  86. data/spec/connections/mysql_connection.rb +3 -3
  87. data/spec/connections/postgresql_connection.rb +2 -2
  88. data/spec/connections/sqlite3_connection.rb +3 -2
  89. data/spec/doubles/hash.rb +4 -0
  90. data/spec/spec.opts +3 -0
  91. data/spec/spec_helper.rb +8 -0
  92. metadata +39 -25
  93. data/VERSION +0 -1
  94. data/lib/arel/algebra/extensions.rb +0 -4
  95. data/lib/arel/algebra/primitives.rb +0 -5
  96. data/lib/arel/engines/sql/extensions.rb +0 -4
@@ -3,10 +3,12 @@ module Arel
3
3
  def relation
4
4
  nil
5
5
  end
6
-
6
+
7
7
  def to_sql(formatter = nil)
8
8
  self
9
9
  end
10
+
11
+ include Attribute::Expressions
10
12
  end
11
13
 
12
14
  class Attribute
@@ -28,7 +30,13 @@ module Arel
28
30
  end
29
31
 
30
32
  class Value
31
- delegate :inclusion_predicate_sql, :equality_predicate_sql, :to => :value
33
+ def inclusion_predicate_sql
34
+ value.inclusion_predicate_sql
35
+ end
36
+
37
+ def equality_predicate_sql
38
+ value.equality_predicate_sql
39
+ end
32
40
 
33
41
  def to_sql(formatter = Sql::WhereCondition.new(relation))
34
42
  formatter.value value
@@ -26,8 +26,8 @@ module Arel
26
26
  end
27
27
 
28
28
  class StringJoin < Join
29
- def joins(_, __ = nil)
30
- relation2
29
+ def joins(environment, formatter = Sql::TableReference.new(environment))
30
+ [relation1.joins(environment), relation2].compact.join(" ")
31
31
  end
32
32
  end
33
33
  end
@@ -5,15 +5,36 @@ module Arel
5
5
  end
6
6
 
7
7
  def select_sql
8
- build_query \
9
- "SELECT #{select_clauses.join(', ')}",
10
- "FROM #{table_sql(Sql::TableReference.new(self))}",
11
- (joins(self) unless joins(self).blank? ),
12
- ("WHERE #{where_clauses.join("\n\tAND ")}" unless wheres.blank? ),
13
- ("GROUP BY #{group_clauses.join(', ')}" unless groupings.blank? ),
14
- ("ORDER BY #{order_clauses.join(', ')}" unless orders.blank? ),
15
- ("LIMIT #{taken}" unless taken.blank? ),
16
- ("OFFSET #{skipped}" unless skipped.blank? )
8
+ if engine.adapter_name == "PostgreSQL" && !orders.blank? && using_distinct_on?
9
+ # PostgreSQL does not allow arbitrary ordering when using DISTINCT ON, so we work around this
10
+ # by wrapping the +sql+ string as a sub-select and ordering in that query.
11
+ order = order_clauses.join(', ').split(',').map { |s| s.strip }.reject(&:blank?)
12
+ order = order.zip((0...order.size).to_a).map { |s,i| "id_list.alias_#{i} #{'DESC' if s =~ /\bdesc$/i}" }.join(', ')
13
+
14
+ query = build_query \
15
+ "SELECT #{select_clauses.to_s}",
16
+ "FROM #{table_sql(Sql::TableReference.new(self))}",
17
+ (joins(self) unless joins(self).blank? ),
18
+ ("WHERE #{where_clauses.join("\n\tAND ")}" unless wheres.blank? ),
19
+ ("GROUP BY #{group_clauses.join(', ')}" unless groupings.blank? )
20
+
21
+ build_query \
22
+ "SELECT * FROM (#{query}) AS id_list",
23
+ "ORDER BY #{order}",
24
+ ("LIMIT #{taken}" unless taken.blank? ),
25
+ ("OFFSET #{skipped}" unless skipped.blank? )
26
+
27
+ else
28
+ build_query \
29
+ "SELECT #{select_clauses.join(', ')}",
30
+ "FROM #{table_sql(Sql::TableReference.new(self))}",
31
+ (joins(self) unless joins(self).blank? ),
32
+ ("WHERE #{where_clauses.join("\n\tAND ")}" unless wheres.blank? ),
33
+ ("GROUP BY #{group_clauses.join(', ')}" unless groupings.blank? ),
34
+ ("ORDER BY #{order_clauses.join(', ')}" unless orders.blank? ),
35
+ ("LIMIT #{taken}" unless taken.blank? ),
36
+ ("OFFSET #{skipped}" unless skipped.blank? )
37
+ end
17
38
  end
18
39
 
19
40
  def inclusion_predicate_sql
@@ -46,5 +67,8 @@ module Arel
46
67
  orders.collect { |o| o.to_sql(Sql::OrderClause.new(self)) }
47
68
  end
48
69
 
70
+ def using_distinct_on?
71
+ select_clauses.any? { |x| x =~ /DISTINCT ON/ }
72
+ end
49
73
  end
50
74
  end
@@ -1,6 +1,6 @@
1
1
  module Arel
2
2
  class Deletion < Compound
3
- def to_sql(formatter = nil)
3
+ def to_sql
4
4
  build_query \
5
5
  "DELETE",
6
6
  "FROM #{table_sql}",
@@ -10,30 +10,61 @@ module Arel
10
10
  end
11
11
 
12
12
  class Insert < Compound
13
- def to_sql(formatter = nil)
13
+ def to_sql
14
+ insertion_attributes_values_sql = if record.is_a?(Value)
15
+ record.value
16
+ else
17
+ build_query "(#{record.keys.collect { |key| engine.quote_column_name(key.name) }.join(', ')})",
18
+ "VALUES (#{record.collect { |key, value| key.format(value) }.join(', ')})"
19
+ end
20
+
14
21
  build_query \
15
22
  "INSERT",
16
23
  "INTO #{table_sql}",
17
- "(#{record.keys.collect { |key| engine.quote_column_name(key.name) }.join(', ')})",
18
- "VALUES (#{record.collect { |key, value| key.format(value) }.join(', ')})"
24
+ insertion_attributes_values_sql
19
25
  end
20
26
  end
21
27
 
22
28
  class Update < Compound
23
- def to_sql(formatter = nil)
29
+ def to_sql
24
30
  build_query \
25
31
  "UPDATE #{table_sql} SET",
26
32
  assignment_sql,
27
- ("WHERE #{wheres.collect(&:to_sql).join('\n\tAND ')}" unless wheres.blank? ),
28
- ("LIMIT #{taken}" unless taken.blank? )
33
+ build_update_conditions_sql
29
34
  end
30
35
 
31
36
  protected
32
37
 
33
38
  def assignment_sql
34
- assignments.collect do |attribute, value|
35
- "#{engine.quote_column_name(attribute.name)} = #{attribute.format(value)}"
36
- end.join(",\n")
39
+ if assignments.respond_to?(:collect)
40
+ assignments.collect do |attribute, value|
41
+ "#{engine.quote_column_name(attribute.name)} = #{attribute.format(value)}"
42
+ end.join(",\n")
43
+ else
44
+ assignments.value
45
+ end
46
+ end
47
+
48
+ def build_update_conditions_sql
49
+ conditions = ""
50
+ conditions << " WHERE #{wheres.collect(&:to_sql).join('\n\tAND ')}" unless wheres.blank?
51
+ conditions << " ORDER BY #{order_clauses.join(', ')}" unless orders.blank?
52
+
53
+ unless taken.blank?
54
+ conditions << " LIMIT #{taken}"
55
+
56
+ if engine.adapter_name != "MySQL"
57
+ begin
58
+ quote_primary_key = engine.quote_column_name(table.name.classify.constantize.primary_key)
59
+ rescue NameError
60
+ quote_primary_key = engine.quote_column_name("id")
61
+ end
62
+
63
+ conditions = "WHERE #{quote_primary_key} IN (SELECT #{quote_primary_key} FROM #{engine.connection.quote_table_name table.name} #{conditions})"
64
+ end
65
+ end
66
+
67
+ conditions
37
68
  end
38
69
  end
39
70
  end
@@ -5,16 +5,22 @@ module Arel
5
5
  alias_method :manufacture, :new
6
6
 
7
7
  def start
8
- if @started
8
+ if defined?(@started) && @started
9
9
  yield
10
10
  else
11
11
  begin
12
12
  @started = true
13
13
  @instance = manufacture
14
- metaclass.send :alias_method, :new, :instance
14
+ metaclass.class_eval do
15
+ undef :new
16
+ alias_method :new, :instance
17
+ end
15
18
  yield
16
19
  ensure
17
- metaclass.send :alias_method, :new, :manufacture
20
+ metaclass.class_eval do
21
+ undef :new
22
+ alias_method :new, :manufacture
23
+ end
18
24
  @started = false
19
25
  end
20
26
  end
@@ -24,7 +30,6 @@ module Arel
24
30
  module CRUD
25
31
  def create(insert)
26
32
  insert.call
27
- insert
28
33
  end
29
34
 
30
35
  def read(select)
@@ -35,12 +40,10 @@ module Arel
35
40
 
36
41
  def update(update)
37
42
  update.call
38
- update
39
43
  end
40
44
 
41
45
  def delete(delete)
42
46
  delete.call
43
- delete
44
47
  end
45
48
  end
46
49
  include CRUD
@@ -1,31 +1,33 @@
1
- require File.join(File.dirname(__FILE__), '..', '..', '..', '..', 'spec_helper')
1
+ require 'spec_helper'
2
2
 
3
3
  module Arel
4
- describe Binary do
5
- before do
6
- @relation = Table.new(:users)
7
- @attribute1 = @relation[:id]
8
- @attribute2 = @relation[:name]
9
- class ConcreteBinary < Binary
10
- end
11
- end
12
-
13
- describe '#bind' do
4
+ module Predicates
5
+ describe Binary do
14
6
  before do
15
- @another_relation = @relation.alias
7
+ @relation = Table.new(:users)
8
+ @attribute1 = @relation[:id]
9
+ @attribute2 = @relation[:name]
10
+ class ConcreteBinary < Binary
11
+ end
16
12
  end
17
13
 
18
- describe 'when both operands are attributes' do
19
- it "manufactures an expression with the attributes bound to the relation" do
20
- ConcreteBinary.new(@attribute1, @attribute2).bind(@another_relation). \
21
- should == ConcreteBinary.new(@another_relation[@attribute1], @another_relation[@attribute2])
14
+ describe '#bind' do
15
+ before do
16
+ @another_relation = @relation.alias
17
+ end
18
+
19
+ describe 'when both operands are attributes' do
20
+ it "manufactures an expression with the attributes bound to the relation" do
21
+ ConcreteBinary.new(@attribute1, @attribute2).bind(@another_relation). \
22
+ should == ConcreteBinary.new(@another_relation[@attribute1], @another_relation[@attribute2])
23
+ end
22
24
  end
23
- end
24
25
 
25
- describe 'when an operand is a value' do
26
- it "manufactures an expression with unmodified values" do
27
- ConcreteBinary.new(@attribute1, "asdf").bind(@another_relation). \
28
- should == ConcreteBinary.new(@attribute1.find_correlate_in(@another_relation), "asdf".find_correlate_in(@another_relation))
26
+ describe 'when an operand is a value' do
27
+ it "manufactures an expression with unmodified values" do
28
+ ConcreteBinary.new(@attribute1, "asdf").bind(@another_relation). \
29
+ should == ConcreteBinary.new(@attribute1.find_correlate_in(@another_relation), "asdf".find_correlate_in(@another_relation))
30
+ end
29
31
  end
30
32
  end
31
33
  end
@@ -1,26 +1,28 @@
1
- require File.join(File.dirname(__FILE__), '..', '..', '..', '..', 'spec_helper')
1
+ require 'spec_helper'
2
2
 
3
3
  module Arel
4
- describe Equality do
5
- before do
6
- @relation1 = Table.new(:users)
7
- @relation2 = Table.new(:photos)
8
- @attribute1 = @relation1[:id]
9
- @attribute2 = @relation2[:user_id]
10
- end
11
-
12
- describe '==' do
13
- it "obtains if attribute1 and attribute2 are identical" do
14
- Equality.new(@attribute1, @attribute2).should == Equality.new(@attribute1, @attribute2)
15
- Equality.new(@attribute1, @attribute2).should_not == Equality.new(@attribute1, @attribute1)
4
+ module Predicates
5
+ describe Equality do
6
+ before do
7
+ @relation1 = Table.new(:users)
8
+ @relation2 = Table.new(:photos)
9
+ @attribute1 = @relation1[:id]
10
+ @attribute2 = @relation2[:user_id]
16
11
  end
17
12
 
18
- it "obtains if the concrete type of the predicates are identical" do
19
- Equality.new(@attribute1, @attribute2).should_not == Binary.new(@attribute1, @attribute2)
20
- end
13
+ describe '==' do
14
+ it "obtains if attribute1 and attribute2 are identical" do
15
+ check Equality.new(@attribute1, @attribute2).should == Equality.new(@attribute1, @attribute2)
16
+ Equality.new(@attribute1, @attribute2).should_not == Equality.new(@attribute1, @attribute1)
17
+ end
18
+
19
+ it "obtains if the concrete type of the predicates are identical" do
20
+ Equality.new(@attribute1, @attribute2).should_not == Binary.new(@attribute1, @attribute2)
21
+ end
21
22
 
22
- it "is commutative on the attributes" do
23
- Equality.new(@attribute1, @attribute2).should == Equality.new(@attribute2, @attribute1)
23
+ it "is commutative on the attributes" do
24
+ Equality.new(@attribute1, @attribute2).should == Equality.new(@attribute2, @attribute1)
25
+ end
24
26
  end
25
27
  end
26
28
  end
@@ -1,10 +1,12 @@
1
- require File.join(File.dirname(__FILE__), '..', '..', '..', '..', 'spec_helper')
1
+ require 'spec_helper'
2
2
 
3
3
  module Arel
4
- describe In do
5
- before do
6
- @relation = Table.new(:users)
7
- @attribute = @relation[:id]
4
+ module Predicates
5
+ describe In do
6
+ before do
7
+ @relation = Table.new(:users)
8
+ @attribute = @relation[:id]
9
+ end
8
10
  end
9
11
  end
10
12
  end
@@ -1,4 +1,4 @@
1
- require File.join(File.dirname(__FILE__), '..', '..', '..', '..', 'spec_helper')
1
+ require 'spec_helper'
2
2
 
3
3
  module Arel
4
4
  describe Attribute do
@@ -73,10 +73,8 @@ module Arel
73
73
 
74
74
  describe 'when dividing two matching attributes' do
75
75
  it 'returns a the highest score for the most similar attributes' do
76
- (@aliased_relation[:id] / @relation[:id]) \
77
- .should == (@aliased_relation[:id] / @relation[:id])
78
- (@aliased_relation[:id] / @relation[:id]) \
79
- .should < (@aliased_relation[:id] / @aliased_relation[:id])
76
+ check((@aliased_relation[:id] / @relation[:id]).should == (@aliased_relation[:id] / @relation[:id]))
77
+ (@aliased_relation[:id] / @relation[:id]).should < (@aliased_relation[:id] / @aliased_relation[:id])
80
78
  end
81
79
  end
82
80
  end
@@ -89,43 +87,43 @@ module Arel
89
87
 
90
88
  describe '#eq' do
91
89
  it "manufactures an equality predicate" do
92
- @attribute.eq('name').should == Equality.new(@attribute, 'name')
90
+ @attribute.eq('name').should == Predicates::Equality.new(@attribute, 'name')
93
91
  end
94
92
  end
95
93
 
96
94
  describe '#lt' do
97
95
  it "manufactures a less-than predicate" do
98
- @attribute.lt(10).should == LessThan.new(@attribute, 10)
96
+ @attribute.lt(10).should == Predicates::LessThan.new(@attribute, 10)
99
97
  end
100
98
  end
101
99
 
102
100
  describe '#lteq' do
103
101
  it "manufactures a less-than or equal-to predicate" do
104
- @attribute.lteq(10).should == LessThanOrEqualTo.new(@attribute, 10)
102
+ @attribute.lteq(10).should == Predicates::LessThanOrEqualTo.new(@attribute, 10)
105
103
  end
106
104
  end
107
105
 
108
106
  describe '#gt' do
109
107
  it "manufactures a greater-than predicate" do
110
- @attribute.gt(10).should == GreaterThan.new(@attribute, 10)
108
+ @attribute.gt(10).should == Predicates::GreaterThan.new(@attribute, 10)
111
109
  end
112
110
  end
113
111
 
114
112
  describe '#gteq' do
115
113
  it "manufactures a greater-than or equal-to predicate" do
116
- @attribute.gteq(10).should == GreaterThanOrEqualTo.new(@attribute, 10)
114
+ @attribute.gteq(10).should == Predicates::GreaterThanOrEqualTo.new(@attribute, 10)
117
115
  end
118
116
  end
119
117
 
120
118
  describe '#matches' do
121
119
  it "manufactures a match predicate" do
122
- @attribute.matches(/.*/).should == Match.new(@attribute, /.*/)
120
+ @attribute.matches(/.*/).should == Predicates::Match.new(@attribute, /.*/)
123
121
  end
124
122
  end
125
123
 
126
124
  describe '#in' do
127
125
  it "manufactures an in predicate" do
128
- @attribute.in(1..30).should == In.new(@attribute, (1..30))
126
+ @attribute.in(1..30).should == Predicates::In.new(@attribute, (1..30))
129
127
  end
130
128
  end
131
129
  end
@@ -1,4 +1,4 @@
1
- require File.join(File.dirname(__FILE__), '..', '..', '..', '..', 'spec_helper')
1
+ require 'spec_helper'
2
2
 
3
3
  module Arel
4
4
  describe Expression do
@@ -1,4 +1,4 @@
1
- require File.join(File.dirname(__FILE__), '..', '..', '..', '..', 'spec_helper')
1
+ require 'spec_helper'
2
2
 
3
3
  module Arel
4
4
  describe Value do
@@ -1,4 +1,4 @@
1
- require File.join(File.dirname(__FILE__), '..', '..', '..', '..', 'spec_helper')
1
+ require 'spec_helper'
2
2
 
3
3
  module Arel
4
4
  describe Alias do
@@ -8,7 +8,7 @@ module Arel
8
8
 
9
9
  describe '==' do
10
10
  it "obtains if the objects are the same" do
11
- Alias.new(@relation).should_not == Alias.new(@relation)
11
+ check Alias.new(@relation).should_not == Alias.new(@relation)
12
12
  (aliaz = Alias.new(@relation)).should == aliaz
13
13
  end
14
14
  end
@@ -1,4 +1,4 @@
1
- require File.join(File.dirname(__FILE__), '..', '..', '..', '..', 'spec_helper')
1
+ require 'spec_helper'
2
2
 
3
3
  module Arel
4
4
  describe Deletion do