Module: TestProf::RSpecStamp

Extended by:
Logging
Defined in:
lib/test_prof/rspec_stamp.rb,
lib/test_prof/rspec_stamp/rspec.rb,
lib/test_prof/rspec_stamp/parser.rb

Overview

Mark RSpec examples with provided tags

Defined Under Namespace

Modules: Parser Classes: Configuration, RSpecListener, Stamper

Constant Summary collapse

EXAMPLE_RXP =
/(\s*)(\w+\s*(?:.*)\s*)(do|{)/.freeze

Constants included from Logging

Logging::COLORS

Class Method Summary collapse

Methods included from Logging

build_log_msg, colorize, log

Class Method Details

.apply_tags(code, lines, tags) ⇒ Object

Accepts source code (as array of lines), line numbers (of example to apply tags) and an array of tags.



105
106
107
108
109
110
111
112
113
114
115
# File 'lib/test_prof/rspec_stamp.rb', line 105

def apply_tags(code, lines, tags)
  failed = 0

  lines.each do |line|
    unless stamp_example(code[line - 1], tags)
      failed += 1
      log :warn, "Failed to stamp: #{code[line - 1]}"
    end
  end
  failed
end

.configObject



94
95
96
# File 'lib/test_prof/rspec_stamp.rb', line 94

def config
  @config ||= Configuration.new
end

.configure {|config| ... } ⇒ Object

Yields:



98
99
100
# File 'lib/test_prof/rspec_stamp.rb', line 98

def configure
  yield config
end