simplecov 0.11.2 → 0.13.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: c477692497bba3df0d4545ed9d4e4e7fd18b6918
4
- data.tar.gz: 9224079fa17a1993d471be4da3769f1c96139202
3
+ metadata.gz: 15fa4589e25ee4710bdbcec7485a4d8ec7be7abb
4
+ data.tar.gz: a1627cf287ce3c70ba2d60e0943f28f90fcdef79
5
5
  SHA512:
6
- metadata.gz: 1143ac48afac3679abfa6a1187c29ad3d832c94951096670ba78062b9df2d95ef893a8996287f3ec4b2da3a77bd1753697e6a6d9d00e0d04f333d2e531ddbf78
7
- data.tar.gz: 62d25d8868801db9a8360743ef8bd0348b6ffb1f2fc99e674abbd703d7d1a9f0793ed6d6a7665206f149e9d2713fe58698d90d6a6b3839234453b3563c014411
6
+ metadata.gz: 03a052dcae5923fe19e56f6f20fbd390505f03dca386d51eaca4b525252054856ce492e783e6923ad3b89a46719b89556747b8bbac295513b1d245fba3232e79
7
+ data.tar.gz: e2cd84b984e35dfa0c048f375ed2555f08d4df239d616d7c70289b086b1904394b1344f177ad5d7dd08cfb695fe2c22d5375af8e07da5d773500b034d87d4b1c
data/.rubocop.yml CHANGED
@@ -4,6 +4,9 @@ AllCops:
4
4
  - 'tmp/**/*'
5
5
  - 'vendor/bundle/**/*'
6
6
 
7
+ Bundler/OrderedGems:
8
+ Enabled: false
9
+
7
10
  Lint/AmbiguousRegexpLiteral:
8
11
  Exclude:
9
12
  - 'features/**/*_steps.rb'
@@ -13,6 +16,10 @@ Lint/AmbiguousRegexpLiteral:
13
16
  Metrics/AbcSize:
14
17
  Max: 25 # TODO: Lower to 15
15
18
 
19
+ Metrics/BlockLength:
20
+ Exclude:
21
+ - 'spec/**/*.rb'
22
+
16
23
  Metrics/BlockNesting:
17
24
  Max: 2
18
25
 
@@ -71,3 +78,7 @@ Style/TrailingCommaInLiteral:
71
78
 
72
79
  Style/GuardClause:
73
80
  Enabled: false
81
+
82
+ Style/MutableConstant:
83
+ Exclude:
84
+ - 'lib/simplecov/version.rb' # required for older versions of rubygems
data/.travis.yml CHANGED
@@ -1,6 +1,7 @@
1
1
  language: ruby
2
2
 
3
3
  before_install:
4
+ - gem update --system
4
5
  - gem install bundler
5
6
 
6
7
  bundler_args: --without development --jobs=3 --retry=3
@@ -13,15 +14,19 @@ rvm:
13
14
  - 1.8.7
14
15
  - 1.9.3
15
16
  - 2.0.0
16
- - 2.1
17
- - 2.2
17
+ - 2.1.10
18
+ - 2.2.6
19
+ - 2.3.3
20
+ - 2.4.0
18
21
  - ruby-head
19
- - jruby
22
+ - jruby-head
23
+ - jruby-9.1.7.0
20
24
  - rbx-2
21
25
 
22
26
  matrix:
23
27
  allow_failures:
24
28
  - rvm: ruby-head
25
- - rvm: jruby
29
+ - rvm: jruby-head
30
+ - rvm: jruby-9.1.7.0
26
31
  - rvm: rbx-2
27
32
  fast_finish: true
