Skip to content

Commit d6a7b13

Browse files
committed
Merge pull request rspec#1905 from rspec/update-coverage
Update coverage
2 parents 613f203 + c161a7c commit d6a7b13

39 files changed

+338
-100
lines changed

Changelog.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,8 @@ Bug Fixes:
3232
* Handle invalid UTF-8 strings within exception methods. (Benjamin Fleischer, #1760)
3333
* Fix Rake Task quoting of file names with quotes to work properly on
3434
Windows. (Myron Marston, #1887)
35+
* Fix `RSpec::Core::RakeTask#failure_message` so that it gets printed
36+
when the task failed. (Myron Marston, #1905)
3537

3638
### 3.2.2 / 2015-03-11
3739
[Full Changelog](http://github.com/rspec/rspec-core/compare/v3.2.1...v3.2.2)

lib/rspec/core/backtrace_formatter.rb

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -47,8 +47,6 @@ def format_backtrace(backtrace, options={})
4747

4848
def backtrace_line(line)
4949
Metadata.relative_path(line) unless exclude?(line)
50-
rescue SecurityError
51-
nil
5250
end
5351

5452
def exclude?(line)

lib/rspec/core/configuration.rb

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1261,7 +1261,8 @@ def safe_include(mod, host)
12611261
def safe_extend(mod, host)
12621262
host.extend(mod) unless host.singleton_class < mod
12631263
end
1264-
else
1264+
else # for 1.8.7
1265+
# :nocov:
12651266
# @private
12661267
def safe_include(mod, host)
12671268
host.__send__(:include, mod) unless host.included_modules.include?(mod)
@@ -1271,6 +1272,7 @@ def safe_include(mod, host)
12711272
def safe_extend(mod, host)
12721273
host.extend(mod) unless (class << host; self; end).included_modules.include?(mod)
12731274
end
1275+
# :nocov:
12741276
end
12751277

12761278
# @private
@@ -1665,6 +1667,7 @@ def file_glob_from(path, pattern)
16651667
end
16661668

16671669
if RSpec::Support::OS.windows?
1670+
# :nocov:
16681671
def absolute_pattern?(pattern)
16691672
pattern =~ /\A[A-Z]:\\/ || windows_absolute_network_path?(pattern)
16701673
end
@@ -1673,6 +1676,7 @@ def windows_absolute_network_path?(pattern)
16731676
return false unless ::File::ALT_SEPARATOR
16741677
pattern.start_with?(::File::ALT_SEPARATOR + ::File::ALT_SEPARATOR)
16751678
end
1679+
# :nocov:
16761680
else
16771681
def absolute_pattern?(pattern)
16781682
pattern.start_with?(File::Separator)

lib/rspec/core/example.rb

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -460,14 +460,6 @@ def location_description
460460
"example at #{location}"
461461
end
462462

463-
def skip_message
464-
if String === skip
465-
skip
466-
else
467-
Pending::NO_REASON_GIVEN
468-
end
469-
end
470-
471463
# Represents the result of executing an example.
472464
# Behaves like a hash for backwards compatibility.
473465
class ExecutionResult

lib/rspec/core/example_group.rb

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -482,6 +482,7 @@ def self.superclass_before_context_ivars
482482
superclass.before_context_ivars
483483
end
484484
else # 1.8.7
485+
# :nocov:
485486
# @private
486487
def self.superclass_before_context_ivars
487488
if superclass.respond_to?(:before_context_ivars)
@@ -496,6 +497,7 @@ def self.superclass_before_context_ivars
496497
ancestors.find { |a| a.respond_to?(:before_context_ivars) }.before_context_ivars
497498
end
498499
end
500+
# :nocov:
499501
end
500502

501503
# @private
@@ -603,8 +605,10 @@ def self.set_ivars(instance, ivars)
603605
end
604606

605607
if RUBY_VERSION.to_f < 1.9
608+
# :nocov:
606609
# @private
607610
INSTANCE_VARIABLE_TO_IGNORE = '@__inspect_output'.freeze
611+
# :nocov:
608612
else
609613
# @private
610614
INSTANCE_VARIABLE_TO_IGNORE = :@__inspect_output
@@ -627,10 +631,12 @@ def inspect
627631
end
628632

629633
unless method_defined?(:singleton_class) # for 1.8.7
634+
# :nocov:
630635
# @private
631636
def singleton_class
632637
class << self; self; end
633638
end
639+
# :nocov:
634640
end
635641

636642
# Raised when an RSpec API is called in the wrong scope, such as `before`
@@ -774,13 +780,15 @@ def self.base_name_for(group)
774780
end
775781

776782
if RUBY_VERSION == '1.9.2'
783+
# :nocov:
777784
class << self
778785
alias _base_name_for base_name_for
779786
def base_name_for(group)
780787
_base_name_for(group) + '_'
781788
end
782789
end
783790
private_class_method :_base_name_for
791+
# :nocov:
784792
end
785793

786794
def self.disambiguate(name, const_scope)

lib/rspec/core/filter_manager.rb

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -183,10 +183,6 @@ def add_with_low_priority(*args)
183183
apply_standalone_filter(*args) || super
184184
end
185185

186-
def use(*args)
187-
apply_standalone_filter(*args) || super
188-
end
189-
190186
def include_example?(example)
191187
@rules.empty? || super
192188
end

lib/rspec/core/flat_map.rb

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,9 +7,11 @@ def flat_map(array, &block)
77
array.flat_map(&block)
88
end
99
else # for 1.8.7
10+
# :nocov:
1011
def flat_map(array, &block)
1112
array.map(&block).flatten(1)
1213
end
14+
# :nocov:
1315
end
1416

1517
module_function :flat_map

lib/rspec/core/formatters.rb

Lines changed: 1 addition & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -138,13 +138,7 @@ def add(formatter_to_use, *paths)
138138
formatter = RSpec::LegacyFormatters.load_formatter formatter_class, *args
139139
@reporter.register_listener formatter, *formatter.notifications
140140
else
141-
line = ::RSpec::CallerFilter.first_non_rspec_line
142-
if line
143-
call_site = "Formatter added at: #{line}"
144-
else
145-
call_site = "The formatter was added via command line flag or your "\
146-
"`.rspec` file."
147-
end
141+
call_site = "Formatter added at: #{::RSpec::CallerFilter.first_non_rspec_line}"
148142

149143
RSpec.warn_deprecation <<-WARNING.gsub(/\s*\|/, ' ')
150144
|The #{formatter_class} formatter uses the deprecated formatter

lib/rspec/core/formatters/documentation_formatter.rb

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -64,10 +64,6 @@ def next_failure_index
6464
def current_indentation
6565
' ' * @group_level
6666
end
67-
68-
def example_group_chain
69-
example_group.parent_groups.reverse
70-
end
7167
end
7268
end
7369
end

lib/rspec/core/formatters/html_formatter.rb

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -74,8 +74,6 @@ def example_failed(failure)
7474
:message => exception.message,
7575
:backtrace => failure.formatted_backtrace.join("\n")
7676
}
77-
else
78-
false
7977
end
8078
extra = extra_failure_content(failure)
8179

@@ -85,8 +83,7 @@ def example_failed(failure)
8583
example.execution_result.run_time,
8684
@failed_examples.size,
8785
exception_details,
88-
(extra == "") ? false : extra,
89-
true
86+
(extra == "") ? false : extra
9087
)
9188
@printer.flush
9289
end

lib/rspec/core/formatters/html_printer.rb

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ def print_example_passed(description, run_time)
3535

3636
# rubocop:disable Style/ParameterLists
3737
def print_example_failed(pending_fixed, description, run_time, failure_id,
38-
exception, extra_content, escape_backtrace=false)
38+
exception, extra_content)
3939
# rubocop:enable Style/ParameterLists
4040
formatted_run_time = "%.5f" % run_time
4141

@@ -45,11 +45,7 @@ def print_example_failed(pending_fixed, description, run_time, failure_id,
4545
@output.puts " <div class=\"failure\" id=\"failure_#{failure_id}\">"
4646
if exception
4747
@output.puts " <div class=\"message\"><pre>#{h(exception[:message])}</pre></div>"
48-
if escape_backtrace
49-
@output.puts " <div class=\"backtrace\"><pre>#{h exception[:backtrace]}</pre></div>"
50-
else
51-
@output.puts " <div class=\"backtrace\"><pre>#{exception[:backtrace]}</pre></div>"
52-
end
48+
@output.puts " <div class=\"backtrace\"><pre>#{h exception[:backtrace]}</pre></div>"
5349
end
5450
@output.puts extra_content if extra_content
5551
@output.puts " </div>"

lib/rspec/core/formatters/snippet_extractor.rb

Lines changed: 12 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -7,26 +7,30 @@ module Formatters
77
# and applies synax highlighting and line numbers using html.
88
class SnippetExtractor
99
# @private
10-
class NullConverter
11-
def convert(code)
10+
module NullConverter
11+
def self.convert(code)
1212
%Q(#{code}\n<span class="comment"># Install the coderay gem to get syntax highlighting</span>)
1313
end
1414
end
1515

1616
# @private
17-
class CoderayConverter
18-
def convert(code)
17+
module CoderayConverter
18+
def self.convert(code)
1919
CodeRay.scan(code, :ruby).html(:line_numbers => false)
2020
end
2121
end
2222

23+
# rubocop:disable Style/ClassVars
24+
@@converter = NullConverter
2325
begin
2426
require 'coderay'
25-
# rubocop:disable Style/ClassVars
26-
@@converter = CoderayConverter.new
27+
@@converter = CoderayConverter
28+
# rubocop:disable Lint/HandleExceptions
2729
rescue LoadError
28-
@@converter = NullConverter.new
30+
# it'll fall back to the NullConverter assigned above
31+
# rubocop:enable Lint/HandleExceptions
2932
end
33+
3034
# rubocop:enable Style/ClassVars
3135

3236
# @api private
@@ -43,6 +47,7 @@ def snippet(backtrace)
4347
highlighted = @@converter.convert(raw_code)
4448
post_process(highlighted, line)
4549
end
50+
# rubocop:enable Style/ClassVars
4651

4752
# @api private
4853
#

lib/rspec/core/hooks.rb

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -394,10 +394,12 @@ def execute_with(example, procsy)
394394
def hook_description
395395
"around hook at #{Metadata.relative_path(block.source_location.join(':'))}"
396396
end
397-
else
397+
else # for 1.8.7
398+
# :nocov:
398399
def hook_description
399400
"around hook"
400401
end
402+
# :nocov:
401403
end
402404
end
403405

@@ -622,9 +624,11 @@ def owner_parent_groups
622624
@owner.parent_groups
623625
end
624626
else # Ruby < 2.1 (see https://bugs.ruby-lang.org/issues/8035)
627+
# :nocov:
625628
def owner_parent_groups
626629
@owner_parent_groups ||= [@owner] + @owner.parent_groups
627630
end
631+
# :nocov:
628632
end
629633
end
630634
end

lib/rspec/core/memoized_helpers.rb

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -443,13 +443,15 @@ def self.define_helpers_on(example_group)
443443
# Gets the named constant or yields.
444444
# On 1.8, const_defined? / const_get do not take into
445445
# account the inheritance hierarchy.
446+
# :nocov:
446447
def self.get_constant_or_yield(example_group, name)
447448
if example_group.const_defined?(name)
448449
example_group.const_get(name)
449450
else
450451
yield
451452
end
452453
end
454+
# :nocov:
453455
else
454456
# @private
455457
#

lib/rspec/core/metadata.rb

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -99,12 +99,6 @@ def self.deep_hash_dup(object)
9999
end
100100
end
101101

102-
# @private
103-
def self.backtrace_from(block)
104-
return caller unless block.respond_to?(:source_location)
105-
[block.source_location.join(':')]
106-
end
107-
108102
# @private
109103
def self.id_from(metadata)
110104
"#{metadata[:rerun_file_path]}[#{metadata[:scoped_id]}]"

lib/rspec/core/metadata_filter.rb

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -127,6 +127,7 @@ def items_for(request_meta)
127127
end
128128

129129
unless [].respond_to?(:each_with_object) # For 1.8.7
130+
# :nocov:
130131
undef items_for
131132
def items_for(request_meta)
132133
@items_and_filters.inject([]) do |to_return, (item, item_meta)|
@@ -135,6 +136,7 @@ def items_for(request_meta)
135136
to_return
136137
end
137138
end
139+
# :nocov:
138140
end
139141
end
140142

@@ -217,13 +219,15 @@ def proc_keys_from(metadata)
217219
end
218220

219221
unless [].respond_to?(:each_with_object) # For 1.8.7
222+
# :nocov:
220223
undef proc_keys_from
221224
def proc_keys_from(metadata)
222225
metadata.inject([]) do |to_return, (key, value)|
223226
to_return << key if Proc === value
224227
to_return
225228
end
226229
end
230+
# :nocov:
227231
end
228232
end
229233
end

lib/rspec/core/notifications.rb

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -209,13 +209,15 @@ def encoding_of(string)
209209
def encoded_string(string)
210210
RSpec::Support::EncodedString.new(string, Encoding.default_external)
211211
end
212-
else
212+
else # for 1.8.7
213+
# :nocov:
213214
def encoding_of(_string)
214215
end
215216

216217
def encoded_string(string)
217218
RSpec::Support::EncodedString.new(string)
218219
end
220+
# :nocov:
219221
end
220222

221223
def backtrace_formatter

lib/rspec/core/ordering.rb

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,9 +4,11 @@ module Core
44
# @private
55
RandomNumberGenerator = ::Random
66
else
7+
# :nocov:
78
RSpec::Support.require_rspec_core "backport_random"
89
# @private
910
RandomNumberGenerator = RSpec::Core::Backports::Random
11+
# :nocov:
1012
end
1113

1214
# @private
@@ -42,6 +44,7 @@ def shuffle(list, rng)
4244
list.shuffle(:random => rng)
4345
end
4446
else
47+
# :nocov:
4548
def shuffle(list, rng)
4649
shuffled = list.dup
4750
shuffled.size.times do |i|
@@ -52,6 +55,7 @@ def shuffle(list, rng)
5255

5356
shuffled
5457
end
58+
# :nocov:
5559
end
5660
end
5761

0 commit comments

Comments
 (0)