Class: ParallelSpecs::SpecLoggerBase
- Inherits:
-
SpecLoggerBaseBase
- Object
- ParallelSpecs::SpecLoggerBase
- Defined in:
- lib/parallel_specs/spec_logger_base.rb
Direct Known Subclasses
SpecErrorCountLogger, SpecErrorLogger, SpecFailuresLogger, SpecRuntimeLogger, SpecStartFinishLogger, SpecSummaryLogger
Constant Summary collapse
- RSPEC_1 =
do not test for Spec, this will trigger deprecation warning in rspec 2
!defined?(RSpec::Core::Formatters::BaseTextFormatter) # do not test for Spec, this will trigger deprecation warning in rspec 2
Instance Method Summary collapse
-
#close ⇒ Object
stolen from Rspec.
- #dump_failure(*args) ⇒ Object
- #dump_failures(*args) ⇒ Object
- #dump_pending(*args) ⇒ Object
- #dump_summary(*args) ⇒ Object
-
#initialize(*args) ⇒ SpecLoggerBase
constructor
A new instance of SpecLoggerBase.
-
#lock_output ⇒ Object
do not let multiple processes get in each others way.
Constructor Details
#initialize(*args) ⇒ SpecLoggerBase
Returns a new instance of SpecLoggerBase.
15 16 17 18 19 20 21 22 23 24 25 26 27 28 |
# File 'lib/parallel_specs/spec_logger_base.rb', line 15 def initialize(*args) super @output ||= args[1] || args[0] # rspec 1 has output as second argument if String === @output # a path ? FileUtils.mkdir_p(File.dirname(@output)) File.open(@output, 'w'){} # overwrite previous results @output = File.open(@output, 'a') elsif File === @output # close and restart in append mode @output.close @output = File.open(@output.path, 'a') end end |
Instance Method Details
#close ⇒ Object
stolen from Rspec
39 40 41 |
# File 'lib/parallel_specs/spec_logger_base.rb', line 39 def close @output.close if (IO === @output) & (@output != $stdout) end |
#dump_failure(*args) ⇒ Object
34 |
# File 'lib/parallel_specs/spec_logger_base.rb', line 34 def dump_failure(*args);end |
#dump_failures(*args) ⇒ Object
32 |
# File 'lib/parallel_specs/spec_logger_base.rb', line 32 def dump_failures(*args);end |
#dump_pending(*args) ⇒ Object
36 |
# File 'lib/parallel_specs/spec_logger_base.rb', line 36 def dump_pending(*args);end |
#dump_summary(*args) ⇒ Object
30 |
# File 'lib/parallel_specs/spec_logger_base.rb', line 30 def dump_summary(*args);end |
#lock_output ⇒ Object
do not let multiple processes get in each others way
44 45 46 47 48 49 50 51 52 53 54 55 |
# File 'lib/parallel_specs/spec_logger_base.rb', line 44 def lock_output if File === @output begin @output.flock File::LOCK_EX yield ensure @output.flock File::LOCK_UN end else yield end end |