Sha256: a58aeeb0eb639142b0d882ed820a512ac54303b693e7d81695655f8032368d9c

Contents?: true

Size: 702 Bytes

Versions: 69

Compression:

Stored size: 702 Bytes

Contents

require File.dirname(__FILE__) + '/../spec_helper'

describe Sequel::Pervasive::DatabaseMethods do

  it "supports transactions" do
    set_fos_db([Trip])
    t = Trip.first
    ### surround with begin/rescue
    begin
      ### testing do_transaction
      r = nil
      Trip.db.do_transaction do |conn|
        # increment the value of fs_visa by one
        r = conn.run(Trip.filter(t.pk_hash).update_sql(:fs_visa=>t.fs_visa.succ))
        raise(Exception, 'testing do_transaction transactions')
      end
      ### end testing do_transaction
    rescue Exception => e
    ensure
      r.drop if r
    end
    # check if the values have changed
    Trip.first.fs_visa.should == t.fs_visa
  end

end

Version data entries

69 entries across 69 versions & 1 rubygems

Version Path
fossil-0.5.50 spec/sequel/pervasive_adapter_spec.rb
fossil-0.5.49 spec/sequel/pervasive_adapter_spec.rb
fossil-0.5.48 spec/sequel/pervasive_adapter_spec.rb
fossil-0.5.47 spec/sequel/pervasive_adapter_spec.rb
fossil-0.5.46 spec/sequel/pervasive_adapter_spec.rb
fossil-0.5.45 spec/sequel/pervasive_adapter_spec.rb
fossil-0.5.44 spec/sequel/pervasive_adapter_spec.rb
fossil-0.5.43 spec/sequel/pervasive_adapter_spec.rb
fossil-0.5.42 spec/sequel/pervasive_adapter_spec.rb
fossil-0.5.41 spec/sequel/pervasive_adapter_spec.rb
fossil-0.5.40 spec/sequel/pervasive_adapter_spec.rb
fossil-0.5.39 spec/sequel/pervasive_adapter_spec.rb
fossil-0.5.38 spec/sequel/pervasive_adapter_spec.rb
fossil-0.5.37 spec/sequel/pervasive_adapter_spec.rb
fossil-0.5.36 spec/sequel/pervasive_adapter_spec.rb
fossil-0.5.35 spec/sequel/pervasive_adapter_spec.rb
fossil-0.5.34 spec/sequel/pervasive_adapter_spec.rb
fossil-0.5.33 spec/sequel/pervasive_adapter_spec.rb
fossil-0.5.32 spec/sequel/pervasive_adapter_spec.rb
fossil-0.5.31 spec/sequel/pervasive_adapter_spec.rb