File tree Expand file tree Collapse file tree 10 files changed +37
-3
lines changed Expand file tree Collapse file tree 10 files changed +37
-3
lines changed Original file line number Diff line number Diff line change @@ -1261,7 +1261,8 @@ def safe_include(mod, host)
1261
1261
def safe_extend ( mod , host )
1262
1262
host . extend ( mod ) unless host . singleton_class < mod
1263
1263
end
1264
- else
1264
+ else # for 1.8.7
1265
+ # :nocov:
1265
1266
# @private
1266
1267
def safe_include ( mod , host )
1267
1268
host . __send__ ( :include , mod ) unless host . included_modules . include? ( mod )
@@ -1271,6 +1272,7 @@ def safe_include(mod, host)
1271
1272
def safe_extend ( mod , host )
1272
1273
host . extend ( mod ) unless ( class << host ; self ; end ) . included_modules . include? ( mod )
1273
1274
end
1275
+ # :nocov:
1274
1276
end
1275
1277
1276
1278
# @private
@@ -1665,6 +1667,7 @@ def file_glob_from(path, pattern)
1665
1667
end
1666
1668
1667
1669
if RSpec ::Support ::OS . windows?
1670
+ # :nocov:
1668
1671
def absolute_pattern? ( pattern )
1669
1672
pattern =~ /\A [A-Z]:\\ / || windows_absolute_network_path? ( pattern )
1670
1673
end
@@ -1673,6 +1676,7 @@ def windows_absolute_network_path?(pattern)
1673
1676
return false unless ::File ::ALT_SEPARATOR
1674
1677
pattern . start_with? ( ::File ::ALT_SEPARATOR + ::File ::ALT_SEPARATOR )
1675
1678
end
1679
+ # :nocov:
1676
1680
else
1677
1681
def absolute_pattern? ( pattern )
1678
1682
pattern . start_with? ( File ::Separator )
Original file line number Diff line number Diff line change @@ -482,6 +482,7 @@ def self.superclass_before_context_ivars
482
482
superclass . before_context_ivars
483
483
end
484
484
else # 1.8.7
485
+ # :nocov:
485
486
# @private
486
487
def self . superclass_before_context_ivars
487
488
if superclass . respond_to? ( :before_context_ivars )
@@ -496,6 +497,7 @@ def self.superclass_before_context_ivars
496
497
ancestors . find { |a | a . respond_to? ( :before_context_ivars ) } . before_context_ivars
497
498
end
498
499
end
500
+ # :nocov:
499
501
end
500
502
501
503
# @private
@@ -603,8 +605,10 @@ def self.set_ivars(instance, ivars)
603
605
end
604
606
605
607
if RUBY_VERSION . to_f < 1.9
608
+ # :nocov:
606
609
# @private
607
610
INSTANCE_VARIABLE_TO_IGNORE = '@__inspect_output' . freeze
611
+ # :nocov:
608
612
else
609
613
# @private
610
614
INSTANCE_VARIABLE_TO_IGNORE = :@__inspect_output
@@ -627,10 +631,12 @@ def inspect
627
631
end
628
632
629
633
unless method_defined? ( :singleton_class ) # for 1.8.7
634
+ # :nocov:
630
635
# @private
631
636
def singleton_class
632
637
class << self ; self ; end
633
638
end
639
+ # :nocov:
634
640
end
635
641
636
642
# Raised when an RSpec API is called in the wrong scope, such as `before`
@@ -774,13 +780,15 @@ def self.base_name_for(group)
774
780
end
775
781
776
782
if RUBY_VERSION == '1.9.2'
783
+ # :nocov:
777
784
class << self
778
785
alias _base_name_for base_name_for
779
786
def base_name_for ( group )
780
787
_base_name_for ( group ) + '_'
781
788
end
782
789
end
783
790
private_class_method :_base_name_for
791
+ # :nocov:
784
792
end
785
793
786
794
def self . disambiguate ( name , const_scope )
Original file line number Diff line number Diff line change @@ -7,9 +7,11 @@ def flat_map(array, &block)
7
7
array . flat_map ( &block )
8
8
end
9
9
else # for 1.8.7
10
+ # :nocov:
10
11
def flat_map ( array , &block )
11
12
array . map ( &block ) . flatten ( 1 )
12
13
end
14
+ # :nocov:
13
15
end
14
16
15
17
module_function :flat_map
Original file line number Diff line number Diff line change @@ -394,10 +394,12 @@ def execute_with(example, procsy)
394
394
def hook_description
395
395
"around hook at #{ Metadata . relative_path ( block . source_location . join ( ':' ) ) } "
396
396
end
397
- else
397
+ else # for 1.8.7
398
+ # :nocov:
398
399
def hook_description
399
400
"around hook"
400
401
end
402
+ # :nocov:
401
403
end
402
404
end
403
405
@@ -622,9 +624,11 @@ def owner_parent_groups
622
624
@owner . parent_groups
623
625
end
624
626
else # Ruby < 2.1 (see https://bugs.ruby-lang.org/issues/8035)
627
+ # :nocov:
625
628
def owner_parent_groups
626
629
@owner_parent_groups ||= [ @owner ] + @owner . parent_groups
627
630
end
631
+ # :nocov:
628
632
end
629
633
end
630
634
end
Original file line number Diff line number Diff line change @@ -443,13 +443,15 @@ def self.define_helpers_on(example_group)
443
443
# Gets the named constant or yields.
444
444
# On 1.8, const_defined? / const_get do not take into
445
445
# account the inheritance hierarchy.
446
+ # :nocov:
446
447
def self . get_constant_or_yield ( example_group , name )
447
448
if example_group . const_defined? ( name )
448
449
example_group . const_get ( name )
449
450
else
450
451
yield
451
452
end
452
453
end
454
+ # :nocov:
453
455
else
454
456
# @private
455
457
#
Original file line number Diff line number Diff line change @@ -127,6 +127,7 @@ def items_for(request_meta)
127
127
end
128
128
129
129
unless [ ] . respond_to? ( :each_with_object ) # For 1.8.7
130
+ # :nocov:
130
131
undef items_for
131
132
def items_for ( request_meta )
132
133
@items_and_filters . inject ( [ ] ) do |to_return , ( item , item_meta ) |
@@ -135,6 +136,7 @@ def items_for(request_meta)
135
136
to_return
136
137
end
137
138
end
139
+ # :nocov:
138
140
end
139
141
end
140
142
@@ -217,13 +219,15 @@ def proc_keys_from(metadata)
217
219
end
218
220
219
221
unless [ ] . respond_to? ( :each_with_object ) # For 1.8.7
222
+ # :nocov:
220
223
undef proc_keys_from
221
224
def proc_keys_from ( metadata )
222
225
metadata . inject ( [ ] ) do |to_return , ( key , value ) |
223
226
to_return << key if Proc === value
224
227
to_return
225
228
end
226
229
end
230
+ # :nocov:
227
231
end
228
232
end
229
233
end
Original file line number Diff line number Diff line change @@ -209,13 +209,15 @@ def encoding_of(string)
209
209
def encoded_string ( string )
210
210
RSpec ::Support ::EncodedString . new ( string , Encoding . default_external )
211
211
end
212
- else
212
+ else # for 1.8.7
213
+ # :nocov:
213
214
def encoding_of ( _string )
214
215
end
215
216
216
217
def encoded_string ( string )
217
218
RSpec ::Support ::EncodedString . new ( string )
218
219
end
220
+ # :nocov:
219
221
end
220
222
221
223
def backtrace_formatter
Original file line number Diff line number Diff line change @@ -4,9 +4,11 @@ module Core
4
4
# @private
5
5
RandomNumberGenerator = ::Random
6
6
else
7
+ # :nocov:
7
8
RSpec ::Support . require_rspec_core "backport_random"
8
9
# @private
9
10
RandomNumberGenerator = RSpec ::Core ::Backports ::Random
11
+ # :nocov:
10
12
end
11
13
12
14
# @private
@@ -42,6 +44,7 @@ def shuffle(list, rng)
42
44
list . shuffle ( :random => rng )
43
45
end
44
46
else
47
+ # :nocov:
45
48
def shuffle ( list , rng )
46
49
shuffled = list . dup
47
50
shuffled . size . times do |i |
@@ -52,6 +55,7 @@ def shuffle(list, rng)
52
55
53
56
shuffled
54
57
end
58
+ # :nocov:
55
59
end
56
60
end
57
61
Original file line number Diff line number Diff line change @@ -123,9 +123,11 @@ def file_inclusion_specification
123
123
end
124
124
125
125
if RSpec ::Support ::OS . windows?
126
+ # :nocov:
126
127
def escape ( shell_command )
127
128
"'#{ shell_command . gsub ( "'" , "\\ \\ '" ) } '"
128
129
end
130
+ # :nocov:
129
131
else
130
132
require 'shellwords'
131
133
Original file line number Diff line number Diff line change @@ -195,10 +195,12 @@ def formatted_location(block)
195
195
if Proc . method_defined? ( :source_location )
196
196
def ensure_block_has_source_location ( _block ) ; end
197
197
else # for 1.8.7
198
+ # :nocov:
198
199
def ensure_block_has_source_location ( block )
199
200
source_location = yield . split ( ':' )
200
201
block . extend Module . new { define_method ( :source_location ) { source_location } }
201
202
end
203
+ # :nocov:
202
204
end
203
205
end
204
206
end
You can’t perform that action at this time.
0 commit comments