Class: RSpec::Coverage::Configuration

Inherits:
Object
  • Object
show all
Defined in:
lib/rspec/coverage/configuration.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(root) ⇒ Configuration

Returns a new instance of Configuration.



6
7
8
9
10
11
# File 'lib/rspec/coverage/configuration.rb', line 6

def initialize root
  @root    = root
  map      = ClassMap.new root
  @builder = ClassMapBuilder.new map
  @runner  = Runner.new map
end

Instance Attribute Details

#builderObject (readonly)

Returns the value of attribute builder.



4
5
6
# File 'lib/rspec/coverage/configuration.rb', line 4

def builder
  @builder
end

#rootObject (readonly)

Returns the value of attribute root.



4
5
6
# File 'lib/rspec/coverage/configuration.rb', line 4

def root
  @root
end

#runnerObject (readonly)

Returns the value of attribute runner.



4
5
6
# File 'lib/rspec/coverage/configuration.rb', line 4

def runner
  @runner
end

Instance Method Details

#start(*args, &block) ⇒ Object



13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
# File 'lib/rspec/coverage/configuration.rb', line 13

def start *args, &block
  @builder.enable

  SimpleCov.start(*args, &block)
  SimpleCov.at_exit do
    SimpleCov.formatter.new.format SimpleCov::Result.new runner.result
  end

  _self = self
  RSpec.configure do |c|
    c.around :each do |example|
      _self.runner.call example
    end
  end
end