Sha256: 066ff2efa0568a53104d09e7c15e715f75e56e8e4b39b3044f7757e322218574
Contents?: true
Size: 1.07 KB
Versions: 14
Compression:
Stored size: 1.07 KB
Contents
require 'pathname' require Pathname(__FILE__).dirname.expand_path.parent + 'spec_helper' describe DataObjects::Sqlite3::Transaction do before :each do @connection = mock("connection") DataObjects::Connection.should_receive(:new).with("mock://mock/mock").once.and_return(@connection) @transaction = DataObjects::Sqlite3::Transaction.new("mock://mock/mock") @transaction.id.replace("id") @command = mock("command") end { :begin => "BEGIN", :commit => "COMMIT", :rollback => "ROLLBACK", :rollback_prepared => "ROLLBACK", :prepare => nil }.each do |method, commands| it "should execute #{commands.inspect} on ##{method}" do if commands.is_a?(String) @command.should_receive(:execute_non_query).once @connection.should_receive(:create_command).once.with(commands).and_return(@command) @transaction.send(method) elsif commands.nil? @command.should_not_receive(:execute_non_query) @connection.should_not_receive(:create_command) @transaction.send(method) end end end end
Version data entries
14 entries across 14 versions & 1 rubygems