diff options
| author | mansimarkaur | 2017-07-28 02:02:40 +0530 |
|---|---|---|
| committer | mansimarkaur | 2017-08-27 01:23:32 +0530 |
| commit | 657b6ef7fb67231540bac9bcf4126ec27e8e1841 (patch) | |
| tree | b7c18631d0dc77ecb6a4933ba2361817c1a8895e /Library/Homebrew/test/utils/git_spec.rb | |
| parent | d91036e8912b31e3eb145b1cb3964a321a587c4f (diff) | |
| download | brew-657b6ef7fb67231540bac9bcf4126ec27e8e1841.tar.bz2 | |
Added tests for git_available?
Diffstat (limited to 'Library/Homebrew/test/utils/git_spec.rb')
| -rw-r--r-- | Library/Homebrew/test/utils/git_spec.rb | 19 |
1 files changed, 19 insertions, 0 deletions
diff --git a/Library/Homebrew/test/utils/git_spec.rb b/Library/Homebrew/test/utils/git_spec.rb index d4eb97820..39b28794a 100644 --- a/Library/Homebrew/test/utils/git_spec.rb +++ b/Library/Homebrew/test/utils/git_spec.rb @@ -45,3 +45,22 @@ describe Git do end end end + +describe Utils do + describe "::git_available?" do + it "returns true if git --version command succeeds" do + allow_any_instance_of(Process::Status).to receive(:success?).and_return(true) + expect(described_class.git_available?).to be_truthy + end + + it "returns false if git --version command does not succeed" do + allow_any_instance_of(Process::Status).to receive(:success?).and_return(false) + expect(described_class.git_available?).to be_falsey + end + + it "returns git version if already set" do + described_class.instance_variable_set(:@git, true) + expect(described_class.git_available?).to be_truthy + end + end +end |
