Bug fix to make sure git check works properly.
This commit is contained in:
@@ -16,9 +16,9 @@ module Homesick
|
|||||||
return false unless info.count == 3
|
return false unless info.count == 3
|
||||||
current_version = Hash[ [:major, :minor, :patch].zip(info) ]
|
current_version = Hash[ [:major, :minor, :patch].zip(info) ]
|
||||||
return true if current_version.eql?(MIN_VERSION)
|
return true if current_version.eql?(MIN_VERSION)
|
||||||
current_version.each do |k,v|
|
return true if current_version[:major] > MIN_VERSION[:major]
|
||||||
return true if v > MIN_VERSION[k]
|
return true if current_version[:major] == MIN_VERSION[:major] && current_version[:minor] > MIN_VERSION[:minor]
|
||||||
end
|
return true if current_version[:major] == MIN_VERSION[:major] && current_version[:minor] == MIN_VERSION[:minor] && current_version[:patch] >= MIN_VERSION[:patch]
|
||||||
false
|
false
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|||||||
@@ -24,17 +24,17 @@ describe Homesick::CLI do
|
|||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
context 'when git is not installed' do
|
context 'when a git version that doesn\'t meet the minimum required is installed' do
|
||||||
before do
|
before do
|
||||||
expect_any_instance_of(Homesick::Actions::GitActions).to receive(:`).and_return("git version 1.0.0")
|
expect_any_instance_of(Homesick::Actions::GitActions).to receive(:`).and_return("git version 1.7.6")
|
||||||
end
|
end
|
||||||
it 'should raise an exception when' do
|
it 'should raise an exception' do
|
||||||
output = Capture.stdout{ expect{Homesick::CLI.new}.to raise_error SystemExit }
|
output = Capture.stdout{ expect{Homesick::CLI.new}.to raise_error SystemExit }
|
||||||
expect(output.chomp).to include(Homesick::Actions::GitActions::STRING)
|
expect(output.chomp).to include(Homesick::Actions::GitActions::STRING)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
context 'when git is installed' do
|
context 'when a git version that is the same as the minimum required is installed' do
|
||||||
before do
|
before do
|
||||||
expect_any_instance_of(Homesick::Actions::GitActions).to receive(:`).at_least(:once).and_return("git version #{Homesick::Actions::GitActions::STRING}")
|
expect_any_instance_of(Homesick::Actions::GitActions).to receive(:`).at_least(:once).and_return("git version #{Homesick::Actions::GitActions::STRING}")
|
||||||
end
|
end
|
||||||
@@ -43,6 +43,17 @@ describe Homesick::CLI do
|
|||||||
expect(output.chomp).not_to include(Homesick::Actions::GitActions::STRING)
|
expect(output.chomp).not_to include(Homesick::Actions::GitActions::STRING)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
context 'when a git version that is greater than the minimum required is installed' do
|
||||||
|
before do
|
||||||
|
expect_any_instance_of(Homesick::Actions::GitActions).to receive(:`).at_least(:once).and_return("git version 3.9.8")
|
||||||
|
end
|
||||||
|
it 'should not raise an exception' do
|
||||||
|
output = Capture.stdout{ expect{Homesick::CLI.new}.not_to raise_error }
|
||||||
|
expect(output.chomp).not_to include(Homesick::Actions::GitActions::STRING)
|
||||||
|
end
|
||||||
|
|
||||||
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
describe 'clone' do
|
describe 'clone' do
|
||||||
|
|||||||
Reference in New Issue
Block a user