Class: QED::Reporter::BaseClass

Inherits:
Object
  • Object
show all
Defined in:
lib/qed/reporter/base.rb

Overview

Reporter BaseClass

Serves as the base class for all other specification output formats.

Direct Known Subclasses

DotProgress, Summary, Verbatim

Constant Summary collapse

ANSICode =
ANSI::Code

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(io = STDOUT) ⇒ BaseClass

Returns a new instance of BaseClass.



22
23
24
25
26
27
28
29
# File 'lib/qed/reporter/base.rb', line 22

def initialize(io=STDOUT)
  @io    = io
  @specs = 0
  @steps = 0
  @pass  = []
  @fail  = []
  @error = []
end

Instance Attribute Details

#errorObject (readonly)

Returns the value of attribute error.



20
21
22
# File 'lib/qed/reporter/base.rb', line 20

def error
  @error
end

#failObject (readonly)

Returns the value of attribute fail.



19
20
21
# File 'lib/qed/reporter/base.rb', line 19

def fail
  @fail
end

#ioObject (readonly)

Returns the value of attribute io.



16
17
18
# File 'lib/qed/reporter/base.rb', line 16

def io
  @io
end

#passObject (readonly)

Returns the value of attribute pass.



18
19
20
# File 'lib/qed/reporter/base.rb', line 18

def pass
  @pass
end

#stepsObject (readonly)

Returns the value of attribute steps.



17
18
19
# File 'lib/qed/reporter/base.rb', line 17

def steps
  @steps
end

Instance Method Details

#report_comment(step) ⇒ Object

Report a comment.



45
46
# File 'lib/qed/reporter/base.rb', line 45

def report_comment(step)
end

#report_end(spec) ⇒ Object

End of a specification.



90
91
# File 'lib/qed/reporter/base.rb', line 90

def report_end(spec)
end

#report_error(step, exception) ⇒ Object

Report step raised an error.



69
70
71
72
# File 'lib/qed/reporter/base.rb', line 69

def report_error(step, exception)
  raise exception if $RESPECT_DEBUG
  @error << [step, exception]
end

#report_fail(step, assertion) ⇒ Object

Report step failed.



64
65
66
# File 'lib/qed/reporter/base.rb', line 64

def report_fail(step, assertion)
  @fail << [step, assertion]
end

#report_header(step) ⇒ Object

Report a header.



41
42
# File 'lib/qed/reporter/base.rb', line 41

def report_header(step)
end

#report_introObject

Before running any specifications.



32
33
# File 'lib/qed/reporter/base.rb', line 32

def report_intro
end

#report_macro(step) ⇒ Object

Since regular macro step does not pass or fail, this method is used instead.

TODO: Rename to #report_nominal (?)



78
79
# File 'lib/qed/reporter/base.rb', line 78

def report_macro(step)
end

#report_omit(step) ⇒ Object

Report on omitted step.



82
83
# File 'lib/qed/reporter/base.rb', line 82

def report_omit(step)
end

#report_pass(step) ⇒ Object

Report step passed.



59
60
61
# File 'lib/qed/reporter/base.rb', line 59

def report_pass(step)
  @pass << step
end

#report_start(spec) ⇒ Object

Beginning of a specification.



36
37
38
# File 'lib/qed/reporter/base.rb', line 36

def report_start(spec)
  @specs += 1
end

#report_step(step) ⇒ Object

Before running a step.



54
55
56
# File 'lib/qed/reporter/base.rb', line 54

def report_step(step)
  @steps += 1
end

#report_step_end(step) ⇒ Object

After running a step.



86
87
# File 'lib/qed/reporter/base.rb', line 86

def report_step_end(step)
end

#report_summaryObject

After running all specifications.



94
95
# File 'lib/qed/reporter/base.rb', line 94

def report_summary
end