Sha256: 10ab4fbe115b7b04c60a6a395cd307b66b4e71f701f11525d59a531753e99911
Contents?: true
Size: 1.48 KB
Versions: 3
Compression:
Stored size: 1.48 KB
Contents
require 'gem2rpm/rpm_file_list' module Gem2Rpm class TestSuite include Enumerable TestFramework = Struct.new :name, :command TEST_FRAMEWORKS = [ TestFramework.new('cucumber', %|cucumber|), TestFramework.new('minitest', %|ruby -e 'Dir.glob "./test/**/*_test.rb", &method(:require)'|), TestFramework.new('rspec', %|rspec spec|), TestFramework.new('shindo', %|shindont|), TestFramework.new('test-unit', %|ruby -e 'Dir.glob "./test/**/*_test.rb", &method(:require)'|), TestFramework.new('bacon', %|bacon -a|), ].freeze # Returns new test suite list detected from Gem::Specification. def initialize(spec) @items = detect_test_frameworks(spec) end # 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. def each # Return Enumerator when called withoug block. return to_enum(__callee__) unless block_given? @items.each { |item| yield item } end private 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 def from_development_dependencies(spec) deps = spec.development_dependencies.map(&:name) TEST_FRAMEWORKS.select { |tf| deps.include?(tf.name) }.map(&:dup) end end end
Version data entries
3 entries across 3 versions & 1 rubygems
Version | Path |
---|---|
gem2rpm-1.0.2 | lib/gem2rpm/test_suite.rb |
gem2rpm-1.0.1 | lib/gem2rpm/test_suite.rb |
gem2rpm-1.0.0 | lib/gem2rpm/test_suite.rb |