Sha256: c35d049d57341ab33d1d49d212ba4305c29d2980088591db68174038d3a56eb2
Contents?: true
Size: 1.01 KB
Versions: 2
Compression:
Stored size: 1.01 KB
Contents
require File.expand_path(File.join(File.dirname(__FILE__), '..', 'spec_helper')) require 'reservations/party_lodging' require 'reservations/lodging' require 'reservations/party' require 'reservations/reservation' describe "GraphMediator transaction scenarios" do before(:all) do load 'reservations/schema.rb' end before(:each) do @today = Date.today @r1 = Reservation.create!(:starts => @today, :ends => @today + 1, :name => 'foo') end it "should implicitly provide an activerecord transaction for mediated_transaction" do lambda { @r1.mediated_transaction do @r1.parties.create(:name => 'Bob') raise('should cause transaction rollback') end }.should raise_error(RuntimeError) @r1.reload @r1.parties.should be_empty end it "should handle rollback in a mediated_transaction" do @r1.mediated_transaction do @r1.parties.create(:name => 'Bob') raise(ActiveRecord::Rollback) end @r1.reload @r1.parties.should be_empty end end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
graph_mediator-0.2.3 | spec/integration/transactions_spec.rb |
graph_mediator-0.2.2 | spec/integration/transactions_spec.rb |