Class: Turn::TestCase

### Home Classes Methods

### In Files

- lib/turn/components/case.rb

### Parent

Object

### Methods

- ::new
- #count_errors
- #count_failures
- #count_passes
- #count_skips
- #count_tests
- #counts
- #each
- #error?
- #fail?
- #message
- #new_test
- #pass?
- #size

### Included Modules

- Enumerable

### Files

- History.txt
- LICENSE-GPL2.txt
- LICENSE-MIT.txt
- LICENSE-RUBY.txt
- LICENSE.txt
- Release.txt
- Version.txt

### Class/Module Index

Quicksearch

- Turn
- Turn::Colorize
- Turn::Command
- Turn::Configuration
- Turn::Controller
- Turn::CrossRunner
- Turn::CueReporter
- Turn::DotReporter
- Turn::IsoRunner
- Turn::MarshalReporter
- Turn::MiniRunner
- Turn::OutlineReporter
- Turn::PrettyReporter
- Turn::ProgressReporter
- Turn::Reporter
- Turn::SoloRunner
- Turn::TestCase
- Turn::TestMethod
- Turn::TestRunner
- Turn::TestSuite
- Test
- Test::Unit
- Test::Unit::Failure
- Object
- String

No matching classes.

# Turn::TestCase

### Attributes

count_assertions[RW]

This can't be calculated, so it must be assigned by the runner.

files[RW]

Some runners marshal tests per file.

message[W]

Holds dump of test output (optional depending on runner).

name[RW]

Name of test case.

tests[RW]

Test methods.

### Public Class Methods

new(name, *files) click to toggle source

    # File lib/turn/components/case.rb, line 32
    def initialize(name, *files)
      @name  = name
      @files = (files.empty? ? [name] : files)
      @tests = []

      @message = nil
      @count_assertions = 0

      #@count_tests      = 0
      #@count_failures   = 0
      #@count_errors     = 0

      #@command = command
    end

### Public Instance Methods

count_errors() click to toggle source

    # File lib/turn/components/case.rb, line 81
    def count_errors
      sum = 0; tests.each{ |t| sum += 1 if t.error? }; sum
    end

count_failures() click to toggle source

    # File lib/turn/components/case.rb, line 77
    def count_failures
      sum = 0; tests.each{ |t| sum += 1 if t.fail? }; sum
    end

count_passes() click to toggle source

    # File lib/turn/components/case.rb, line 85
    def count_passes
      sum = 0; tests.each{ |t| sum += 1 if t.pass? }; sum
    end

count_skips() click to toggle source

    # File lib/turn/components/case.rb, line 89
    def count_skips
      # Why not use tests.select(&:skip?).size ?
      sum = 0; tests.each{ |t| sum += 1 if t.skip? }; sum
    end

count_tests() click to toggle source

    # File lib/turn/components/case.rb, line 71
    def count_tests
      tests.size
    end

Also aliased as: size
counts() click to toggle source

    # File lib/turn/components/case.rb, line 95
    def counts
      return count_tests, count_assertions, count_failures, count_errors, count_skips
    end

each(&block) click to toggle source

    # File lib/turn/components/case.rb, line 103
    def each(&block)
      tests.each(&block)
    end

error?() click to toggle source

Were there any errors?

    # File lib/turn/components/case.rb, line 57
    def error?
      count_errors != 0
    end

fail?() click to toggle source

Were there any failures?

    # File lib/turn/components/case.rb, line 62
    def fail?
      count_failures != 0
    end

message() click to toggle source

    # File lib/turn/components/case.rb, line 99
    def message
      tests.collect{ |t| t.message }.join("\n")
    end

new_test(name) click to toggle source

    # File lib/turn/components/case.rb, line 47
    def new_test(name)
      c = TestMethod.new(name)
      @tests << c
      c
    end

pass?() click to toggle source

Did all tests/assertion pass?

    # File lib/turn/components/case.rb, line 67
    def pass?
      not(fail? or error?)
    end

size() click to toggle source
Alias for: count_tests

[Validate]

Generated with the Darkfish Rdoc Generator 2.