diff --git a/test/update_all_and_get_ids_test.rb b/test/update_all_and_get_ids_test.rb index 8df33a2..3e9b469 100644 --- a/test/update_all_and_get_ids_test.rb +++ b/test/update_all_and_get_ids_test.rb @@ -65,4 +65,15 @@ def test_on_relation_and_with_race_condition assert_equal ['bomb', '', 'flame thrower'], Item.order('id').pluck(:name) end end + + def test_select_from_dual + skip if not Atomically::AdapterCheckService.new(UserItem).mysql? + + in_sandbox do + assert_sqls(['SELECT @ids FROM DUAL']) do + assert_equal [1, 2], Item.joins(:users).atomically.update_all_and_get_ids('items.name = ""') + assert_equal ['', '', 'flame thrower'], Item.order('id').pluck(:name) + end + end + end end