Class: RubyMemcheck::RSpec::RakeTask

Inherits:
RSpec::Core::RakeTask
  • Object
show all
Defined in:
lib/ruby_memcheck/rspec/rake_task.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(*args) ⇒ RakeTask

Returns a new instance of RakeTask.



11
12
13
14
15
16
17
18
19
20
# File 'lib/ruby_memcheck/rspec/rake_task.rb', line 11

def initialize(*args)
  @configuration =
    if !args.empty? && args[0].is_a?(Configuration)
      args.shift
    else
      RubyMemcheck.default_configuration
    end

  super
end

Instance Attribute Details

#configurationObject (readonly)

Returns the value of attribute configuration.



8
9
10
# File 'lib/ruby_memcheck/rspec/rake_task.rb', line 8

def configuration
  @configuration
end

#reporterObject (readonly)

Returns the value of attribute reporter.



9
10
11
# File 'lib/ruby_memcheck/rspec/rake_task.rb', line 9

def reporter
  @reporter
end

Instance Method Details

#run_task(verbose) ⇒ Object



22
23
24
25
26
27
28
29
30
31
32
33
34
# File 'lib/ruby_memcheck/rspec/rake_task.rb', line 22

def run_task(verbose)
  error = nil

  @reporter = TestTaskReporter.new(configuration)
  @reporter.run_ruby_with_valgrind do
    # RSpec::Core::RakeTask#run_task calls Kernel.exit on failure
    super
  rescue SystemExit => e
    error = e
  end

  raise error if error
end