diff options
author | Aaron Patterson <aaron.patterson@gmail.com> | 2011-01-03 10:31:25 -0800 |
---|---|---|
committer | Aaron Patterson <aaron.patterson@gmail.com> | 2011-01-03 10:31:25 -0800 |
commit | d4259c5ce2f6b05226a8b934537678ade1606e97 (patch) | |
tree | 9059008ad935fcf93e979a3b057e1fdc19994dc9 /test | |
parent | cefad1e2139c4bba6e45f3281a6d54394aaeb366 (diff) | |
parent | 1215c28311aab325c55c083d15cbf3e16599d502 (diff) | |
download | rails-d4259c5ce2f6b05226a8b934537678ade1606e97.tar.gz rails-d4259c5ce2f6b05226a8b934537678ade1606e97.tar.bz2 rails-d4259c5ce2f6b05226a8b934537678ade1606e97.zip |
Merge branch '2-0-stable' into merge
* 2-0-stable:
updating history
Patched Arel v2.0.6 to support MSSQL SQL queries. Based on work of James Abley (https://github.com/jabley/arel).
consolidating dot visitor methods
refactoring where, fixing subselect
implementation for passing a subquery to #in and #not_in
tests for passing a subquery to #in and #not_in
limit members of the AST are visited
quoting limit nodes
Conflicts:
History.txt
lib/arel/nodes.rb
lib/arel/nodes/select_core.rb
lib/arel/select_manager.rb
lib/arel/visitors/to_sql.rb
test/visitors/test_to_sql.rb
Diffstat (limited to 'test')
-rw-r--r-- | test/visitors/test_mssql.rb | 18 | ||||
-rw-r--r-- | test/visitors/test_to_sql.rb | 2 |
2 files changed, 19 insertions, 1 deletions
diff --git a/test/visitors/test_mssql.rb b/test/visitors/test_mssql.rb new file mode 100644 index 0000000000..b658e46828 --- /dev/null +++ b/test/visitors/test_mssql.rb @@ -0,0 +1,18 @@ +require 'helper' + +module Arel + module Visitors + describe 'the mssql visitor' do + before do + @visitor = MSSQL.new Table.engine + end + + it 'uses TOP to limit results' do + stmt = Nodes::SelectStatement.new + stmt.cores.last.top = Nodes::Top.new(1) + sql = @visitor.accept(stmt) + sql.must_be_like "SELECT TOP 1" + end + end + end +end diff --git a/test/visitors/test_to_sql.rb b/test/visitors/test_to_sql.rb index 530bd73f6d..34ebb2b278 100644 --- a/test/visitors/test_to_sql.rb +++ b/test/visitors/test_to_sql.rb @@ -39,7 +39,7 @@ module Arel it "should escape LIMIT" do sc = Arel::Nodes::SelectStatement.new - sc.limit = "omg" + sc.limit = Arel::Nodes::Limit.new("omg") assert_match(/LIMIT 'omg'/, @visitor.accept(sc)) end |