Skip to content

Commit 35fcf4a

Browse files
authored
Merge pull request #535 from dnkoutso/cp_fun
Cherry-pick #504 to 1.6.x
2 parents a0bbc64 + 9ec7a1c commit 35fcf4a

File tree

3 files changed

+25
-1
lines changed

3 files changed

+25
-1
lines changed

CHANGELOG.md

+3-1
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,9 @@
88

99
##### Bug Fixes
1010

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

1315

1416
## 1.6.1 (2019-02-21)

lib/cocoapods-core/specification/consumer.rb

+13
Original file line numberDiff line numberDiff line change
@@ -371,6 +371,19 @@ def _prepare_prefix_header_contents(value)
371371
end
372372
end
373373

374+
# Converts the test type value from a string to a symbol.
375+
#
376+
# @param [String, Symbol] value.
377+
# The value of the test type attributed as specified by the user.
378+
#
379+
# @return [Symbol] the test type as a symbol.
380+
#
381+
def _prepare_test_type(value)
382+
if value
383+
value.to_sym
384+
end
385+
end
386+
374387
# Converts the array of hashes (script phases) where keys are strings into symbols.
375388
#
376389
# @param [Array<Hash{String=>String}>] value.

spec/specification/consumer_spec.rb

+9
Original file line numberDiff line numberDiff line change
@@ -272,6 +272,15 @@ module Pod
272272
test_consumer.test_type.should.be == :unit
273273
end
274274

275+
it 'returns the test type as a symbol when consuming JSON specs' do
276+
@spec.test_spec {}
277+
test_spec = @spec.test_specs.first
278+
test_spec.test_type = :unit
279+
json_spec = @spec.to_json
280+
test_consumer = Specification::Consumer.new(Specification.from_json(json_spec).test_specs.first, :ios)
281+
test_consumer.test_type.should.be == :unit
282+
end
283+
275284
it 'allows to specify whether the specification requires an app host' do
276285
@spec.test_spec {}
277286
test_spec = @spec.test_specs.first

0 commit comments

Comments
 (0)