lib/turn/components/case.rb in turn-0.7.0 vs lib/turn/components/case.rb in turn-0.8.0
- old
+ new
@@ -1,9 +1,10 @@
module Turn
#
class TestCase
+ include Enumerable
# Name of test case.
attr_accessor :name
# Test methods.
@@ -15,11 +16,11 @@
#attr_accessor :count_passes
#attr_accessor :count_failures
#attr_accessor :count_errors
#attr_accessor :count_tests
- # This can;t be calculated, so it must be
+ # This can't be calculated, so it must be
# assigned by the runner.
attr_accessor :count_assertions
# Holds dump of test output (optional depending on runner).
attr_accessor :message
@@ -69,10 +70,12 @@
def count_tests
tests.size
end
+ alias_method :size, :count_tests
+
def count_failures
sum = 0; tests.each{ |t| sum += 1 if t.fail? }; sum
end
def count_errors
@@ -90,9 +93,12 @@
def message
tests.collect{ |t| t.message }.join("\n")
end
+ def each(&block)
+ tests.each(&block)
+ end
end
end