diff options
author | Viacheslav Petrenko <slavap@gmail.com> | 2010-12-27 18:16:18 +0200 |
---|---|---|
committer | Aaron Patterson <aaron.patterson@gmail.com> | 2011-01-03 10:18:02 -0800 |
commit | 1a246f71616cf246a75ef6cbdb56032e43d4e643 (patch) | |
tree | 81b0795b26766f9c4cdc59c04d20837a5de051f9 /test | |
parent | ee3c55c84996ad2565762fa1f472259460d7d731 (diff) | |
download | rails-1a246f71616cf246a75ef6cbdb56032e43d4e643.tar.gz rails-1a246f71616cf246a75ef6cbdb56032e43d4e643.tar.bz2 rails-1a246f71616cf246a75ef6cbdb56032e43d4e643.zip |
Patched Arel v2.0.6 to support MSSQL SQL queries. Based on work of James Abley (https://github.com/jabley/arel).
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 e08dc89793..33783f7d23 100644 --- a/test/visitors/test_to_sql.rb +++ b/test/visitors/test_to_sql.rb @@ -32,7 +32,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 |