class Gem2Rpm::TestSuite

Constants

TEST_FRAMEWORKS
TestFramework

Public Class Methods

new(spec) click to toggle source

Returns new test suite list detected from Gem::Specification.

# File lib/gem2rpm/test_suite.rb, line 19
def initialize(spec)
  @items = detect_test_frameworks(spec)
end

Public Instance Methods

each() { |item| ... } click to toggle source

Calls the given block once for each element in self, passing that element as a parameter. Returns the array itself. If no block is given, an Enumerator is returned.

# File lib/gem2rpm/test_suite.rb, line 26
def each
  # Return Enumerator when called withoug block.
  return to_enum(__callee__) unless block_given?

  @items.each { |item| yield item }
end

Private Instance Methods

detect_test_frameworks(spec) click to toggle source
# File lib/gem2rpm/test_suite.rb, line 35
def detect_test_frameworks(spec)
  from_development_dependencies(spec)
  # TODO: Try to guess the test framework from spec.files. This could
  # improve the test execution command a bit, but might not be reliable.
end
from_development_dependencies(spec) click to toggle source
# File lib/gem2rpm/test_suite.rb, line 41
def from_development_dependencies(spec)
  deps = spec.development_dependencies.map(&:name)
  TEST_FRAMEWORKS.select { |tf| deps.include?(tf.name) }.map(&:dup)
end