mirror of
https://github.com/rails/rails.git
synced 2022-11-09 12:12:34 -05:00
creating string join nodes
This commit is contained in:
parent
9a5b5e5336
commit
79657a3512
2 changed files with 11 additions and 0 deletions
|
@ -5,5 +5,9 @@ module Arel
|
|||
def create_join from, to, on = nil, klass = Nodes::InnerJoin
|
||||
klass.new(from, to, on)
|
||||
end
|
||||
|
||||
def create_string_join from, to
|
||||
create_join from, to, nil, Nodes::StringJoin
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
|
@ -6,6 +6,13 @@ module Arel
|
|||
@relation = Table.new(:users)
|
||||
end
|
||||
|
||||
it 'should create join nodes' do
|
||||
join = @relation.create_string_join 'foo', 'bar'
|
||||
assert_kind_of Arel::Nodes::StringJoin, join
|
||||
assert_equal 'foo', join.left
|
||||
assert_equal 'bar', join.right
|
||||
end
|
||||
|
||||
it 'should create join nodes' do
|
||||
join = @relation.create_join 'foo', 'bar', 'baz'
|
||||
assert_kind_of Arel::Nodes::InnerJoin, join
|
||||
|
|
Loading…
Reference in a new issue