diff --git a/.gitignore b/.gitignore index fa85fdbfbf..5651548b7f 100644 --- a/.gitignore +++ b/.gitignore @@ -6,6 +6,8 @@ .yardoc # Mac OS X files .DS_Store +# simplecov coverage data +coverage data/meterpreter/ext_server_pivot.dll data/meterpreter/ext_server_pivot.x64.dll doc diff --git a/Gemfile b/Gemfile index 825f532450..77d2123dae 100755 --- a/Gemfile +++ b/Gemfile @@ -24,4 +24,7 @@ end group :test do # testing framework gem 'rspec' + # code coverage for tests + # any version newer than 0.5.4 gives an Encoding error when trying to read the source files. + gem 'simplecov', '0.5.4', :require => false end diff --git a/Gemfile.lock b/Gemfile.lock index 10894e9139..a1fddbd358 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -45,6 +45,10 @@ GEM rspec-expectations (2.11.3) diff-lcs (~> 1.1.3) rspec-mocks (2.11.3) + simplecov (0.5.4) + multi_json (~> 1.0.3) + simplecov-html (~> 0.5.3) + simplecov-html (0.5.3) slop (3.3.3) tzinfo (0.3.33) yard (0.8.2.1) @@ -60,4 +64,5 @@ DEPENDENCIES rake redcarpet rspec + simplecov (= 0.5.4) yard diff --git a/spec/spec_helper.rb b/spec/spec_helper.rb index f62338294f..6f8932bc27 100644 --- a/spec/spec_helper.rb +++ b/spec/spec_helper.rb @@ -8,6 +8,11 @@ root_pathname = spec_pathname.join('..').expand_path lib_pathname = root_pathname.join('lib') $LOAD_PATH.unshift(lib_pathname.to_s) +# must be first require and started before any other requires so that it can measure coverage of all following required +# code. It is after the rubygems and bundler only because Bundler.setup supplies the LOAD_PATH to simplecov. +require 'simplecov' +SimpleCov.start + require 'rspec/core' # Requires supporting ruby files with custom matchers and macros, etc,