single_cov 0.1.2 → 0.2.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 05a6eb04b545c815380bf75e183ed90ba6f4780c
4
- data.tar.gz: 3528bcf3ac7640ecb259660fa625cd2a9cd78c87
3
+ metadata.gz: e19ed01ef24061fbfa704ed22e38f4c8f1156c3d
4
+ data.tar.gz: cd7cff955cbd605b7d141e7e30ffc3c29d9e5420
5
5
  SHA512:
6
- metadata.gz: fa0a04a3cb6f313f9f4a763f2578e66dfe95f44eebb1300b517a46e393160bb0bfe2d28f1dcea60be725c1ca40650057fa4cf35b0a6fab7603d97755c770b67a
7
- data.tar.gz: 8973595431d85ce5f4cea0eae4c3322ae1d09d611be1d5f09b00af05e9f67f798d82d095d3fc999f21b9189f7696e464264945a24fa0afbbb1fd62c58bb9da3b
6
+ metadata.gz: 072530285e1f8eb1a5890f0ac16d9c31bf64d17b806cb71b973ccc5968c77ee1ab9c0bb63ad1557715629e46e291c97c69088d9edef0e2c54240b2686b287409
7
+ data.tar.gz: 962918212ffbffe7fba4a309d77993a1e7fac7e1093a4c3f3b9b87af444194fe1554683f8bfb7ef2d16af8464f354c7820f3f59fc44713085ef1bee1189c869f
@@ -1,3 +1,3 @@
1
1
  module SingleCov
2
- VERSION = "0.1.2"
2
+ VERSION = "0.2.0"
3
3
  end
data/lib/single_cov.rb CHANGED
@@ -62,14 +62,17 @@ module SingleCov
62
62
  when :minitest
63
63
  minitest_should_not_be_running!
64
64
  return if minitest_running_subset_of_tests?
65
- start_coverage_recording
66
-
67
- override_at_exit do |status, _exception|
68
- exit 1 if status == 0 && !SingleCov.all_covered?(coverage_results)
69
- end
65
+ when :rspec
66
+ return if rspec_running_subset_of_tests?
70
67
  else
71
68
  raise "Unsupported framework #{framework.inspect}"
72
69
  end
70
+
71
+ start_coverage_recording
72
+
73
+ override_at_exit do |status, _exception|
74
+ exit 1 if status == 0 && !SingleCov.all_covered?(coverage_results)
75
+ end
73
76
  end
74
77
 
75
78
  private
@@ -112,6 +115,10 @@ module SingleCov
112
115
  (ARGV & ['-n', '--name', '-l', '--line']).any?
113
116
  end
114
117
 
118
+ def rspec_running_subset_of_tests?
119
+ (ARGV & ['-t', '--tag', '-e', '--example']).any? || ARGV.any? { |a| a =~ /\:\d+$/ }
120
+ end
121
+
115
122
  # code stolen from SimpleCov
116
123
  def override_at_exit
117
124
  at_exit do
@@ -179,7 +186,7 @@ module SingleCov
179
186
  file = file.dup
180
187
 
181
188
  # remove project root
182
- file.sub!("#{Bundler.root}/", '')
189
+ file.sub!("#{Dir.pwd}/", '')
183
190
 
184
191
  # remove caller junk to get nice error messages when something fails
185
192
  file.sub!(/\.rb\b.*/, '.rb')
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: single_cov
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.2
4
+ version: 0.2.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Michael Grosser
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2016-04-19 00:00:00.000000000 Z
11
+ date: 2016-04-23 00:00:00.000000000 Z
12
12
  dependencies: []
13
13
  description:
14
14
  email: michael@grosser.it