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

Cherry-pick json fix to 1.6.x #533

Closed
wants to merge 1 commit into from
Closed
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
5 changes: 3 additions & 2 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,9 @@

##### Bug Fixes

* None.

* Ensure `test_type` value is converted to a symbol from consumers of JSON podspecs.
[Dimitris Koutsogiorgas](https://github.com/dnkoutso)
[#504](https://github.com/CocoaPods/Core/pull/504)

## 1.6.1 (2019-02-21)

Expand Down
13 changes: 13 additions & 0 deletions lib/cocoapods-core/specification/consumer.rb
Original file line number Diff line number Diff line change
Expand Up @@ -371,6 +371,19 @@ def _prepare_prefix_header_contents(value)
end
end

# Converts the test type value from a string to a symbol.
#
# @param [String, Symbol] value.
# The value of the test type attributed as specified by the user.
#
# @return [Symbol] the test type as a symbol.
#
def _prepare_test_type(value)
if value
value.to_sym
end
end

# Converts the array of hashes (script phases) where keys are strings into symbols.
#
# @param [Array<Hash{String=>String}>] value.
Expand Down
9 changes: 9 additions & 0 deletions spec/specification/consumer_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -272,6 +272,15 @@ module Pod
test_consumer.test_type.should.be == :unit
end

it 'returns the test type as a symbol when consuming JSON specs' do
@spec.test_spec {}
test_spec = @spec.test_specs.first
test_spec.test_type = :unit
json_spec = @spec.to_json
test_consumer = Specification::Consumer.new(Specification.from_json(json_spec).test_specs.first, :ios)
test_consumer.test_type.should.be == :unit
end

it 'allows to specify whether the specification requires an app host' do
@spec.test_spec {}
test_spec = @spec.test_specs.first
Expand Down