Dear All: I have done my test for 2 actions do simultaneously for the same command. Here is my approvement.
------------------------ Window DOS 1 ------------------------ F:\ruby\tiesto> ruby test/unit/item_test.rb Loaded suite test/unit/item_test Started . Finished in 42.078 seconds. 1 tests, 0 assertions, 0 failures, 0 errors ------------------------ Windows DOS 2 ------------------------ F:\ruby\tiesto>ruby test/unit/barang_ terpesan_ test.rb Loaded suite test/unit/barang_terpesan_ test Started . Finished in 42.125 seconds. 1 tests, 0 assertions, 0 failures, 0 errors ------------ --------- --------- ----- SCRIPT di barang_terpesan_test.rb ------------ --------- --------- ----- require File.dirname( __FILE__) + '/../test_helper' class BarangTerpesanTest < Test::Unit:: TestCase fixtures :barang_terpesans def test_what barang = BarangTerpesan. find(:first) BarangTerpesan. transaction do barang.proses_ modifikasi end end end ------------ --------- --------- --------- ------- SCRIPT di BarangTerpesan. rb (Active Record) ------------ --------- --------- --------- ------- class BarangTerpesan < ActiveRecord: :Base def proses_modifikasi #dikasih delay for x in 1..100000000 end update_attributes( :jumlah => jumlah-1) end ------------ --------- ---- KONDISI TABLE SEBELUM ACTION ------------ --------- ---- ------------ --------- - ID | BARANG | JUMLAH | ------------ --------- - 1 | ABC01 | 10 | ------------ --------- - Setelah kedua windows itu dijalankan, hasilnya : ------------ --------- --------- --------- --------- -- KONDISI TABLE SETELAH 2 EKSEKUSI BERSAMAAN ------------ --------- --------- --------- --------- -- ------------ --------- - ID | BARANG | JUMLAH | ------------ --------- - 1 | ABC01 | 9 | ------------ --------- - Ini tidak sesuai dengan kaidah database seharusnya 10 - 1 -1 = 8, bukan 9. Padahal saya sudah menaro BarangTerpesan. transaction. Gimana teman-teman ada solusi atau saran? Thank You Reinhart http://teapoci. blogspot. com ____________________________________________________________________________________ Be a better friend, newshound, and know-it-all with Yahoo! Mobile. Try it now. http://mobile.yahoo.com/;_ylt=Ahu06i62sR8HDtDypao8Wcj9tAcJ