Class: ExecutableStories::RSpecFormatter

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

Instance Method Summary collapse

Constructor Details

#initialize(output) ⇒ RSpecFormatter

Returns a new instance of RSpecFormatter.



45
46
47
48
# File 'lib/executable_stories/rspec.rb', line 45

def initialize(output)
  @output = output
  @started = false
end

Instance Method Details

#dump_summary(_summary) ⇒ Object



71
72
73
# File 'lib/executable_stories/rspec.rb', line 71

def dump_summary(_summary)
  Output.write_results(cases: Collector.all)
end

#example_failed(notification) ⇒ Object



61
62
63
# File 'lib/executable_stories/rspec.rb', line 61

def example_failed(notification)
  record(notification.example, status: "fail")
end

#example_passed(notification) ⇒ Object



57
58
59
# File 'lib/executable_stories/rspec.rb', line 57

def example_passed(notification)
  record(notification.example, status: "pass")
end

#example_pending(notification) ⇒ Object



65
66
67
68
69
# File 'lib/executable_stories/rspec.rb', line 65

def example_pending(notification)
  example = notification.example
  status = example.[:skip] ? "skip" : "pending"
  record(example, status: status)
end

#start(_notification) ⇒ Object



50
51
52
53
54
55
# File 'lib/executable_stories/rspec.rb', line 50

def start(_notification)
  return if @started

  Collector.reset
  @started = true
end