Sha256: 11565cfc44d0585583994d6ae2662283166b0573ef537b43d6a8fcff604681fa

Contents?: true

Size: 1.31 KB

Versions: 16

Compression:

Stored size: 1.31 KB

Contents

require File.expand_path(File.join(File.dirname(__FILE__), 'spec_helper'))

describe DataObjects::Transaction do

  before :each do
    @connection = mock("connection")
    DataObjects::Connection.should_receive(:new).with("mock://mock/mock").once.and_return(@connection)
    @transaction = DataObjects::Transaction.new("mock://mock/mock")
  end

  it "should have a HOST constant" do
    DataObjects::Transaction::HOST.should_not == nil?
  end

  describe "#initialize" do
    it "should provide a connection" do
      @transaction.connection.should == @connection
    end
    it "should provide an id" do
      @transaction.id.should_not == nil
    end
    it "should provide a unique id" do
      DataObjects::Connection.should_receive(:new).with("mock://mock/mock2").once.and_return(@connection)
      @transaction.id.should_not == DataObjects::Transaction.new("mock://mock/mock2").id
    end
  end
  describe "#close" do
    it "should close its connection" do
      @connection.should_receive(:close).once
      lambda { @transaction.close }.should_not raise_error(DataObjects::TransactionError)
    end
  end
  [:prepare, :commit_prepared, :rollback_prepared].each do |meth|
    it "should raise NotImplementedError on #{meth}" do
      lambda { @transaction.send(meth) }.should raise_error(NotImplementedError)
    end
  end

end

Version data entries

16 entries across 16 versions & 1 rubygems

Version Path
data_objects-0.10.17 spec/transaction_spec.rb
data_objects-0.10.16 spec/transaction_spec.rb
data_objects-0.10.15 spec/transaction_spec.rb
data_objects-0.10.14 spec/transaction_spec.rb
data_objects-0.10.13 spec/transaction_spec.rb
data_objects-0.10.12 spec/transaction_spec.rb
data_objects-0.10.11 spec/transaction_spec.rb
data_objects-0.10.10 spec/transaction_spec.rb
data_objects-0.10.9 spec/transaction_spec.rb
data_objects-0.10.8 spec/transaction_spec.rb
data_objects-0.10.7 spec/transaction_spec.rb
data_objects-0.10.6 spec/transaction_spec.rb
data_objects-0.10.5 spec/transaction_spec.rb
data_objects-0.10.4 spec/transaction_spec.rb
data_objects-0.10.4.rc2 spec/transaction_spec.rb
data_objects-0.10.4.rc1 spec/transaction_spec.rb