test/visitors/test_mysql.rb in arel-2.0.8 vs test/visitors/test_mysql.rb in arel-2.0.9.rc1
- old
+ new
@@ -27,14 +27,19 @@
stmt = Nodes::SelectStatement.new
sql = @visitor.accept(stmt)
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
end