Class: RSpec::Core::Formatters::DeprecationFormatter::FileStream
- Inherits:
-
Object
- Object
- RSpec::Core::Formatters::DeprecationFormatter::FileStream
- Includes:
- Helpers
- Defined in:
- lib/rspec/core/formatters/deprecation_formatter.rb
Overview
Wraps a File object and provides file-specific operations.
Constant Summary
Constants included from Helpers
Helpers::DEFAULT_PRECISION, Helpers::SUB_SECOND_PRECISION
Instance Method Summary collapse
-
#initialize(file) ⇒ FileStream
constructor
A new instance of FileStream.
- #puts(*args) ⇒ Object
- #summarize(summary_stream, deprecation_count) ⇒ Object
Methods included from Helpers
#format_duration, #format_seconds, #pluralize, #strip_trailing_zeroes
Methods included from BacktraceFormatter
Constructor Details
#initialize(file) ⇒ FileStream
Returns a new instance of FileStream.
199 200 201 202 203 204 205 206 207 |
# File 'lib/rspec/core/formatters/deprecation_formatter.rb', line 199 def initialize(file) @file = file # In one of my test suites, I got lots of duplicate output in the # deprecation file (e.g. 200 of the same deprecation, even though # the `puts` below was only called 6 times). Setting `sync = true` # fixes this (but we really have no idea why!). @file.sync = true end |
Instance Method Details
#puts(*args) ⇒ Object
209 210 211 |
# File 'lib/rspec/core/formatters/deprecation_formatter.rb', line 209 def puts(*args) @file.puts(*args) end |
#summarize(summary_stream, deprecation_count) ⇒ Object
213 214 215 216 |
# File 'lib/rspec/core/formatters/deprecation_formatter.rb', line 213 def summarize(summary_stream, deprecation_count) summary_stream.puts "\n#{pluralize(deprecation_count, 'deprecation')} logged to #{@file.path}" puts RAISE_ERROR_CONFIG_NOTICE end |