Sha256: 3c680c9be022f645335265480980d7f131b7a3f62250c3d50aea08750d6970b7

Contents?: true

Size: 914 Bytes

Versions: 11

Compression:

Stored size: 914 Bytes

Contents

require 'pathname'
require Pathname(__FILE__).dirname.expand_path.parent + 'spec_helper'

describe DataObjects::Postgres::Transaction do

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

  {
    :begin => "BEGIN",
    :commit => "COMMIT PREPARED 'id'",
    :rollback => "ROLLBACK",
    :rollback_prepared => "ROLLBACK PREPARED 'id'",
    :prepare => "PREPARE TRANSACTION 'id'"
  }.each do |method, command|
    it "should execute #{command} on ##{method}" do
      @command.should_receive(:execute_non_query).once
      @connection.should_receive(:create_command).once.with(command).and_return(@command)
      @transaction.send(method)
    end
  end

end

Version data entries

11 entries across 11 versions & 1 rubygems

Version Path
do_postgres-0.9.10 spec/unit/transaction_spec.rb
do_postgres-0.9.10.1 spec/unit/transaction_spec.rb
do_postgres-0.9.11 spec/unit/transaction_spec.rb
do_postgres-0.9.2 spec/unit/transaction_spec.rb
do_postgres-0.9.3 spec/unit/transaction_spec.rb
do_postgres-0.9.4 spec/unit/transaction_spec.rb
do_postgres-0.9.5 spec/unit/transaction_spec.rb
do_postgres-0.9.6 spec/unit/transaction_spec.rb
do_postgres-0.9.7 spec/unit/transaction_spec.rb
do_postgres-0.9.8 spec/unit/transaction_spec.rb
do_postgres-0.9.9 spec/unit/transaction_spec.rb