diff options
Diffstat (limited to 'test')
-rw-r--r-- | test/test_table.rb | 4 | ||||
-rw-r--r-- | test/visitors/test_to_sql.rb | 9 |
2 files changed, 13 insertions, 0 deletions
diff --git a/test/test_table.rb b/test/test_table.rb index 129d7ba736..1035540513 100644 --- a/test/test_table.rb +++ b/test/test_table.rb @@ -164,6 +164,10 @@ module Arel @relation.name.must_equal 'users' end + it "should have a table name" do + @relation.table_name.must_equal 'users' + end + it "should have an engine" do @relation.engine.must_equal Table.engine end diff --git a/test/visitors/test_to_sql.rb b/test/visitors/test_to_sql.rb index 3af316037a..c47fd57a28 100644 --- a/test/visitors/test_to_sql.rb +++ b/test/visitors/test_to_sql.rb @@ -281,6 +281,15 @@ module Arel } end end + + describe 'TableAlias' do + it "should use the underlying table for checking columns" do + test = Table.new(:users).alias('zomgusers')[:id].eq '3' + @visitor.accept(test).must_be_like %{ + "zomgusers"."id" = 3 + } + end + end end end end |