Skip to content

Commit

Permalink
Added missing test for Arel factory methods
Browse files Browse the repository at this point in the history
  • Loading branch information
akhilgkrishnan committed Aug 4, 2023
1 parent cfa5857 commit af2839f
Show file tree
Hide file tree
Showing 2 changed files with 24 additions and 6 deletions.
24 changes: 24 additions & 0 deletions activerecord/test/cases/arel/factory_methods_test.rb
Expand Up @@ -19,6 +19,30 @@ def test_create_join
assert_equal :two, join.right
end

def test_create_table_alias
table_alias = @factory.create_table_alias :one, :two
assert_kind_of Nodes::TableAlias, table_alias
assert_equal :two, table_alias.right
end

def test_create_and
and_node = @factory.create_and ["foo", "bar"]
assert_instance_of Nodes::And, and_node
assert_equal ["foo", "bar"], and_node.children
end

def test_create_string_join
join = @factory.create_string_join "foo"
assert_kind_of Arel::Nodes::StringJoin, join
assert_equal "foo", join.left
end

def test_grouping
grouping = @factory.grouping :one
assert_instance_of Nodes::Grouping, grouping
assert_equal :one, grouping.expr
end

def test_create_on
on = @factory.create_on :one
assert_instance_of Nodes::On, on
Expand Down
6 changes: 0 additions & 6 deletions activerecord/test/cases/arel/table_test.rb
Expand Up @@ -8,12 +8,6 @@ class TableTest < Arel::Spec
@relation = Table.new(:users)
end

it "should create join nodes" do
join = @relation.create_string_join "foo"
assert_kind_of Arel::Nodes::StringJoin, join
assert_equal "foo", join.left
end

it "should create join nodes" do
join = @relation.create_join "foo", "bar"
assert_kind_of Arel::Nodes::InnerJoin, join
Expand Down

0 comments on commit af2839f

Please sign in to comment.