From 1a246f71616cf246a75ef6cbdb56032e43d4e643 Mon Sep 17 00:00:00 2001 From: Viacheslav Petrenko Date: Mon, 27 Dec 2010 18:16:18 +0200 Subject: Patched Arel v2.0.6 to support MSSQL SQL queries. Based on work of James Abley (https://github.com/jabley/arel). --- test/visitors/test_mssql.rb | 18 ++++++++++++++++++ test/visitors/test_to_sql.rb | 2 +- 2 files changed, 19 insertions(+), 1 deletion(-) create mode 100644 test/visitors/test_mssql.rb (limited to 'test') 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 -- cgit v1.2.3