Class: Xcodeproj::XCScheme::TestAction

Inherits:
Object
  • Object
show all
Defined in:
lib/cocoapods-unit-test/xcodeproj/test_action.rb

Overview

This class wraps the TestAction node of a .xcscheme XML file

Instance Method Summary collapse

Instance Method Details

#add_coverage_target(target, root_project = nil) ⇒ Object

Parameters:



36
37
38
# File 'lib/cocoapods-unit-test/xcodeproj/test_action.rb', line 36

def add_coverage_target(target, root_project = nil)
  add_coverage_target_ref BuildableReference.new(target, root_project) unless target.nil?
end

#add_coverage_target_ref(ref) ⇒ Object

Parameters:

  • targets (BuildableReference)


21
22
23
24
25
26
27
28
29
30
31
# File 'lib/cocoapods-unit-test/xcodeproj/test_action.rb', line 21

def add_coverage_target_ref(ref)
  coverage_targets = @xml_element.elements['CodeCoverageTargets'] || @xml_element.add_element('CodeCoverageTargets')

  added = coverage_targets.get_elements('BuildableReference').map { |node|
    BuildableReference.new(node)
  }.select { |build| build.target_name == ref.target_name }
  
  if added.empty?
    coverage_targets.add_element(ref.xml_element)
  end
end

#coverage_specified_targets=(flag) ⇒ Object

Parameters:

  • flag (Bool)


15
16
17
# File 'lib/cocoapods-unit-test/xcodeproj/test_action.rb', line 15

def coverage_specified_targets=(flag)
  @xml_element.attributes['onlyGenerateCoverageForSpecifiedTargets'] = bool_to_string(flag)
end

#coverage_specified_targets?Boolean

Returns:

  • (Boolean)


10
11
12
# File 'lib/cocoapods-unit-test/xcodeproj/test_action.rb', line 10

def coverage_specified_targets?
  string_to_bool(@xml_element.attributes['onlyGenerateCoverageForSpecifiedTargets'])
end