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

Make initializing Platform with a string 'macos' behave the same as Platform.macos #602

Merged
merged 2 commits into from
Oct 24, 2019
Merged
Show file tree
Hide file tree
Changes from 1 commit
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/cocoapods-core/platform.rb
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,10 @@ def initialize(input, target = nil)
@symbolic_name = input.name
@deployment_target = input.deployment_target
else
# Allow `Platform.new('macos')` to be equivalent to `Platform.macos`
if input == 'macos'
input = 'osx'
end
@symbolic_name = input.to_sym
target = target[:deployment_target] if target.is_a?(Hash)
@deployment_target = Version.create(target)
Expand Down
10 changes: 8 additions & 2 deletions spec/platform_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -29,8 +29,14 @@ module Pod
end

it 'can be initialized with a string symbolic name' do
Platform.new('ios')
@platform.name.should == :ios
platform = Platform.new('ios')
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this was initializing a new platform and throwing it away, and then checking state initialized elsewhere. not an effective test

platform.name.should == :ios
end

it 'can be initialized with a string representing macOS' do
platform = Platform.new('macos')
platform.name.should == :osx
platform.string_name.should == 'macOS'
end

it 'exposes its name as string' do
Expand Down