lib/gem_suit/cli/application.rb in gem_suit-0.1.2 vs lib/gem_suit/cli/application.rb in gem_suit-0.1.3
- old
+ new
@@ -15,10 +15,22 @@
test_functional
test_integration
test_suit
end
+ def test_unit(file_or_pattern = nil)
+ run_tests :unit, file_or_pattern
+ end
+
+ def test_functional(file_or_pattern = nil)
+ run_tests :functional, file_or_pattern
+ end
+
+ def test_integration(file_or_pattern = nil)
+ run_tests :integration, file_or_pattern
+ end
+
def test_suit(file_or_pattern = nil)
assert_suit_dir
data = IOBuffer.capture do |buffer|
(options.rails_versions || major_rails_versions).each do |rails_version|
@@ -33,22 +45,10 @@
end
print_test_results "Suit", data
end
- def test_unit(file_or_pattern = nil)
- run_tests :unit, file_or_pattern
- end
-
- def test_functional(file_or_pattern = nil)
- run_tests :functional, file_or_pattern
- end
-
- def test_integration(file_or_pattern = nil)
- run_tests :integration, file_or_pattern
- end
-
private
def run_tests(type, file_or_pattern)
raise ArgumentError, "Only :unit, :functional and :integration are allowed" unless [:unit, :functional, :integration].include? type
@@ -121,11 +121,11 @@
MAJOR_RAILS_VERSIONS = [2, 3]
DESCRIPTION_MATCH = /^Setting up test environment for (.*)$/
LOAD_MATCH = /^Loaded suite suit\/rails-(\d+)\/dummy\/test\/integration\/suit\/(.*)$/
GEM_SUIT_MATCH = /^GemSuit: (.*)$/
TIME_MATCH = /^Finished in (.*)\.$/
- SUMMARY_MATCH = /^(\d+) (\w+), (\d+) (\w+), (\d+) (\w+), (\d+) (\w+)$/
+ SUMMARY_MATCH = /^(\d+ \w+(, )?)+$/
def print_test_results(section, data)
return if (suit_tests = extract_test_results(data)).empty?
failures = suit_tests.inject(0) do |count, test|
@@ -157,14 +157,14 @@
end
if line.match(TIME_MATCH)
result.last[:time] = $1
end
if line.match(SUMMARY_MATCH)
- result.last[:summary ] = line
- result.last[$2.to_sym] = $1
- result.last[$4.to_sym] = $3
- result.last[$6.to_sym] = $5
- result.last[$8.to_sym] = $7
+ result.last[:summary] = line
+ line.scan(/\d+ \w+/).each do |match|
+ amount, type = match.split " "
+ result.last[type.to_sym] = amount
+ end
result << {}
end
end
result.reject!{|x| x.empty?}
\ No newline at end of file