Class: TestProf::RSpecStamp::Stamper
- Inherits:
-
Object
- Object
- TestProf::RSpecStamp::Stamper
- Includes:
- Logging
- Defined in:
- lib/test_prof/rspec_stamp.rb
Overview
Stamper collects statistics about applying tags to examples.
Constant Summary
Constants included from Logging
Instance Attribute Summary collapse
-
#failed ⇒ Object
readonly
Returns the value of attribute failed.
-
#ignored ⇒ Object
readonly
Returns the value of attribute ignored.
-
#total ⇒ Object
readonly
Returns the value of attribute total.
Instance Method Summary collapse
-
#initialize ⇒ Stamper
constructor
A new instance of Stamper.
- #stamp_file(file, lines) ⇒ Object
Methods included from Logging
#build_log_msg, #colorize, #log
Constructor Details
#initialize ⇒ Stamper
Returns a new instance of Stamper.
56 57 58 59 60 |
# File 'lib/test_prof/rspec_stamp.rb', line 56 def initialize @total = 0 @failed = 0 @ignored = 0 end |
Instance Attribute Details
#failed ⇒ Object (readonly)
Returns the value of attribute failed.
54 55 56 |
# File 'lib/test_prof/rspec_stamp.rb', line 54 def failed @failed end |
#ignored ⇒ Object (readonly)
Returns the value of attribute ignored.
54 55 56 |
# File 'lib/test_prof/rspec_stamp.rb', line 54 def ignored @ignored end |
#total ⇒ Object (readonly)
Returns the value of attribute total.
54 55 56 |
# File 'lib/test_prof/rspec_stamp.rb', line 54 def total @total end |
Instance Method Details
#stamp_file(file, lines) ⇒ Object
62 63 64 65 66 67 68 69 70 71 72 73 |
# File 'lib/test_prof/rspec_stamp.rb', line 62 def stamp_file(file, lines) @total += lines.size return if ignored?(file) log :info, "(dry-run) Patching #{file}" if dry_run? code = File.readlines(file) @failed += RSpecStamp.(code, lines, RSpecStamp.config.) File.write(file, code.join) unless dry_run? end |