Sha256: de2c71aa87d5fc2beb49d88729c62d1f2e571bb3a9bdee9590c7b8dbabd5f133
Contents?: true
Size: 1.07 KB
Versions: 5
Compression:
Stored size: 1.07 KB
Contents
require File.expand_path("../../../spec_helper", __FILE__) describe CukeQ::Scm::GitBridge do include FileUtils GIT_URL = "git://example.com" WORKING_COPY = "spec-scm-repo" after(:each) do rm_rf WORKING_COPY end def mock_repo @mock_repo ||= mock("Git::Base").as_null_object end def bridge @bridge ||= CukeQ::Scm::GitBridge.new(GIT_URL, WORKING_COPY) end it "clones the repo of it doesn't exist" do Git.stub!(:open) Git.should_receive(:clone).with(GIT_URL, WORKING_COPY) bridge.repo end it "does not clone the repo if it already exists" do Git.stub!(:open) Git.should_receive(:clone).never mkdir WORKING_COPY bridge.repo end it "fetches the current revision" do bridge.stub!(:repo).and_return(mock_repo) mock_repo.should_receive(:revparse).with("HEAD").and_return("rev") bridge.current_revision.should == "rev" end it "updates the working copy" do bridge.stub!(:repo).and_return(mock_repo) mock_repo.should_receive(:reset_hard) mock_repo.should_receive(:pull) bridge.update {} end end
Version data entries
5 entries across 5 versions & 1 rubygems