Sha256: b8ac0075034c30903414f5d76565257459e4a50eea5a700dfba6abe48bc61ceb
Contents?: true
Size: 1.44 KB
Versions: 8
Compression:
Stored size: 1.44 KB
Contents
require 'spec_helper' describe GitModel::Transaction do describe '#execute' do it "yields to a given block" do m = mock("mock") m.should_receive(:a_method) GitModel::Transaction.new.execute do m.a_method end end describe "when called the first time" do it "creates a new Git index" do index = mock("index") index.stub!(:read_tree) index.stub!(:commit) Grit::Index.should_receive(:new).and_return(index) GitModel::Transaction.new.execute {} end it "commits after yielding" do index = mock("index") index.stub!(:read_tree) index.should_receive(:commit) Grit::Index.should_receive(:new).and_return(index) GitModel::Transaction.new.execute {} end it "can create the first commit in the repo" do GitModel::Transaction.new.execute do |t| t.index.add "foo", "foo" end end # TODO it "locks the branch while committing" # TODO it "merges commits from concurrent transactions" end describe "when called recursively" do it "re-uses the existing git index and doesn't commit" do index = mock("index") index.stub!(:read_tree) index.should_receive(:commit).once Grit::Index.should_receive(:new).and_return(index) GitModel::Transaction.new.execute do |t| t.execute {} end end end end end
Version data entries
8 entries across 8 versions & 1 rubygems