Skip to content

Commit

Permalink
Merge pull request #535 from dnkoutso/cp_fun
Browse files Browse the repository at this point in the history
Cherry-pick #504 to 1.6.x
  • Loading branch information
dnkoutso authored May 7, 2019
2 parents a0bbc64 + 9ec7a1c commit 35fcf4a
Show file tree
Hide file tree
Showing 3 changed files with 25 additions and 1 deletion.
4 changes: 3 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +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

0 comments on commit 35fcf4a

Please sign in to comment.