diff options
author | Sean Griffin <sean@thoughtbot.com> | 2014-11-26 13:45:31 -0700 |
---|---|---|
committer | Sean Griffin <sean@thoughtbot.com> | 2014-11-29 16:08:51 -0700 |
commit | 7508284800f67b4611c767bff9eae7045674b66f (patch) | |
tree | 9f16f258662c4b0165f1ee255eddb3f07d6aeeb6 /test/nodes | |
parent | ec083687a96af1f35f9fb9e75611cc4bf4f5bf81 (diff) | |
download | rails-7508284800f67b4611c767bff9eae7045674b66f.tar.gz rails-7508284800f67b4611c767bff9eae7045674b66f.tar.bz2 rails-7508284800f67b4611c767bff9eae7045674b66f.zip |
Remove engine from the constructor arguments `Arel::Table`
It is never used outside of convenience methods which are only used in
tests. In practice, it just made constructing tables more complicated on
the rails side. This is the minimum possible change to remove the
constructor argument, but continue to have the tests passing.
I'm not sure if we have a reason to keep `project` and friends, and the
solution might actually just be to remove the engine from
`SelectManager` and friends. As such I've held off on deleting those
methods.
We need to figure out what to do with `Table#from`. It's old invocation,
which read `table.from(table)` was certainly nonsensical.
Diffstat (limited to 'test/nodes')
-rw-r--r-- | test/nodes/test_table_alias.rb | 13 |
1 files changed, 6 insertions, 7 deletions
diff --git a/test/nodes/test_table_alias.rb b/test/nodes/test_table_alias.rb index 4aafd12b79..e30f97b748 100644 --- a/test/nodes/test_table_alias.rb +++ b/test/nodes/test_table_alias.rb @@ -5,27 +5,26 @@ module Arel module Nodes describe 'table alias' do it 'has an #engine which delegates to the relation' do - engine = 'vroom' - relation = Table.new(:users, engine) + relation = OpenStruct.new(engine: 'vroom') node = TableAlias.new relation, :foo - node.engine.must_equal engine + node.engine.must_equal 'vroom' end describe 'equality' do it 'is equal with equal ivars' do - relation1 = Table.new(:users, 'vroom') + relation1 = Table.new(:users) node1 = TableAlias.new relation1, :foo - relation2 = Table.new(:users, 'vroom') + relation2 = Table.new(:users) node2 = TableAlias.new relation2, :foo array = [node1, node2] assert_equal 1, array.uniq.size end it 'is not equal with different ivars' do - relation1 = Table.new(:users, 'vroom') + relation1 = Table.new(:users) node1 = TableAlias.new relation1, :foo - relation2 = Table.new(:users, 'vroom') + relation2 = Table.new(:users) node2 = TableAlias.new relation2, :bar array = [node1, node2] assert_equal 2, array.uniq.size |