class Kontrast::TestBuilder

Attributes

headers[RW]
prefix[RW]
suite[R]
url_params[RW]

Public Class Methods

new() click to toggle source
# File lib/kontrast/test_builder.rb, line 9
def initialize
    @suite = TestSuite.new
    @prefix = nil
    @headers = {}
    @url_params = {}
end

Public Instance Methods

lazy_api_endpoints(&block) click to toggle source
# File lib/kontrast/test_builder.rb, line 32
def lazy_api_endpoints(&block)
    @suite.lazy_tests << LazyTest.new(@prefix, @headers.dup, block)
end
method_missing(name, *args) click to toggle source

Adds a given test from config to the suite

# File lib/kontrast/test_builder.rb, line 37
def method_missing(name, *args)
    @suite << PageTest.new(@prefix, name.to_s, args.first, url_params: @url_params)
end
tests(param = nil) click to toggle source

Needed in case someone tries to name a test “tests”

# File lib/kontrast/test_builder.rb, line 17
def tests(param = nil)
    if param
        raise ConfigurationException.new("'tests' is not a valid name for a test.")
    end
    return @suite.tests
end