diff options
Diffstat (limited to 'test/visitors')
-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 |