diff options
Diffstat (limited to 'test/visitors/test_mysql.rb')
-rw-r--r-- | test/visitors/test_mysql.rb | 15 |
1 files changed, 10 insertions, 5 deletions
diff --git a/test/visitors/test_mysql.rb b/test/visitors/test_mysql.rb index c3b79ca667..3c15c218b2 100644 --- a/test/visitors/test_mysql.rb +++ b/test/visitors/test_mysql.rb @@ -29,11 +29,16 @@ module Arel sql.must_be_like "SELECT FROM DUAL" end - it 'uses FOR UPDATE when locking' do - stmt = Nodes::SelectStatement.new - stmt.lock = Nodes::Lock.new - sql = @visitor.accept(stmt) - sql.must_be_like "SELECT FROM DUAL FOR UPDATE" + describe 'locking' do + it 'defaults to FOR UPDATE when locking' do + node = Nodes::Lock.new(Arel.sql('FOR UPDATE')) + @visitor.accept(node).must_be_like "FOR UPDATE" + end + + it 'allows a custom string to be used as a lock' do + node = Nodes::Lock.new(Arel.sql('LOCK IN SHARE MODE')) + @visitor.accept(node).must_be_like "LOCK IN SHARE MODE" + end end end end |