Class: Pocolog::TestHelpers::RecordingReporter

Inherits:
CLI::NullReporter show all
Defined in:
lib/pocolog/test_helpers.rb

Instance Attribute Summary collapse

Attributes inherited from CLI::NullReporter

#base, #current

Instance Method Summary collapse

Methods inherited from CLI::NullReporter

#advance, #finish, #reset_progressbar

Constructor Details

#initializeRecordingReporter

Returns a new instance of RecordingReporter



22
23
24
# File 'lib/pocolog/test_helpers.rb', line 22

def initialize
    @messages = []
end

Instance Attribute Details

#messagesObject (readonly)

Returns the value of attribute messages



21
22
23
# File 'lib/pocolog/test_helpers.rb', line 21

def messages
  @messages
end

Instance Method Details

#each_received_message(&block) ⇒ Object



30
31
32
# File 'lib/pocolog/test_helpers.rb', line 30

def each_received_message(&block)
    @messages.each(&block)
end

#error(msg) ⇒ Object



50
51
52
# File 'lib/pocolog/test_helpers.rb', line 50

def error(msg)
    @messages << [:error, msg]
end

#info(msg) ⇒ Object



42
43
44
# File 'lib/pocolog/test_helpers.rb', line 42

def info(msg)
    @messages << [:info, msg]
end

#log(msg) ⇒ Object



38
39
40
# File 'lib/pocolog/test_helpers.rb', line 38

def log(msg)
    @messages << [:log, msg]
end

#match?(kind, match) ⇒ Boolean

Returns:

  • (Boolean)


26
27
28
# File 'lib/pocolog/test_helpers.rb', line 26

def match?(kind, match)
    @messages.any? { |k, m| k == kind && match === m }
end

#title(msg) ⇒ Object



34
35
36
# File 'lib/pocolog/test_helpers.rb', line 34

def title(msg)
    @messages << [:title, msg]
end

#warn(msg) ⇒ Object



46
47
48
# File 'lib/pocolog/test_helpers.rb', line 46

def warn(msg)
    @messages << [:warn, msg]
end