Good notes posted by ssorokaRSS feed
@wiseleyb and @glosakti, neither of your suggestions are necessary, and both are bad practices.
test "transactions" do assert_raises ZeroDivisionError do User.transaction do 1/0 end end end
passes just fine on its own, with the transaction rolled back as you’d expect. No need to hack something ugly together.
Don’t use this method unless you’re sure your string isn’t nil. Instead use the raw() method, which wont raise an exception on nil.