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

Constant Summary collapse

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

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.



61
62
63
64
65
66
67
68
69
70
71
# File 'lib/test_prof/rspec_stamp.rb', line 61

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



50
51
52
# File 'lib/test_prof/rspec_stamp.rb', line 50

def config
  @config ||= Configuration.new
end

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

Yields:



54
55
56
# File 'lib/test_prof/rspec_stamp.rb', line 54

def configure
  yield config
end