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 +4 -4
- data/.rubocop.yml +11 -0
- data/.travis.yml +9 -4
- data/CHANGELOG.md +21 -1
- data/Gemfile +17 -13
- data/README.md +3 -16
- data/Rakefile +9 -4
- data/features/step_definitions/simplecov_steps.rb +1 -1
- data/features/support/env.rb +1 -1
- data/lib/simplecov/configuration.rb +4 -4
- data/lib/simplecov/defaults.rb +1 -1
- data/lib/simplecov/filter.rb +1 -1
- data/lib/simplecov/merge_helpers.rb +11 -9
- data/lib/simplecov/profiles.rb +2 -2
- data/lib/simplecov/result.rb +6 -1
- data/lib/simplecov/source_file.rb +11 -7
- data/lib/simplecov/version.rb +2 -2
- data/lib/simplecov.rb +5 -4
- data/simplecov.gemspec +1 -1
- data/spec/1_8_fallbacks_spec.rb +19 -17
- data/spec/command_guesser_spec.rb +40 -38
- data/spec/faked_project/lib/faked_project/some_class.rb +1 -1
- data/spec/faked_project/spec/forking_spec.rb +2 -1
- data/spec/file_list_spec.rb +48 -46
- data/spec/filters_spec.rb +73 -71
- data/spec/fixtures/deleted_source_sample.rb +1 -1
- data/spec/merge_helpers_spec.rb +96 -78
- data/spec/result_spec.rb +152 -150
- data/spec/return_codes_spec.rb +5 -8
- data/spec/source_file_line_spec.rb +109 -107
- data/spec/source_file_spec.rb +56 -54
- metadata +11 -5
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA1:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 15fa4589e25ee4710bdbcec7485a4d8ec7be7abb
|
|
4
|
+
data.tar.gz: a1627cf287ce3c70ba2d60e0943f28f90fcdef79
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
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
|
-
|
|
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
|
-
|
|
14
|
+
platforms :ruby_18 do
|
|
15
15
|
gem "activesupport", "~> 3.2.21"
|
|
16
16
|
gem "i18n", "~> 0.6.11"
|
|
17
17
|
end
|
|
18
|
-
|
|
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"
|
|
21
|
-
|
|
22
|
-
|
|
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"
|
|
29
|
-
gem "rubocop"
|
|
30
|
-
gem "test-unit"
|
|
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 [][Continuous Integration] [][Dependencies] [](https://codeclimate.com/github/colszowka/simplecov) [](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
|
-

|
|
105
105
|
|
|
106
106
|
|
|
107
107
|
**Source file coverage details view:**
|
|
108
108
|
|
|
109
|
-

|
|
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
|
|
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
|
-
|
|
34
|
-
|
|
35
|
-
|
|
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
|
-
|
|
14
|
+
raise ArgumentError, "Could not identify test framework #{framework}!"
|
|
15
15
|
end
|
|
16
16
|
end
|
|
17
17
|
|
data/features/support/env.rb
CHANGED
|
@@ -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
|
-
|
|
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
|
|
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?(
|
|
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
|
-
|
|
292
|
+
raise ArgumentError, "Please specify either a string or a block to filter with"
|
|
293
293
|
end
|
|
294
294
|
end
|
|
295
295
|
end
|
data/lib/simplecov/defaults.rb
CHANGED
|
@@ -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
|
|
data/lib/simplecov/filter.rb
CHANGED
|
@@ -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
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
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
|
-
|
|
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
|
data/lib/simplecov/profiles.rb
CHANGED
|
@@ -15,7 +15,7 @@ module SimpleCov
|
|
|
15
15
|
#
|
|
16
16
|
def define(name, &blk)
|
|
17
17
|
name = name.to_sym
|
|
18
|
-
|
|
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
|
-
|
|
27
|
+
raise "Could not find SimpleCov Profile called '#{name}'" unless key?(name)
|
|
28
28
|
SimpleCov.configure(&self[name])
|
|
29
29
|
end
|
|
30
30
|
end
|
data/lib/simplecov/result.rb
CHANGED
|
@@ -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" =>
|
|
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
|
-
|
|
29
|
-
|
|
30
|
-
|
|
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
|
data/lib/simplecov/version.rb
CHANGED
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
|
|
14
|
-
warn 'Coverage may be inaccurate; set
|
|
15
|
-
' do JRUBY_OPTS="
|
|
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.
|
|
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", "
|
|
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
|
|
data/spec/1_8_fallbacks_spec.rb
CHANGED
|
@@ -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
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
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
|
-
|
|
15
|
-
|
|
16
|
-
|
|
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
|
-
|
|
19
|
-
|
|
20
|
-
|
|
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
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
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
|
|
31
|
+
end
|
|
@@ -1,46 +1,48 @@
|
|
|
1
1
|
require "helper"
|
|
2
2
|
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
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
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
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
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
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
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
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
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
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
|
-
|
|
43
|
-
|
|
44
|
-
|
|
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
|
|
48
|
+
end
|