Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fixes xcode version finder #382

Merged
merged 1 commit into from
Apr 2, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions lib/xcode/install.rb
Original file line number Diff line number Diff line change
Expand Up @@ -168,8 +168,12 @@ def find_xcode_version(version)

seedlist.each do |current_seed|
return current_seed if current_seed.name == version
end

seedlist.each do |current_seed|
return current_seed if parsed_version && current_seed.version == parsed_version
end

nil
end

Expand Down
20 changes: 20 additions & 0 deletions spec/installer_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -98,4 +98,24 @@ module XcodeInstall
percentages.count.should.be.close(8, 4)
end
end

describe '#find_xcode_version' do
it 'should find the one with the matching name' do
installer = Installer.new

xcodes = [
XcodeInstall::Xcode.new('name' => '11.4 beta 2',
'files' => [{
'remotePath' => '/Developer_Tools/Xcode_11.4_beta_2/Xcode_11.4_beta_2.xip'
}]),
XcodeInstall::Xcode.new('name' => '11.4',
'files' => [{
'remotePath' => '/Developer_Tools/Xcode_11.4/Xcode_11.4.xip'
}])
]

installer.stubs(:fetch_seedlist).returns(xcodes)
installer.find_xcode_version("11.4").name.should.be.equal("11.4")
end
end
end