Class: RspecApiDocumentation::ApiFormatter
- Inherits:
-
RSpec::Core::Formatters::BaseTextFormatter
- Object
- RSpec::Core::Formatters::BaseTextFormatter
- RspecApiDocumentation::ApiFormatter
- Defined in:
- lib/rspec_api_documentation/api_formatter.rb
Instance Method Summary collapse
- #example_failed(example_notification) ⇒ Object
- #example_group_started(notification) ⇒ Object
- #example_passed(example_notification) ⇒ Object
-
#initialize(output) ⇒ ApiFormatter
constructor
A new instance of ApiFormatter.
- #start(notification) ⇒ Object
- #stop(notification) ⇒ Object
Constructor Details
#initialize(output) ⇒ ApiFormatter
Returns a new instance of ApiFormatter.
7 8 9 10 11 |
# File 'lib/rspec_api_documentation/api_formatter.rb', line 7 def initialize(output) super output.puts "Generating API Docs" end |
Instance Method Details
#example_failed(example_notification) ⇒ Object
33 34 35 |
# File 'lib/rspec_api_documentation/api_formatter.rb', line 33 def example_failed(example_notification) output.puts " ! #{example_notification.example.description} (FAILED)" end |
#example_group_started(notification) ⇒ Object
19 20 21 22 23 |
# File 'lib/rspec_api_documentation/api_formatter.rb', line 19 def example_group_started(notification) super output.puts " #{@example_group.description}" end |
#example_passed(example_notification) ⇒ Object
25 26 27 28 29 30 31 |
# File 'lib/rspec_api_documentation/api_formatter.rb', line 25 def example_passed(example_notification) output.puts " * #{example_notification.example.description}" RspecApiDocumentation.documentations.each do |documentation| documentation.document_example(example_notification.example) end end |
#start(notification) ⇒ Object
13 14 15 16 17 |
# File 'lib/rspec_api_documentation/api_formatter.rb', line 13 def start(notification) super RspecApiDocumentation.documentations.each(&:clear_docs) end |
#stop(notification) ⇒ Object
37 38 39 |
# File 'lib/rspec_api_documentation/api_formatter.rb', line 37 def stop(notification) RspecApiDocumentation.documentations.each(&:write) end |