data/CHANGELOG.md CHANGED
@@ -1,10 +1,30 @@
1
- Unreleased ([changes](https://github.com/colszowka/simplecov/compare/v0.11.2...master))
1
+ 0.13.0 2016-01-25 ([changes](https://github.com/colszowka/simplecov/compare/v0.12.0...v0.13.0))
2
+ ==========
3
+
4
+ ## Enhancements
5
+
6
+ * Faster run times when a very large number of files is loaded into SimpleCov. See [#520](https://github.com/colszowka/simplecov/pull/520) (thanks @alyssais)
7
+ * Only read in source code files that are actually used (faster when files are ignored etc.). See [#540](https://github.com/colszowka/simplecov/pull/540) (tahks @yui-knk)
8
+
9
+ ## Bugfixes
10
+
11
+ * Fix merging of resultsets if a file is missing on one side. See [#513](https://github.com/colszowka/simplecov/pull/513) (thanks @hanazuki)
12
+ * Fix Ruby 2.4 deprecation warnings by using Integer instead of Fixnum. See [#523](https://github.com/colszowka/simplecov/pull/523) (thanks @nobu)
13
+ * Force Ruby 2 to json 2. See [dc7417d50](https://github.com/colszowka/simplecov/commit/dc7417d5049b1809cea214314c15dd93a5dd964f) (thanks @amatsuda)
14
+ * Various other gem dependency fixes for different gems on different ruby versions. (thanks @amatsuda)
15
+
16
+ 0.12.0 2016-07-02 ([changes](https://github.com/colszowka/simplecov/compare/v0.11.2...v0.12.0))
2
17
  =================
3
18
 
4
19
  ## Enhancements
5
20
 
21
+ * Add support for JSON versions 2.x
22
+
6
23
  ## Bugfixes
7
24
 
25
+ * Fix coverage rate of the parallel_tests. See [#441](https://github.com/colszowka/simplecov/pull/441) (thanks @sinsoku)
26
+ * Fix a regression on old rubies that failed to work with the recently introduced frozen VERSION string. See [#461](https://github.com/colszowka/simplecov/pull/461) (thanks @leafle)
27
+
8
28
  0.11.2 2016-02-03 ([changes](https://github.com/colszowka/simplecov/compare/v0.11.1...v0.11.2))
9
29
  =================
10
30
 
data/Gemfile CHANGED
@@ -6,29 +6,33 @@ source "https://rubygems.org"
6
6
  # Uncomment this to use development version of html formatter from github
7
7
  # gem 'simplecov-html', :github => 'colszowka/simplecov-html'
8
8
 
9
- gem "rake", ">= 10.3"
9
+ gem "rake", Gem::Version.new(RUBY_VERSION) < Gem::Version.new("1.9.3") ? "~>10.3" : ">= 10.3"
10
10
 
11
11
  group :test do
12
12
  gem "rspec", ">= 3.2"
13
13
  # Older versions of some gems required for Ruby 1.8.7 support
14
- platform :ruby_18 do
14
+ platforms :ruby_18 do
15
15
  gem "activesupport", "~> 3.2.21"
16
16
  gem "i18n", "~> 0.6.11"
17
17
  end
18
- platform :jruby, :ruby_19, :ruby_20, :ruby_21, :ruby_22, :ruby_23 do
18
+ platforms :ruby_18, :ruby_19 do
19
+ gem "mime-types", "~> 1.25"
20
+ gem "addressable", "~> 2.3.0"
21
+ end
22
+ platforms :ruby_18, :ruby_19, :ruby_20, :ruby_21 do
23
+ gem "rack", "~> 1.6"
24
+ end
25
+ platforms :jruby, :ruby_19, :ruby_20, :ruby_21, :ruby_22, :ruby_23, :ruby_24, :ruby_25 do
19
26
  gem "aruba", "~> 0.7.4"
20
- gem "capybara", "~> 2.4"
21
-
22
- # Hack until Capybara fixes its gemspec. 3.0 removed 1.9 support.
23
- # See https://github.com/jnicklas/capybara/issues/1615
24
- gem "mime-types", "~> 2.0.0"
25
-
26
- gem "cucumber", "~> 2.0"
27
+ gem "capybara"
28
+ gem "nokogiri", RUBY_VERSION < "2.1" ? "~> 1.6.0" : ">= 1.7"
29
+ gem "cucumber"
27
30
  gem "phantomjs", "~> 1.9"
28
- gem "poltergeist", "~> 1.1"
29
- gem "rubocop", "~> 0.36.0"
30
- gem "test-unit", "~> 3.0"
31
+ gem "poltergeist"
32
+ gem "rubocop" unless RUBY_VERSION.start_with?("1.")
33
+ gem "test-unit"
31
34
  end
35
+ gem "json", RUBY_VERSION.start_with?("1.") ? "~> 1.8" : "~> 2.0"
32
36
  end
33
37
 
34
38
  gemspec
data/README.md CHANGED
@@ -1,4 +1,4 @@
1
- SimpleCov [![Build Status](https://secure.travis-ci.org/colszowka/simplecov.png)][Continuous Integration] [![Dependency Status](https://gemnasium.com/colszowka/simplecov.png)][Dependencies] [![Code Climate](https://codeclimate.com/github/colszowka/simplecov.png)](https://codeclimate.com/github/colszowka/simplecov) [![Inline docs](http://inch-ci.org/github/colszowka/simplecov.png)](http://inch-ci.org/github/colszowka/simplecov)
1
+ SimpleCov [![Build Status](https://travis-ci.org/colszowka/simplecov.svg)][Continuous Integration] [![Dependency Status](https://gemnasium.com/colszowka/simplecov.svg)][Dependencies] [![Code Climate](https://codeclimate.com/github/colszowka/simplecov.svg)](https://codeclimate.com/github/colszowka/simplecov) [![Inline docs](http://inch-ci.org/github/colszowka/simplecov.svg)](http://inch-ci.org/github/colszowka/simplecov)
2
2
  =========
3
3
  **Code coverage for Ruby**
4
4
 
@@ -101,12 +101,12 @@ Getting started
101
101
 
102
102
  **Coverage results report, fully browsable locally with sorting and much more:**
103
103
 
104
- ![SimpleCov coverage report](http://colszowka.github.com/simplecov/devise_result-0.5.3.png)
104
+ ![SimpleCov coverage report](https://cloud.githubusercontent.com/assets/137793/17071162/db6f253e-502d-11e6-9d84-e40c3d75f333.png)
105
105
 
106
106
 
107
107
  **Source file coverage details view:**
108
108
 
109
- ![SimpleCov source file detail view](http://colszowka.github.com/simplecov/devise_source_file-0.5.3.png)
109
+ ![SimpleCov source file detail view](https://cloud.githubusercontent.com/assets/137793/17071163/db6f9f0a-502d-11e6-816c-edb2c66fad8d.png)
110
110
 
111
111
  ## Use it with any framework!
112
112
 
@@ -146,19 +146,6 @@ to use SimpleCov with them. Here's an overview of the known ones:
146
146
  <a href="https://github.com/colszowka/simplecov/pull/185">#185</a>
147
147
  </td>
148
148
  </tr>
149
- <tr>
150
- <th>
151
- Riot
152
- </th>
153
- <td>
154
- A user has reported problems with the coverage report using the riot
155
- framework. If you experience similar trouble please follow up on the
156
- related GitHub issue.
157
- </td>
158
- <td>
159
- <a href="https://github.com/colszowka/simplecov/issues/80">#80</a>
160
- </td>
161
- </tr>
162
149
  <tr>
163
150
  <th>
164
151
  RubyMine
data/Rakefile CHANGED
@@ -27,10 +27,15 @@ rescue LoadError
27
27
  end
28
28
 
29
29
  # Cucumber integration test suite is for impls that work with simplecov only - a.k.a. 1.9+
30
- if RUBY_VERSION >= "1.9"
30
+ if RUBY_VERSION.start_with? "1.8"
31
+ task :default => [:spec]
32
+ else
31
33
  require "cucumber/rake/task"
32
34
  Cucumber::Rake::Task.new
33
- task :default => [:spec, :cucumber, :rubocop]
34
- else
35
- task :default => [:spec]
35
+
36
+ if RUBY_VERSION.start_with? "1.9"
37
+ task :default => [:spec, :cucumber]
38
+ else
39
+ task :default => [:spec, :cucumber, :rubocop]
40
+ end
36
41
  end
@@ -11,7 +11,7 @@ Given /^SimpleCov for (.*) is configured with:$/ do |framework, config_body|
11
11
  when /Cucumber/i
12
12
  "features/support"
13
13
  else
14
- fail ArgumentError, "Could not identify test framework #{framework}!"
14
+ raise ArgumentError, "Could not identify test framework #{framework}!"
15
15
  end
16
16
  end
17
17
 
@@ -45,6 +45,6 @@ end
45
45
  # Workaround for https://github.com/cucumber/aruba/pull/125
46
46
  Aruba.configure do |config|
47
47
  config.before_cmd do
48
- set_env("JRUBY_OPTS", "-X-C --1.9")
48
+ set_env("JRUBY_OPTS", "--dev --debug")
49
49
  end
50
50
  end
@@ -85,7 +85,7 @@ module SimpleCov
85
85
  def formatter(formatter = nil)
86
86
  return @formatter if defined?(@formatter) && formatter.nil?
87
87
  @formatter = formatter
88
- fail "No formatter configured. Please specify a formatter using SimpleCov.formatter = SimpleCov::Formatter::SimpleFormatter" unless @formatter
88
+ raise "No formatter configured. Please specify a formatter using SimpleCov.formatter = SimpleCov::Formatter::SimpleFormatter" unless @formatter
89
89
  @formatter
90
90
  end
91
91
 
@@ -192,7 +192,7 @@ module SimpleCov
192
192
  end
193
193
 
194
194
  #
195
- # Defines them maximum age (in seconds) of a resultset to still be included in merged results.
195
+ # Defines the maximum age (in seconds) of a resultset to still be included in merged results.
196
196
  # i.e. If you run cucumber features, then later rake test, if the stored cucumber resultset is
197
197
  # more seconds ago than specified here, it won't be taken into account when merging (and is also
198
198
  # purged from the resultset cache)
@@ -204,7 +204,7 @@ module SimpleCov
204
204
  # Configure with SimpleCov.merge_timeout(3600) # 1hr
205
205
  #
206
206
  def merge_timeout(seconds = nil)
207
- @merge_timeout = seconds if seconds.is_a?(Fixnum)
207
+ @merge_timeout = seconds if seconds.is_a?(Integer)
208
208
  @merge_timeout ||= 600
209
209
  end
210
210
 
@@ -289,7 +289,7 @@ module SimpleCov
289
289
  elsif filter_argument.is_a?(Array)
290
290
  SimpleCov::ArrayFilter.new(filter_argument)
291
291
  else
292
- fail ArgumentError, "Please specify either a string or a block to filter with"
292
+ raise ArgumentError, "Please specify either a string or a block to filter with"
293
293
  end
294
294
  end
295
295
  end
@@ -49,7 +49,7 @@ end
49
49
  # Gotta stash this a-s-a-p, see the CommandGuesser class and i.e. #110 for further info
50
50
  SimpleCov::CommandGuesser.original_run_command = "#{$PROGRAM_NAME} #{ARGV.join(' ')}"
51
51
 
52
- at_exit do
52
+ at_exit do # rubocop:disable Metrics/BlockLength
53
53
  # If we are in a different process than called start, don't interfere.
54
54
  next if SimpleCov.pid != Process.pid
55
55
 
@@ -17,7 +17,7 @@ module SimpleCov
17
17
  end
18
18
 
19
19
  def matches?(_)
20
- fail "The base filter class is not intended for direct use"
20
+ raise "The base filter class is not intended for direct use"
21
21
  end
22
22
 
23
23
  def passes?(source_file)
@@ -4,13 +4,12 @@ module SimpleCov
4
4
  def merge_resultset(array)
5
5
  new_array = dup
6
6
  array.each_with_index do |element, i|
7
- if element.nil? && new_array[i].nil?
8
- new_array[i] = nil
9
- else
10
- local_value = element || 0
11
- other_value = new_array[i] || 0
12
- new_array[i] = local_value + other_value
13
- end
7
+ pair = [element, new_array[i]]
8
+ new_array[i] = if pair.any?(&:nil?) && pair.map(&:to_i).all?(&:zero?)
9
+ nil
10
+ else
11
+ element.to_i + new_array[i].to_i
12
+ end
14
13
  end
15
14
  new_array
16
15
  end
@@ -23,11 +22,14 @@ module SimpleCov
23
22
  def merge_resultset(hash)
24
23
  new_resultset = {}
25
24
  (keys + hash.keys).each do |filename|
26
- new_resultset[filename] = []
25
+ new_resultset[filename] = nil
27
26
  end
28
27
 
29
28
  new_resultset.each_key do |filename|
30
- new_resultset[filename] = (self[filename] || []).extend(SimpleCov::ArrayMergeHelper).merge_resultset(hash[filename] || [])
29
+ result1 = self[filename]
30
+ result2 = hash[filename]
31
+ new_resultset[filename] =
32
+ result1 && result2 ? result1.extend(ArrayMergeHelper).merge_resultset(result2) : (result1 || result2).dup
31
33
  end
32
34
  new_resultset
33
35
  end
@@ -15,7 +15,7 @@ module SimpleCov
15
15
  #
16
16
  def define(name, &blk)
17
17
  name = name.to_sym
18
- fail "SimpleCov Profile '#{name}' is already defined" unless self[name].nil?
18
+ raise "SimpleCov Profile '#{name}' is already defined" unless self[name].nil?
19
19
  self[name] = blk
20
20
  end
21
21
 
@@ -24,7 +24,7 @@ module SimpleCov
24
24
  #
25
25
  def load(name)
26
26
  name = name.to_sym
27
- fail "Could not find SimpleCov Profile called '#{name}'" unless key?(name)
27
+ raise "Could not find SimpleCov Profile called '#{name}'" unless key?(name)
28
28
  SimpleCov.configure(&self[name])
29
29
  end
30
30
  end
@@ -60,7 +60,7 @@ module SimpleCov
60
60
 
61
61
  # Returns a hash representation of this Result that can be used for marshalling it into JSON
62
62
  def to_hash
63
- {command_name => {"coverage" => original_result.reject { |filename, _| !filenames.include?(filename) }, "timestamp" => created_at.to_i}}
63
+ {command_name => {"coverage" => coverage, "timestamp" => created_at.to_i}}
64
64
  end
65
65
 
66
66
  # Loads a SimpleCov::Result#to_hash dump
@@ -74,6 +74,11 @@ module SimpleCov
74
74
 
75
75
  private
76
76
 
77
+ def coverage
78
+ keys = original_result.keys & filenames
79
+ Hash[keys.zip(original_result.values_at(*keys))]
80
+ end
81
+
77
82
  # Applies all configured SimpleCov filters on this result's source files
78
83
  def filter!
79
84
  @files = SimpleCov.filtered(files)
@@ -25,9 +25,9 @@ module SimpleCov
25
25
  alias number line_number
26
26
 
27
27
  def initialize(src, line_number, coverage)
28
- fail ArgumentError, "Only String accepted for source" unless src.is_a?(String)
29
- fail ArgumentError, "Only Fixnum accepted for line_number" unless line_number.is_a?(Fixnum)
30
- fail ArgumentError, "Only Fixnum and nil accepted for coverage" unless coverage.is_a?(Fixnum) || coverage.nil?
28
+ raise ArgumentError, "Only String accepted for source" unless src.is_a?(String)
29
+ raise ArgumentError, "Only Integer accepted for line_number" unless line_number.is_a?(Integer)
30
+ raise ArgumentError, "Only Integer and nil accepted for coverage" unless coverage.is_a?(Integer) || coverage.nil?
31
31
  @src = src
32
32
  @line_number = line_number
33
33
  @coverage = coverage
@@ -74,16 +74,20 @@ module SimpleCov
74
74
  attr_reader :filename
75
75
  # The array of coverage data received from the Coverage.result
76
76
  attr_reader :coverage
77
- # The source code for this file. Aliased as :source
78
- attr_reader :src
79
- alias source src
80
77
 
81
78
  def initialize(filename, coverage)
82
79
  @filename = filename
83
80
  @coverage = coverage
84
- File.open(filename, "rb") { |f| @src = f.readlines }
85
81
  end
86
82
 
83
+ # The source code for this file. Aliased as :source
84
+ def src
85
+ # We intentionally read source code lazily to
86
+ # suppress reading unused source code.
87
+ @src ||= File.open(filename, "rb", &:readlines)
88
+ end
89
+ alias source src
90
+
87
91
  # Returns all source lines for this file as instances of SimpleCov::SourceFile::Line,
88
92
  # and thus including coverage data. Aliased as :source_lines
89
93
  def lines
@@ -1,5 +1,5 @@
1
1
  module SimpleCov
2
- version = "0.11.2"
2
+ version = "0.13.0"
3
3
 
4
4
  def version.to_a
5
5
  split(".").map(&:to_i)
@@ -21,5 +21,5 @@ module SimpleCov
21
21
  to_a[3]
22
22
  end
23
23
 
24
- VERSION = version.freeze
24
+ VERSION = version
25
25
  end
data/lib/simplecov.rb CHANGED
@@ -10,9 +10,10 @@ if defined?(JRUBY_VERSION) && defined?(JRuby)
10
10
  # @see https://github.com/colszowka/simplecov/issues/86
11
11
  # @see https://jira.codehaus.org/browse/JRUBY-6106
12
12
 
13
- unless JRuby.runtime.debug?
14
- warn 'Coverage may be inaccurate; set "cli.debug=true" ("-Xcli.debug=true") in your .jrubyrc or' \
15
- ' do JRUBY_OPTS="-d"'
13
+ unless org.jruby.RubyInstanceConfig.FULL_TRACE_ENABLED
14
+ warn 'Coverage may be inaccurate; set the "--debug" command line option,' \
15
+ ' or do JRUBY_OPTS="--debug"' \
16
+ ' or set the "debug.fullTrace=true" option in your .jrubyrc'
16
17
  end
17
18
  end
18
19
  module SimpleCov
@@ -124,7 +125,7 @@ module SimpleCov
124
125
  grouped[name] = SimpleCov::FileList.new(files.select { |source_file| filter.matches?(source_file) })
125
126
  grouped_files += grouped[name]
126
127
  end
127
- if groups.length > 0 && (other_files = files.reject { |source_file| grouped_files.include?(source_file) }).length > 0
128
+ if !groups.empty? && !(other_files = files.reject { |source_file| grouped_files.include?(source_file) }).empty?
128
129
  grouped["Ungrouped"] = SimpleCov::FileList.new(other_files)
129
130
  end
130
131
  grouped
data/simplecov.gemspec CHANGED
@@ -14,7 +14,7 @@ Gem::Specification.new do |gem|
14
14
 
15
15
  gem.required_ruby_version = ">= 1.8.7"
16
16
 
17
- gem.add_dependency "json", "~> 1.8"
17
+ gem.add_dependency "json", ">= 1.8", "< 3"
18
18
  gem.add_dependency "simplecov-html", "~> 0.10.0"
19
19
  gem.add_dependency "docile", "~> 1.1.0"
20
20
 
@@ -6,24 +6,26 @@ require "helper"
6
6
  # TODO: This should be expanded upon all methods that could potentially
7
7
  # be called in a test/spec-helper simplecov config block
8
8
  #
9
- describe "Ruby 1.8 fallback" do
10
- it "return false when calling SimpleCov.start" do
11
- expect(SimpleCov.start).to be false
12
- end
9
+ if RUBY_VERSION.start_with? "1.8"
10
+ describe "Ruby 1.8 fallback" do
11
+ it "return false when calling SimpleCov.start" do
12
+ expect(SimpleCov.start).to be false
13
+ end
13
14
 
14
- it "return false when calling SimpleCov.start with a block" do
15
- expect(SimpleCov.start { fail "Shouldn't reach this!" }).to be false
16
- end
15
+ it "return false when calling SimpleCov.start with a block" do
16
+ expect(SimpleCov.start { raise "Shouldn't reach this!" }).to be false
17
+ end
17
18
 
18
- it "return false when calling SimpleCov.configure with a block" do
19
- expect(SimpleCov.configure { fail "Shouldn't reach this!" }).to be false
20
- end
19
+ it "return false when calling SimpleCov.configure with a block" do
20
+ expect(SimpleCov.configure { raise "Shouldn't reach this!" }).to be false
21
+ end
21
22
 
22
- it "allow to define a profile" do
23
- expect do
24
- SimpleCov.profiles.define "testprofile" do
25
- add_filter "/config/"
26
- end
27
- end.not_to raise_error
23
+ it "allow to define a profile" do
24
+ expect do
25
+ SimpleCov.profiles.define "testprofile" do
26
+ add_filter "/config/"
27
+ end
28
+ end.not_to raise_error
29
+ end
28
30
  end
29
- end if RUBY_VERSION.start_with? "1.8"
31
+ end
@@ -1,46 +1,48 @@
1
1
  require "helper"
2
2
 
3
- describe SimpleCov::CommandGuesser do
4
- subject { SimpleCov::CommandGuesser }
5
- it 'correctly guesses "Unit Tests" for unit tests' do
6
- subject.original_run_command = "/some/path/test/units/foo_bar_test.rb"
7
- expect(subject.guess).to eq("Unit Tests")
8
- subject.original_run_command = "test/units/foo.rb"
9
- expect(subject.guess).to eq("Unit Tests")
10
- subject.original_run_command = "test/foo.rb"
11
- expect(subject.guess).to eq("Unit Tests")
12
- subject.original_run_command = "test/{models,helpers,unit}/**/*_test.rb"
13
- expect(subject.guess).to eq("Unit Tests")
14
- end
3
+ if SimpleCov.usable?
4
+ describe SimpleCov::CommandGuesser do
5
+ subject { SimpleCov::CommandGuesser }
6
+ it 'correctly guesses "Unit Tests" for unit tests' do
7
+ subject.original_run_command = "/some/path/test/units/foo_bar_test.rb"
8
+ expect(subject.guess).to eq("Unit Tests")
9
+ subject.original_run_command = "test/units/foo.rb"
10
+ expect(subject.guess).to eq("Unit Tests")
11
+ subject.original_run_command = "test/foo.rb"
12
+ expect(subject.guess).to eq("Unit Tests")
13
+ subject.original_run_command = "test/{models,helpers,unit}/**/*_test.rb"
14
+ expect(subject.guess).to eq("Unit Tests")
15
+ end
15
16
 
16
- it 'correctly guesses "Functional Tests" for functional tests' do
17
- subject.original_run_command = "/some/path/test/functional/foo_bar_controller_test.rb"
18
- expect(subject.guess).to eq("Functional Tests")
19
- subject.original_run_command = "test/{controllers,mailers,functional}/**/*_test.rb"
20
- expect(subject.guess).to eq("Functional Tests")
21
- end
17
+ it 'correctly guesses "Functional Tests" for functional tests' do
18
+ subject.original_run_command = "/some/path/test/functional/foo_bar_controller_test.rb"
19
+ expect(subject.guess).to eq("Functional Tests")
20
+ subject.original_run_command = "test/{controllers,mailers,functional}/**/*_test.rb"
21
+ expect(subject.guess).to eq("Functional Tests")
22
+ end
22
23
 
23
- it 'correctly guesses "Integration Tests" for integration tests' do
24
- subject.original_run_command = "/some/path/test/integration/foo_bar_controller_test.rb"
25
- expect(subject.guess).to eq("Integration Tests")
26
- subject.original_run_command = "test/integration/**/*_test.rb"
27
- expect(subject.guess).to eq("Integration Tests")
28
- end
24
+ it 'correctly guesses "Integration Tests" for integration tests' do
25
+ subject.original_run_command = "/some/path/test/integration/foo_bar_controller_test.rb"
26
+ expect(subject.guess).to eq("Integration Tests")
27
+ subject.original_run_command = "test/integration/**/*_test.rb"
28
+ expect(subject.guess).to eq("Integration Tests")
29
+ end
29
30
 
30
- it 'correctly guesses "Cucumber Features" for cucumber features' do
31
- subject.original_run_command = "features"
32
- expect(subject.guess).to eq("Cucumber Features")
33
- subject.original_run_command = "cucumber"
34
- expect(subject.guess).to eq("Cucumber Features")
35
- end
31
+ it 'correctly guesses "Cucumber Features" for cucumber features' do
32
+ subject.original_run_command = "features"
33
+ expect(subject.guess).to eq("Cucumber Features")
34
+ subject.original_run_command = "cucumber"
35
+ expect(subject.guess).to eq("Cucumber Features")
36
+ end
36
37
 
37
- it 'correctly guesses "RSpec" for RSpec' do
38
- subject.original_run_command = "/some/path/spec/foo.rb"
39
- expect(subject.guess).to eq("RSpec")
40
- end
38
+ it 'correctly guesses "RSpec" for RSpec' do
39
+ subject.original_run_command = "/some/path/spec/foo.rb"
40
+ expect(subject.guess).to eq("RSpec")
41
+ end
41
42
 
42
- it "defaults to RSpec because RSpec constant is defined" do
43
- subject.original_run_command = "some_arbitrary_command with arguments"
44
- expect(subject.guess).to eq("RSpec")
43
+ it "defaults to RSpec because RSpec constant is defined" do
44
+ subject.original_run_command = "some_arbitrary_command with arguments"
45
+ expect(subject.guess).to eq("RSpec")
46
+ end
45
47
  end
46
- end if SimpleCov.usable?
48
+ end
@@ -14,7 +14,7 @@ class SomeClass
14
14
  if item == label
15
15
  return true
16
16
  else
17
- fail "Item does not match label"
17
+ raise "Item does not match label"
18
18
  end
19
19
  rescue
20
20
  false
@@ -2,6 +2,7 @@ require "spec_helper"
2
2
 
3
3
  describe "forking" do
4
4
  it do
5
- Process.waitpid(Kernel.fork {})
5
+ # TODO: The defined?(RUBY_ENGINE) check can be dropped for simplecov 1.0.0
6
+ Process.waitpid(Kernel.fork {}) unless defined?(RUBY_ENGINE) && RUBY_ENGINE == "jruby"
6
7
  end
7
8
  end