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

Ditto, DotProgress, Summary, Verbatim

Constant Summary collapse

ANSICode =
ANSI::Code

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(options = {}) ⇒ BaseClass

Returns a new instance of BaseClass.



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

def initialize(options={})
  @io      = options[:io] || STDOUT
  @verbose = options[:verbose]

  @demos = 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.



52
53
# File 'lib/qed/reporter/base.rb', line 52

def report_comment(step)
end

#report_end(spec) ⇒ Object

End of a specification.



97
98
# File 'lib/qed/reporter/base.rb', line 97

def report_end(spec)
end

#report_error(step, exception) ⇒ Object

Report step raised an error.



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

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

#report_fail(step, assertion) ⇒ Object

Report step failed.



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

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

#report_header(step) ⇒ Object

Report a header.



48
49
# File 'lib/qed/reporter/base.rb', line 48

def report_header(step)
end

#report_introObject

Before running any specifications.



39
40
# File 'lib/qed/reporter/base.rb', line 39

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 (?)



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

def report_macro(step)
end

#report_omit(step) ⇒ Object

Report on omitted step.



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

def report_omit(step)
end

#report_pass(step) ⇒ Object

Report step passed.



66
67
68
# File 'lib/qed/reporter/base.rb', line 66

def report_pass(step)
  @pass << step
end

#report_start(spec) ⇒ Object

Beginning of a specification.



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

def report_start(spec)
  @demos += 1
end

#report_step(step) ⇒ Object

Before running a step.



61
62
63
# File 'lib/qed/reporter/base.rb', line 61

def report_step(step)
  @steps += 1
end

#report_step_end(step) ⇒ Object

After running a step.



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

def report_step_end(step)
end

#report_summaryObject

After running all specifications.



101
102
# File 'lib/qed/reporter/base.rb', line 101

def report_summary
end

#verbose?Boolean

Returns:

  • (Boolean)


34
35
36
# File 'lib/qed/reporter/base.rb', line 34

def verbose?
  @verbose
end