Permalink
Browse files

Refactor: move test code into a module

  • Loading branch information...
1 parent df53550 commit 2cc899b6073ee1d2afbc355df108b5fee5da66b4 @chrisk committed Nov 24, 2013
Showing with 26 additions and 22 deletions.
  1. +26 −22 test/helpers/start_simplecov.rb
@@ -1,34 +1,38 @@
module FakeWebTestHelper
- def self.start_simplecov
- return unless RUBY_VERSION >= "1.9.0"
- return if !ENV['AUTOTEST'].nil?
+ module CodeCoverage
+ def start_simplecov
+ return unless RUBY_VERSION >= "1.9.0"
+ return if !ENV['AUTOTEST'].nil?
- require 'simplecov'
- require 'simplecov-console'
+ require 'simplecov'
+ require 'simplecov-console'
- SimpleCov.start do
- add_filter "/test/"
+ SimpleCov.start do
+ add_filter "/test/"
- minimum_coverage 100 if FakeWebTestHelper.running_all_tests?
+ minimum_coverage 100 if running_all_tests?
- if defined?(SIMPLECOV_COMMAND_NAME)
- command_name SIMPLECOV_COMMAND_NAME
- end
+ if defined?(SIMPLECOV_COMMAND_NAME)
+ command_name SIMPLECOV_COMMAND_NAME
+ end
- if !ENV["COVERAGE_REPORT"].nil?
- formatter SimpleCov::Formatter::MultiFormatter[
- SimpleCov::Formatter::HTMLFormatter,
- SimpleCov::Formatter::Console
- ]
- else
- formatter SimpleCov::Formatter::Console
+ if !ENV["COVERAGE_REPORT"].nil?
+ formatter SimpleCov::Formatter::MultiFormatter[
+ SimpleCov::Formatter::HTMLFormatter,
+ SimpleCov::Formatter::Console
+ ]
+ else
+ formatter SimpleCov::Formatter::Console
+ end
end
end
- end
- def self.running_all_tests?
- ENV['TEST'].nil?
+ def running_all_tests?
+ ENV['TEST'].nil?
+ end
+
+ extend self
end
end
-FakeWebTestHelper.start_simplecov
+FakeWebTestHelper::CodeCoverage.start_simplecov

0 comments on commit 2cc899b

Please sign in to comment.