class DataMapperTest::MachineWithTransactionsTest
Public Instance Methods
setup()
click to toggle source
# File test/unit/integrations/data_mapper_test.rb, line 758 def setup @resource = new_resource @machine = StateMachine::Machine.new(@resource, :use_transactions => true) end
test_should_not_rollback_transaction_if_true()
click to toggle source
# File test/unit/integrations/data_mapper_test.rb, line 772 def test_should_not_rollback_transaction_if_true @machine.within_transaction(@resource.new) do @resource.create true end assert_equal 1, @resource.all.size end
test_should_rollback_transaction_if_false()
click to toggle source
# File test/unit/integrations/data_mapper_test.rb, line 763 def test_should_rollback_transaction_if_false @machine.within_transaction(@resource.new) do @resource.create false end assert_equal 0, @resource.all.size end