aboutsummaryrefslogtreecommitdiffstats
path: root/test
diff options
context:
space:
mode:
Diffstat (limited to 'test')
-rw-r--r--test/visitors/test_mssql.rb18
-rw-r--r--test/visitors/test_to_sql.rb2
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