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

Ensure test_type value is converted to a symbol from consumer #504

Merged
merged 2 commits into from
Jan 9, 2019
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
2 changes: 1 addition & 1 deletion .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ script: bundle exec rake spec
git:
submodules: false
before_install:
- gem install bundler
- gem install bundler -v "~> 1.17"
- |
master_sha="$(ruby -e "puts '`git submodule status spec/fixtures/spec-repos/master`'.strip.sub(/^-/, '').split(/\s/, 2).first")"
curl -ssL "https://github.com/CocoaPods/Specs/archive/$master_sha.tar.gz" | tar xz -C spec/fixtures/spec-repos
Expand Down
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,10 @@

##### Bug Fixes

* 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)

* Fix several array sorting inconsistencies when generating a Lockfile.
When a Lockfile is being written to disk, `YAMLHelper` sorts arrays by `&:downcase`.
When a new Lockfile is generated, the sort order is plain lexicographical.
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 @@ -376,6 +376,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