Sha256: e210803105ee5040b10f2d0d42954f79f7b2d2d3c9e03d3b13f7d47451eac02c

Contents?: true

Size: 872 Bytes

Versions: 17

Compression:

Stored size: 872 Bytes

Contents

require 'spec_helper'
require 'r10k/git'

describe R10K::Git::Commit do

  let(:ref) { '96eeaba8c5069e31400a3dfcbeb37d016c1b1980' }
  let(:repo) { double('git repository') }
  subject { described_class.new(ref) }


  describe "determining if the commit can be resolved" do
    before do
      subject.repository = repo
    end

    it "is true if the commit can be rev-parsed" do
      expect(repo).to receive(:rev_parse).with(ref).and_return ref
      expect(subject).to be_resolvable
    end

    it "is true if the commit cannot be rev-parsed" do
      expect(repo).to receive(:rev_parse).with(ref).and_raise(R10K::Git::UnresolvableRefError, :ref => ref)
      expect(subject).to_not be_resolvable
    end
  end

  it "can be converted to a string" do
    expect(subject.to_s).to eq ref
  end

  it_behaves_like "a git ref"
  it_behaves_like "an immutable git ref"
end

Version data entries

17 entries across 17 versions & 1 rubygems

Version Path
r10k-1.4.2 spec/unit/git/commit_spec.rb
r10k-1.4.1 spec/unit/git/commit_spec.rb
r10k-1.4.0 spec/unit/git/commit_spec.rb
r10k-1.3.5 spec/unit/git/commit_spec.rb
r10k-1.3.4 spec/unit/git/commit_spec.rb
r10k-1.2.4 spec/unit/git/commit_spec.rb
r10k-1.3.3 spec/unit/git/commit_spec.rb
r10k-1.3.2 spec/unit/git/commit_spec.rb
r10k-1.2.3 spec/unit/git/commit_spec.rb
r10k-1.3.1 spec/unit/git/commit_spec.rb
r10k-1.2.2 spec/unit/git/commit_spec.rb
r10k-1.3.0 spec/unit/git/commit_spec.rb
r10k-1.3.0rc1 spec/unit/git/commit_spec.rb
r10k-1.2.1 spec/unit/git/commit_spec.rb
r10k-1.2.0 spec/unit/git/commit_spec.rb
r10k-1.2.0rc2 spec/unit/git/commit_spec.rb
r10k-1.2.0rc1 spec/unit/git/commit_spec.rb