mirror of
https://github.com/discourse/discourse.git
synced 2025-05-23 18:41:07 +08:00
DEV: Allow DB.after_commit to be used outside of a transaction
In this case, it will execute the given block immediately
This commit is contained in:
@ -49,6 +49,19 @@ describe MiniSqlMultisiteConnection do
|
||||
|
||||
expect(outputString).to eq("123")
|
||||
end
|
||||
|
||||
it "runs immediately if there is no transaction" do
|
||||
outputString = "1"
|
||||
|
||||
DB.after_commit do
|
||||
outputString += "2"
|
||||
end
|
||||
|
||||
outputString += "3"
|
||||
|
||||
expect(outputString).to eq("123")
|
||||
end
|
||||
|
||||
end
|
||||
|
||||
end
|
||||
|
Reference in New Issue
Block a user