Class: Testotron::TestBuilder

Inherits:
Object
  • Object
show all
Defined in:
lib/testotron.rb

Instance Method Summary collapse

Constructor Details

#initialize(runner) ⇒ TestBuilder

Returns a new instance of TestBuilder.



15
16
17
18
19
# File 'lib/testotron.rb', line 15

def initialize(runner)
	@errors = false
	@runner = runner
	@report_methods = [ :local_mail ]
end

Instance Method Details

#complain(test, failure) ⇒ Object



41
42
43
44
45
46
47
# File 'lib/testotron.rb', line 41

def complain(test, failure)
	@errors = true
	if @complaint_block
		@complaint_block.call(test, failure)
	end
	@runner.report_error(@report_methods, test, failure)
end

#complain_using(&block) ⇒ Object

Raises:

  • (ArgumentError)


55
56
57
58
# File 'lib/testotron.rb', line 55

def complain_using(&block)
	raise ArgumentError, "No block given to complain to" unless block
	@complaint_block = block
end

#errors?Boolean

Returns:

  • (Boolean)


37
38
39
# File 'lib/testotron.rb', line 37

def errors?
	@errors
end

#ok?Boolean

Returns:

  • (Boolean)


33
34
35
# File 'lib/testotron.rb', line 33

def ok?
	!@errors
end

#quietObject



60
61
62
# File 'lib/testotron.rb', line 60

def quiet
	@runner.quiet
end

#quiet!Object



68
69
70
# File 'lib/testotron.rb', line 68

def quiet!
	quiet = true
end

#quiet=(value) ⇒ Object



64
65
66
# File 'lib/testotron.rb', line 64

def quiet=(value)
	@runner.quiet = value
end

#report_with(*methods) ⇒ Object



49
50
51
52
53
# File 'lib/testotron.rb', line 49

def report_with(*methods)
	methods = methods.first if methods.length == 1
	methods = [methods] unless methods.is_a? Array
	@report_methods = methods.map(&:to_sym)
end