Skip to content

Commit

Permalink
[pod] whitelisting: code style and specs
Browse files Browse the repository at this point in the history
  • Loading branch information
nevyn-lookback committed Dec 13, 2013
1 parent affbeae commit 296df85
Show file tree
Hide file tree
Showing 2 changed files with 24 additions and 5 deletions.
10 changes: 5 additions & 5 deletions lib/cocoapods-core/podfile/target_definition.rb
Original file line number Diff line number Diff line change
Expand Up @@ -332,13 +332,13 @@ def inhibit_warnings_for_pod(pod_name)
#
def is_pod_whitelisted_for_configuration?(pod_name, configuration_name)
found = false
configuration_pod_whitelist.each { |configuration, pods|
configuration_pod_whitelist.each do |configuration, pods|
if pods.include?(pod_name)
found = true
return true if configuration.to_s == configuration_name.to_s
end
}
return !found
end
!found
end

# Whitelists a pod for a specific configuration. If a pod is whitelisted
Expand Down Expand Up @@ -693,9 +693,9 @@ def parse_configuration_whitelist(name, requirements)

configurations_to_whitelist_in = options.delete(:configurations)
if configurations_to_whitelist_in
configurations_to_whitelist_in.each{ |configuration|
configurations_to_whitelist_in.each do |configuration|
whitelist_pod_for_configuration(name, configuration)
}
end
end

requirements.pop if options.empty?
Expand Down
19 changes: 19 additions & 0 deletions spec/podfile/target_definition_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -230,6 +230,25 @@ module Pod

#--------------------------------------#

it "whitelists pods by default" do
@root.store_pod("ObjectiveSugar")
@root.should.is_pod_whitelisted_for_configuration?("ObjectiveSugar", "Release")
end

it "does not enable pods for un-whitelisted configurations if it is whitelisted for another" do
@root.store_pod("ObjectiveSugar")
@root.whitelist_pod_for_configuration("ObjectiveSugar", "Release")
@root.should.not.is_pod_whitelisted_for_configuration?("ObjectiveSugar", "Debug")
end

it "enables pods for configurations they are whitelisted for" do
@root.store_pod("ObjectiveSugar")
@root.whitelist_pod_for_configuration("ObjectiveSugar", "Release")
@root.should.is_pod_whitelisted_for_configuration?("ObjectiveSugar", "Release")
end

#--------------------------------------#

it "returns its platform" do
@root.platform.should == Pod::Platform.new(:ios, '6.0')
end
Expand Down

0 comments on commit 296df85

Please sign in to comment.