Class: Autospec::Formatter
- Inherits:
-
RSpec::Core::Formatters::BaseTextFormatter
- Object
- RSpec::Core::Formatters::BaseTextFormatter
- Autospec::Formatter
- Defined in:
- lib/autospec/formatter.rb
Constant Summary collapse
- RSPEC_RESULT =
"./tmp/rspec_result"
Instance Method Summary collapse
- #close(filename) ⇒ Object
- #example_failed(notification) ⇒ Object
- #example_passed(_notification) ⇒ Object
- #example_pending(_notification) ⇒ Object
-
#initialize(output) ⇒ Formatter
constructor
A new instance of Formatter.
- #start_dump(notification) ⇒ Object
Constructor Details
#initialize(output) ⇒ Formatter
Returns a new instance of Formatter.
18 19 20 21 22 23 |
# File 'lib/autospec/formatter.rb', line 18 def initialize(output) super FileUtils.mkdir_p("tmp") unless Dir.exist?("tmp") File.delete(RSPEC_RESULT) if File.exist?(RSPEC_RESULT) @fail_file = File.open(RSPEC_RESULT, "w") end |
Instance Method Details
#close(filename) ⇒ Object
43 44 45 46 |
# File 'lib/autospec/formatter.rb', line 43 def close(filename) @fail_file.close super(filename) end |
#example_failed(notification) ⇒ Object
33 34 35 36 37 |
# File 'lib/autospec/formatter.rb', line 33 def example_failed(notification) output.print RSpec::Core::Formatters::ConsoleCodes.wrap("F", :failure) @fail_file.puts(notification.example.location + " ") @fail_file.flush end |
#example_passed(_notification) ⇒ Object
25 26 27 |
# File 'lib/autospec/formatter.rb', line 25 def example_passed(_notification) output.print RSpec::Core::Formatters::ConsoleCodes.wrap(".", :success) end |
#example_pending(_notification) ⇒ Object
29 30 31 |
# File 'lib/autospec/formatter.rb', line 29 def example_pending(_notification) output.print RSpec::Core::Formatters::ConsoleCodes.wrap("*", :pending) end |
#start_dump(notification) ⇒ Object
39 40 41 |
# File 'lib/autospec/formatter.rb', line 39 def start_dump(notification) output.puts end |