Sha256: 4ce57e00a6efe880c9ed1c3642ed33f577d247ef74b44bda495a1c20ab8b7a08
Contents?: true
Size: 877 Bytes
Versions: 7
Compression:
Stored size: 877 Bytes
Contents
require_relative "test_helper" require "rr" class TransactionTest < ActiveSupport::TestCase test "archiving is transactional" do archival = Archival.create! exploder = archival.exploders.create! any_instance_of(Exploder) do |canary| stub(canary).archive! { raise "Rollback Imminent" } end archival.archive! assert_not archival.archived?, "If this failed, you might be trying to test on a system that doesn't support nested transactions" assert_not exploder.reload.archived? end test "unarchiving is transactional" do archival = Archival.create! exploder = archival.exploders.create! any_instance_of(Exploder) do |canary| stub(canary).unarchive! { raise "Rollback Imminent" } end archival.archive! archival.unarchive! assert archival.reload.archived? assert exploder.reload.archived? end end
Version data entries
7 entries across 7 versions & 2 rubygems