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
Constructor Details
#initialize ⇒ Stamper
Returns a new instance of Stamper.
55 56 57 58 59 |
# File 'lib/test_prof/rspec_stamp.rb', line 55 def initialize @total = 0 @failed = 0 @ignored = 0 end |
Instance Attribute Details
#failed ⇒ Object (readonly)
Returns the value of attribute failed.
53 54 55 |
# File 'lib/test_prof/rspec_stamp.rb', line 53 def failed @failed end |
#ignored ⇒ Object (readonly)
Returns the value of attribute ignored.
53 54 55 |
# File 'lib/test_prof/rspec_stamp.rb', line 53 def ignored @ignored end |
#total ⇒ Object (readonly)
Returns the value of attribute total.
53 54 55 |
# File 'lib/test_prof/rspec_stamp.rb', line 53 def total @total end |
Instance Method Details
#stamp_file(file, lines) ⇒ Object
61 62 63 64 65 66 67 68 69 70 71 72 |
# File 'lib/test_prof/rspec_stamp.rb', line 61 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 |