Sha256: e7fbcc5df59364545b140da6fdc839fc665d9d8ad1b50c0392b37d90f5d602ee

Contents?: true

Size: 1.04 KB

Versions: 4

Compression:

Stored size: 1.04 KB

Contents

require 'git_tracker'

describe GitTracker do
  subject { described_class }
  let(:args) { ["a_file", "the_source", "sha1234"] }

  describe ".execute" do
    before do
      subject.stub(:prepare_commit_msg) { true }
    end

    it "runs the hook, passing the args" do
      subject.should_receive(:prepare_commit_msg).with(*args) { true }
      subject.execute('prepare-commit-msg', *args)
    end

    # TODO: stop the abort from writing to stderr during tests?
    it "doesn't run hooks we don't know about" do
      lambda { subject.execute('non-existent-hook', *args) }.
        should raise_error SystemExit, "[git_tracker] command: 'non-existent-hook' does not exist."
    end
  end

  describe ".prepare_commit_msg" do
    it "runs the hook, passing the args" do
      GitTracker::PrepareCommitMessage.should_receive(:run).with(*args) { true }
      subject.prepare_commit_msg(*args)
    end
  end

  describe ".install" do
    it 'tells the hook to install itself' do
      GitTracker::Hook.should_receive(:install)
      subject.install
    end
  end

end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
git_tracker-1.1.0 spec/git_tracker_spec.rb
git_tracker-1.0.2 spec/git_tracker_spec.rb
git_tracker-1.0.1 spec/git_tracker_spec.rb
git_tracker-1.0.0 spec/git_tracker_spec.rb