Sha256: 4729d1e7bb2403271eb2187ed9bf1a170ac60cec96c933772a2b3f8066768abf

Contents?: true

Size: 966 Bytes

Versions: 3

Compression:

Stored size: 966 Bytes

Contents

require 'spec_helper'

describe Git do

  describe 'Git::Lib.native' do

    it "should validate the Git binary once and only once" do

      lib1 = Git::Lib.new(:working_directory => fullpath('.'))
      lib1.stub!(:required_command_version).and_return( [20, 0, 0, 1])

      $stderr.should_receive(:puts).with(/gem requires git 20.0.0.1 or later/i)
      # NOTE: any native git command will suffice for this test, 'version' is just
      # fast and doesn't require a repo setup
      lib1.native 'version'

      # do it again with same instance
      $stderr.should_not_receive(:puts).with(/gem requires git 20.0.0.1 or later/i)
      lib1.native 'version'

      # do it again with new instance
      lib2 = Git::Lib.new(:working_directory => fullpath('.'))
      lib2.stub!(:required_command_version).and_return( [20, 0, 0, 1])

      $stderr.should_not_receive(:puts).with(/gem requires git 20.0.0.1 or later/i)
      lib2.native 'version'
    end
  end

end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
repo_manager-0.7.3 spec/repo_manager/git_spec.rb
repo_manager-0.7.2 spec/repo_manager/git_spec.rb
repo_manager-0.7.1 spec/repo_manager/git_spec.rb