class Kontrast::TestSuite

Attributes

lazy_tests[R]
tests[R]

Public Class Methods

new() click to toggle source
# File lib/kontrast/test_suite.rb, line 5
def initialize
    @tests = []
    @lazy_tests = []
end

Public Instance Methods

<<(test) click to toggle source
# File lib/kontrast/test_suite.rb, line 10
def <<(test)
    if(!test.is_a?(Test))
        raise TestSuiteException.new("Cannot add a #{test.class} to the test suite.")
    end
    @tests << test
end
bind_specs() click to toggle source

Binds specs to tests automatically by matching the test's name to the spec's name

# File lib/kontrast/test_suite.rb, line 18
def bind_specs
    specs = Kontrast.get_spec_builder.specs
    specs.each do |spec|
        matched_tests = @tests.select { |t| t.to_s.include?(spec.name) }
        matched_tests.each { |t| t.bind_spec(spec) }
    end
end
clear!() click to toggle source
# File lib/kontrast/test_suite.rb, line 38
def clear!
    @tests = []
end
to_h() click to toggle source

For rspec

# File lib/kontrast/test_suite.rb, line 27
def to_h
    suite_hash = Hash.new

    @tests.each do |test|
        suite_hash[test.width] ||= {}
        suite_hash[test.width][test.name] = test.path
    end

    return suite_hash
end