rspec-core 3.5.3 → 3.6.0.beta2
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
- checksums.yaml.gz.sig +3 -1
- data/Changelog.md +47 -2
- data/lib/rspec/core/bisect/server.rb +6 -1
- data/lib/rspec/core/configuration.rb +69 -15
- data/lib/rspec/core/drb.rb +2 -0
- data/lib/rspec/core/example_group.rb +12 -2
- data/lib/rspec/core/formatters/base_text_formatter.rb +0 -1
- data/lib/rspec/core/formatters/console_codes.rb +7 -4
- data/lib/rspec/core/formatters/documentation_formatter.rb +1 -0
- data/lib/rspec/core/formatters/exception_presenter.rb +5 -1
- data/lib/rspec/core/formatters/html_formatter.rb +4 -2
- data/lib/rspec/core/formatters/html_snippet_extractor.rb +2 -0
- data/lib/rspec/core/formatters/progress_formatter.rb +1 -0
- data/lib/rspec/core/formatters/protocol.rb +23 -23
- data/lib/rspec/core/formatters.rb +1 -1
- data/lib/rspec/core/invocations.rb +22 -4
- data/lib/rspec/core/metadata_filter.rb +12 -17
- data/lib/rspec/core/notifications.rb +17 -1
- data/lib/rspec/core/option_parser.rb +32 -12
- data/lib/rspec/core/project_initializer/.rspec +0 -1
- data/lib/rspec/core/project_initializer/spec/spec_helper.rb +1 -1
- data/lib/rspec/core/reporter.rb +5 -2
- data/lib/rspec/core/runner.rb +6 -1
- data/lib/rspec/core/shared_example_group.rb +39 -10
- data/lib/rspec/core/source/syntax_highlighter.rb +20 -0
- data/lib/rspec/core/version.rb +1 -1
- data/lib/rspec/core/world.rb +1 -0
- data/lib/rspec/core.rb +1 -0
- data.tar.gz.sig +0 -0
- metadata +10 -10
- metadata.gz.sig +0 -0
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA1:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: cedf9914463a5f8470ddb33bef491f31615a7b63
|
|
4
|
+
data.tar.gz: 8eecab50a480c797c96f53932f955643f23db6eb
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: a162b44414bcbd3ac23ee749f456976c10858bc84b8703a4ef63f370fcf8a691b7366ef8a9d0d2e15f7cecea6f38ce78379da1a25be1f75bf09ea9e913aa4939
|
|
7
|
+
data.tar.gz: f9a9b8815b6a42d5da60f033443dbf145b025058a6ec327c8a16fde556c83a753b1ed2bfd54ae85e02772fa54e8d7169c7323e034622b52ffbd9e3eab0826841
|
checksums.yaml.gz.sig
CHANGED
|
@@ -1 +1,3 @@
|
|
|
1
|
-
|
|
1
|
+
�#�O̥`w��;h����%���:~չ�ah!�6�{��i�[ld�\o���]]��,3�
|
|
2
|
+
�����>�JJ�� �1����YR����GT��I��b���8i|��:-&�
|
|
3
|
+
-���+�!I~��_抁������g�E����V�9`3�?P[�l��t ;S��"G��%�8�{����h��mf��rý�����дm+�spՕ� ����_� ��u����U��Ue\�P��װ��m���
|
data/Changelog.md
CHANGED
|
@@ -1,3 +1,48 @@
|
|
|
1
|
+
### 3.6.0.beta2 / 2016-12-12
|
|
2
|
+
[Full Changelog](http://github.com/rspec/rspec-core/compare/v3.6.0.beta1...v3.6.0.beta2)
|
|
3
|
+
|
|
4
|
+
Enhancements:
|
|
5
|
+
|
|
6
|
+
* Include count of errors occurring outside examples in default summaries.
|
|
7
|
+
(#2351, Jon Rowe)
|
|
8
|
+
* Warn when including shared example groups recursively. (#2356, Jon Rowe)
|
|
9
|
+
* Improve failure snippet syntax highlighting with CodeRay to highlight
|
|
10
|
+
RSpec "keywords" like `expect`. (#2358, Myron Marston)
|
|
11
|
+
|
|
12
|
+
### 3.6.0.beta1 / 2016-10-09
|
|
13
|
+
[Full Changelog](http://github.com/rspec/rspec-core/compare/v3.5.4...v3.6.0.beta1)
|
|
14
|
+
|
|
15
|
+
Enhancements:
|
|
16
|
+
|
|
17
|
+
* Warn when duplicate shared examples definitions are loaded due to being
|
|
18
|
+
defined in files matching the spec pattern (e.g. `_spec.rb`) (#2278, Devon Estes)
|
|
19
|
+
* Improve metadata filtering so that it can match against any object
|
|
20
|
+
that implements `===` instead of treating regular expressions as
|
|
21
|
+
special. (Myron Marston, #2294)
|
|
22
|
+
* Improve `rspec -v` so that it prints out the versions of each part of
|
|
23
|
+
RSpec to prevent confusion. (Myron Marston, #2304)
|
|
24
|
+
* Add `config.fail_if_no_examples` option which causes RSpec to fail if
|
|
25
|
+
no examples are found. (Ewa Czechowska, #2302)
|
|
26
|
+
* Nicely format errors encountered while loading spec files.
|
|
27
|
+
(Myron Marston, #2323)
|
|
28
|
+
* Improve the API for enabling and disabling color output (Josh
|
|
29
|
+
Justice, #2321):
|
|
30
|
+
* Automatically enable color if the output is a TTY, since color is
|
|
31
|
+
nearly always desirable if the output can handle it.
|
|
32
|
+
* Introduce new CLI flag to force color on (`--force-color`), even
|
|
33
|
+
if the output is not a TTY. `--no-color` continues to work as well.
|
|
34
|
+
* Introduce `config.color_mode` for configuring the color from Ruby.
|
|
35
|
+
`:automatic` is the default and will produce color if the output is
|
|
36
|
+
a TTY. `:on` forces it on and `:off` forces it off.
|
|
37
|
+
|
|
38
|
+
### 3.5.4 / 2016-09-30
|
|
39
|
+
[Full Changelog](http://github.com/rspec/rspec-core/compare/v3.5.3...v3.5.4)
|
|
40
|
+
|
|
41
|
+
Bug Fixes:
|
|
42
|
+
|
|
43
|
+
* Remove accumulated `ExampleGroup` constants when reseting RSpec,
|
|
44
|
+
preventing a memory leak. (TravisSpangle, #2328)
|
|
45
|
+
|
|
1
46
|
### 3.5.3 / 2016-09-02
|
|
2
47
|
[Full Changelog](http://github.com/rspec/rspec-core/compare/v3.5.2...v3.5.3)
|
|
3
48
|
|
|
@@ -1855,7 +1900,7 @@ project's root directory or in your home directory:
|
|
|
1855
1900
|
|
|
1856
1901
|
require "autotest/bundler"
|
|
1857
1902
|
|
|
1858
|
-
Now you can just type 'autotest' on the
|
|
1903
|
+
Now you can just type 'autotest' on the command line and it will work as you expect.
|
|
1859
1904
|
|
|
1860
1905
|
If you don't want 'bundle exec', there is nothing you have to do.
|
|
1861
1906
|
|
|
@@ -2043,7 +2088,7 @@ Bug fixes
|
|
|
2043
2088
|
Enhancements
|
|
2044
2089
|
|
|
2045
2090
|
* implicitly require unknown formatters so you don't have to require the file
|
|
2046
|
-
explicitly on the
|
|
2091
|
+
explicitly on the command line (Michael Grosser)
|
|
2047
2092
|
* add --out/-o option to assign output target
|
|
2048
2093
|
* added fail_fast configuration option to abort on first failure
|
|
2049
2094
|
* support a Hash subject (its([:key]) { should == value }) (Josep M. Bach)
|
|
@@ -25,7 +25,12 @@ module RSpec
|
|
|
25
25
|
self.files_or_directories_to_run = files_or_directories_to_run
|
|
26
26
|
self.latest_run_results = nil
|
|
27
27
|
run_output = yield
|
|
28
|
-
|
|
28
|
+
|
|
29
|
+
if latest_run_results.nil? || latest_run_results.all_example_ids.empty?
|
|
30
|
+
raise_bisect_failed(run_output)
|
|
31
|
+
end
|
|
32
|
+
|
|
33
|
+
latest_run_results
|
|
29
34
|
end
|
|
30
35
|
|
|
31
36
|
def start
|
|
@@ -199,6 +199,10 @@ module RSpec
|
|
|
199
199
|
# The exit code to return if there are any failures (default: 1).
|
|
200
200
|
add_setting :failure_exit_code
|
|
201
201
|
|
|
202
|
+
# @macro add_setting
|
|
203
|
+
# Whether or not to fail when there are no RSpec examples (default: false).
|
|
204
|
+
add_setting :fail_if_no_examples
|
|
205
|
+
|
|
202
206
|
# @macro define_reader
|
|
203
207
|
# Indicates files configured to be required.
|
|
204
208
|
define_reader :requires
|
|
@@ -394,6 +398,7 @@ module RSpec
|
|
|
394
398
|
add_setting :max_displayed_failure_line_count
|
|
395
399
|
|
|
396
400
|
# @private
|
|
401
|
+
# @deprecated Use {#color_mode} = :on, instead of {#color} with {#tty}
|
|
397
402
|
add_setting :tty
|
|
398
403
|
# @private
|
|
399
404
|
attr_writer :files_to_run
|
|
@@ -422,9 +427,11 @@ module RSpec
|
|
|
422
427
|
@files_or_directories_to_run = []
|
|
423
428
|
@loaded_spec_files = Set.new
|
|
424
429
|
@color = false
|
|
430
|
+
@color_mode = :automatic
|
|
425
431
|
@pattern = '**{,/*/**}/*_spec.rb'
|
|
426
432
|
@exclude_pattern = ''
|
|
427
433
|
@failure_exit_code = 1
|
|
434
|
+
@fail_if_no_examples = false
|
|
428
435
|
@spec_files_loaded = false
|
|
429
436
|
|
|
430
437
|
@backtrace_formatter = BacktraceFormatter.new
|
|
@@ -773,24 +780,54 @@ module RSpec
|
|
|
773
780
|
@backtrace_formatter.full_backtrace = true_or_false
|
|
774
781
|
end
|
|
775
782
|
|
|
776
|
-
#
|
|
777
|
-
#
|
|
783
|
+
# Enables color output if the output is a TTY. As of RSpec 3.6, this is
|
|
784
|
+
# the default behavior and this option is retained only for backwards
|
|
785
|
+
# compatibility.
|
|
778
786
|
#
|
|
787
|
+
# @deprecated No longer recommended because of complex behavior. Instead,
|
|
788
|
+
# rely on the fact that TTYs will display color by default, or set
|
|
789
|
+
# {#color_mode} to :on to display color on a non-TTY output.
|
|
790
|
+
# @see color_mode
|
|
779
791
|
# @see color_enabled?
|
|
780
792
|
# @return [Boolean]
|
|
781
793
|
def color
|
|
782
794
|
value_for(:color) { @color }
|
|
783
795
|
end
|
|
784
796
|
|
|
797
|
+
# The mode for determining whether to display output in color. One of:
|
|
798
|
+
#
|
|
799
|
+
# - :automatic - the output will be in color if the output is a TTY (the
|
|
800
|
+
# default)
|
|
801
|
+
# - :on - the output will be in color, whether or not the output is a TTY
|
|
802
|
+
# - :off - the output will not be in color
|
|
803
|
+
#
|
|
804
|
+
# @see color_enabled?
|
|
805
|
+
# @return [Boolean]
|
|
806
|
+
def color_mode
|
|
807
|
+
value_for(:color_mode) { @color_mode }
|
|
808
|
+
end
|
|
809
|
+
|
|
785
810
|
# Check if color is enabled for a particular output.
|
|
786
811
|
# @param output [IO] an output stream to use, defaults to the current
|
|
787
812
|
# `output_stream`
|
|
788
813
|
# @return [Boolean]
|
|
789
814
|
def color_enabled?(output=output_stream)
|
|
790
|
-
|
|
815
|
+
case color_mode
|
|
816
|
+
when :on then true
|
|
817
|
+
when :off then false
|
|
818
|
+
else # automatic
|
|
819
|
+
output_to_tty?(output) || (color && tty?)
|
|
820
|
+
end
|
|
791
821
|
end
|
|
792
822
|
|
|
823
|
+
# Set the color mode.
|
|
824
|
+
attr_writer :color_mode
|
|
825
|
+
|
|
793
826
|
# Toggle output color.
|
|
827
|
+
#
|
|
828
|
+
# @deprecated No longer recommended because of complex behavior. Instead,
|
|
829
|
+
# rely on the fact that TTYs will display color by default, or set
|
|
830
|
+
# {:color_mode} to :on to display color on a non-TTY output.
|
|
794
831
|
attr_writer :color
|
|
795
832
|
|
|
796
833
|
# @private
|
|
@@ -813,19 +850,22 @@ module RSpec
|
|
|
813
850
|
end
|
|
814
851
|
|
|
815
852
|
# @overload add_formatter(formatter)
|
|
853
|
+
# @overload add_formatter(formatter, output)
|
|
816
854
|
#
|
|
817
|
-
#
|
|
818
|
-
#
|
|
819
|
-
# `
|
|
855
|
+
# @param formatter [Class, String] formatter to use. Can be any of the
|
|
856
|
+
# string values supported from the CLI (`p`/`progress`,
|
|
857
|
+
# `d`/`doc`/`documentation`, `h`/`html`, or `j`/`json`) or any
|
|
858
|
+
# class that implements the formatter protocol and has registered
|
|
859
|
+
# itself with RSpec as a formatter.
|
|
860
|
+
# @param output [String, IO] where the formatter will write its output.
|
|
861
|
+
# Can be an IO object or a string path to a file. If not provided,
|
|
862
|
+
# the configured `output_stream` (`$stdout`, by default) will be used.
|
|
820
863
|
#
|
|
821
|
-
#
|
|
864
|
+
# Adds a formatter to the set RSpec will use for this run.
|
|
822
865
|
#
|
|
823
|
-
#
|
|
824
|
-
|
|
825
|
-
|
|
826
|
-
def add_formatter(formatter_to_use, *paths)
|
|
827
|
-
paths << output_stream if paths.empty?
|
|
828
|
-
formatter_loader.add formatter_to_use, *paths
|
|
866
|
+
# @see RSpec::Core::Formatters::Protocol
|
|
867
|
+
def add_formatter(formatter, output=output_stream)
|
|
868
|
+
formatter_loader.add(formatter, output)
|
|
829
869
|
end
|
|
830
870
|
alias_method :formatter=, :add_formatter
|
|
831
871
|
|
|
@@ -1432,7 +1472,7 @@ module RSpec
|
|
|
1432
1472
|
|
|
1433
1473
|
files_to_run.uniq.each do |f|
|
|
1434
1474
|
file = File.expand_path(f)
|
|
1435
|
-
|
|
1475
|
+
load_spec_file_handling_errors(file)
|
|
1436
1476
|
loaded_spec_files << file
|
|
1437
1477
|
end
|
|
1438
1478
|
|
|
@@ -1859,6 +1899,14 @@ module RSpec
|
|
|
1859
1899
|
|
|
1860
1900
|
private
|
|
1861
1901
|
|
|
1902
|
+
def load_spec_file_handling_errors(file)
|
|
1903
|
+
load file
|
|
1904
|
+
rescue Support::AllExceptionsExceptOnesWeMustNotRescue => ex
|
|
1905
|
+
relative_file = Metadata.relative_path(file)
|
|
1906
|
+
reporter.notify_non_example_exception(ex, "An error occurred while loading #{relative_file}.")
|
|
1907
|
+
RSpec.world.wants_to_quit = true
|
|
1908
|
+
end
|
|
1909
|
+
|
|
1862
1910
|
def handle_suite_hook(scope, meta)
|
|
1863
1911
|
return nil unless scope == :suite
|
|
1864
1912
|
|
|
@@ -1882,6 +1930,12 @@ module RSpec
|
|
|
1882
1930
|
hook.run(context)
|
|
1883
1931
|
rescue Support::AllExceptionsExceptOnesWeMustNotRescue => ex
|
|
1884
1932
|
context.set_exception(ex)
|
|
1933
|
+
|
|
1934
|
+
# Do not run subsequent `before` hooks if one fails.
|
|
1935
|
+
# But for `after` hooks, we run them all so that all
|
|
1936
|
+
# cleanup bits get a chance to complete, minimizing the
|
|
1937
|
+
# chance that resources get left behind.
|
|
1938
|
+
break if hooks.equal?(@before_suite_hooks)
|
|
1885
1939
|
end
|
|
1886
1940
|
end
|
|
1887
1941
|
end
|
|
@@ -1986,7 +2040,7 @@ module RSpec
|
|
|
1986
2040
|
end
|
|
1987
2041
|
|
|
1988
2042
|
def output_to_tty?(output=output_stream)
|
|
1989
|
-
|
|
2043
|
+
output.respond_to?(:tty?) && output.tty?
|
|
1990
2044
|
end
|
|
1991
2045
|
|
|
1992
2046
|
def conditionally_disable_mocks_monkey_patching
|
data/lib/rspec/core/drb.rb
CHANGED
|
@@ -41,6 +41,8 @@ module RSpec
|
|
|
41
41
|
def options
|
|
42
42
|
argv = []
|
|
43
43
|
argv << "--color" if @submitted_options[:color]
|
|
44
|
+
argv << "--force-color" if @submitted_options[:color_mode] == :on
|
|
45
|
+
argv << "--no-color" if @submitted_options[:color_mode] == :off
|
|
44
46
|
argv << "--profile" if @submitted_options[:profile_examples]
|
|
45
47
|
argv << "--backtrace" if @submitted_options[:full_backtrace]
|
|
46
48
|
argv << "--tty" if @submitted_options[:tty]
|
|
@@ -793,8 +793,12 @@ module RSpec
|
|
|
793
793
|
# @private
|
|
794
794
|
def self.with_frame(name, location)
|
|
795
795
|
current_stack = shared_example_group_inclusions
|
|
796
|
-
current_stack
|
|
797
|
-
|
|
796
|
+
if current_stack.any? { |frame| frame.shared_group_name == name }
|
|
797
|
+
raise ArgumentError, "can't include shared examples recursively"
|
|
798
|
+
else
|
|
799
|
+
current_stack << new(name, location)
|
|
800
|
+
yield
|
|
801
|
+
end
|
|
798
802
|
ensure
|
|
799
803
|
current_stack.pop
|
|
800
804
|
end
|
|
@@ -827,6 +831,12 @@ module RSpec
|
|
|
827
831
|
const_scope
|
|
828
832
|
end
|
|
829
833
|
|
|
834
|
+
def self.remove_all_constants
|
|
835
|
+
constants.each do |constant|
|
|
836
|
+
__send__(:remove_const, constant)
|
|
837
|
+
end
|
|
838
|
+
end
|
|
839
|
+
|
|
830
840
|
def self.base_name_for(group)
|
|
831
841
|
return "Anonymous" if group.description.empty?
|
|
832
842
|
|
|
@@ -23,9 +23,12 @@ module RSpec
|
|
|
23
23
|
module_function
|
|
24
24
|
|
|
25
25
|
# @private
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
26
|
+
def config_colors_to_methods
|
|
27
|
+
@config_colors_to_methods ||=
|
|
28
|
+
Configuration.instance_methods.grep(/_color\z/).inject({}) do |hash, method|
|
|
29
|
+
hash[method.to_s.sub(/_color\z/, '').to_sym] = method
|
|
30
|
+
hash
|
|
31
|
+
end
|
|
29
32
|
end
|
|
30
33
|
|
|
31
34
|
# Fetches the correct code for the supplied symbol, or checks
|
|
@@ -34,7 +37,7 @@ module RSpec
|
|
|
34
37
|
# @param code_or_symbol [Symbol, Fixnum] Symbol or code to check
|
|
35
38
|
# @return [Fixnum] a console code
|
|
36
39
|
def console_code_for(code_or_symbol)
|
|
37
|
-
if (config_method =
|
|
40
|
+
if (config_method = config_colors_to_methods[code_or_symbol])
|
|
38
41
|
console_code_for RSpec.configuration.__send__(config_method)
|
|
39
42
|
elsif VT100_CODE_VALUES.key?(code_or_symbol)
|
|
40
43
|
code_or_symbol
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
# encoding: utf-8
|
|
2
|
+
RSpec::Support.require_rspec_core "formatters/console_codes"
|
|
2
3
|
RSpec::Support.require_rspec_core "formatters/snippet_extractor"
|
|
3
4
|
RSpec::Support.require_rspec_support "encoded_string"
|
|
4
5
|
|
|
@@ -345,7 +346,10 @@ module RSpec
|
|
|
345
346
|
|
|
346
347
|
failure = common_backtrace_truncater.with_truncated_backtrace(failure)
|
|
347
348
|
presenter = ExceptionPresenter.new(failure, @example, options)
|
|
348
|
-
presenter.fully_formatted_lines(
|
|
349
|
+
presenter.fully_formatted_lines(
|
|
350
|
+
"#{failure_number ? "#{failure_number}." : ''}#{index + 1}",
|
|
351
|
+
colorizer
|
|
352
|
+
)
|
|
349
353
|
end
|
|
350
354
|
end
|
|
351
355
|
end
|
|
@@ -69,10 +69,12 @@ module RSpec
|
|
|
69
69
|
example = failure.example
|
|
70
70
|
|
|
71
71
|
exception = failure.exception
|
|
72
|
+
message_lines = failure.fully_formatted_lines(nil, RSpec::Core::Notifications::NullColorizer)
|
|
72
73
|
exception_details = if exception
|
|
73
74
|
{
|
|
74
|
-
|
|
75
|
-
:
|
|
75
|
+
# drop 2 removes the description (regardless of newlines) and leading blank line
|
|
76
|
+
:message => message_lines.drop(2).join("\n"),
|
|
77
|
+
:backtrace => failure.formatted_backtrace.join("\n"),
|
|
76
78
|
}
|
|
77
79
|
end
|
|
78
80
|
extra = extra_failure_content(failure)
|
|
@@ -24,6 +24,8 @@ module RSpec
|
|
|
24
24
|
@@converter = NullConverter
|
|
25
25
|
begin
|
|
26
26
|
require 'coderay'
|
|
27
|
+
RSpec::Support.require_rspec_core 'source/syntax_highlighter'
|
|
28
|
+
RSpec::Core::Source::SyntaxHighlighter.attempt_to_add_rspec_terms_to_coderay_keywords
|
|
27
29
|
@@converter = CoderayConverter
|
|
28
30
|
# rubocop:disable Lint/HandleExceptions
|
|
29
31
|
rescue LoadError
|
|
@@ -33,7 +33,7 @@ module RSpec
|
|
|
33
33
|
# This will only be invoked once, and the next one to be invoked
|
|
34
34
|
# is {#example_group_started}.
|
|
35
35
|
#
|
|
36
|
-
# @param notification [StartNotification]
|
|
36
|
+
# @param notification [Notifications::StartNotification]
|
|
37
37
|
|
|
38
38
|
# @method example_group_started
|
|
39
39
|
# @api public
|
|
@@ -45,8 +45,8 @@ module RSpec
|
|
|
45
45
|
# The next method to be invoked after this is {#example_passed},
|
|
46
46
|
# {#example_pending}, or {#example_group_finished}.
|
|
47
47
|
#
|
|
48
|
-
# @param notification [GroupNotification] containing example_group
|
|
49
|
-
# subclass of
|
|
48
|
+
# @param notification [Notifications::GroupNotification] containing example_group
|
|
49
|
+
# subclass of {ExampleGroup}
|
|
50
50
|
|
|
51
51
|
# @method example_group_finished
|
|
52
52
|
# @api public
|
|
@@ -54,8 +54,8 @@ module RSpec
|
|
|
54
54
|
#
|
|
55
55
|
# Invoked at the end of the execution of each example group.
|
|
56
56
|
#
|
|
57
|
-
# @param notification [GroupNotification] containing example_group
|
|
58
|
-
# subclass of
|
|
57
|
+
# @param notification [Notifications::GroupNotification] containing example_group
|
|
58
|
+
# subclass of {ExampleGroup}
|
|
59
59
|
|
|
60
60
|
# @method example_started
|
|
61
61
|
# @api public
|
|
@@ -63,8 +63,8 @@ module RSpec
|
|
|
63
63
|
#
|
|
64
64
|
# Invoked at the beginning of the execution of each example.
|
|
65
65
|
#
|
|
66
|
-
# @param notification [ExampleNotification] containing example subclass
|
|
67
|
-
# of
|
|
66
|
+
# @param notification [Notifications::ExampleNotification] containing example subclass
|
|
67
|
+
# of {Example}
|
|
68
68
|
|
|
69
69
|
# @method example_finished
|
|
70
70
|
# @api public
|
|
@@ -72,8 +72,8 @@ module RSpec
|
|
|
72
72
|
#
|
|
73
73
|
# Invoked at the end of the execution of each example.
|
|
74
74
|
#
|
|
75
|
-
# @param notification [ExampleNotification] containing example subclass
|
|
76
|
-
# of
|
|
75
|
+
# @param notification [Notifications::ExampleNotification] containing example subclass
|
|
76
|
+
# of {Example}
|
|
77
77
|
|
|
78
78
|
# @method example_passed
|
|
79
79
|
# @api public
|
|
@@ -81,8 +81,8 @@ module RSpec
|
|
|
81
81
|
#
|
|
82
82
|
# Invoked when an example passes.
|
|
83
83
|
#
|
|
84
|
-
# @param notification [ExampleNotification] containing example subclass
|
|
85
|
-
# of
|
|
84
|
+
# @param notification [Notifications::ExampleNotification] containing example subclass
|
|
85
|
+
# of {Example}
|
|
86
86
|
|
|
87
87
|
# @method example_pending
|
|
88
88
|
# @api public
|
|
@@ -90,8 +90,8 @@ module RSpec
|
|
|
90
90
|
#
|
|
91
91
|
# Invoked when an example is pending.
|
|
92
92
|
#
|
|
93
|
-
# @param notification [ExampleNotification] containing example subclass
|
|
94
|
-
# of
|
|
93
|
+
# @param notification [Notifications::ExampleNotification] containing example subclass
|
|
94
|
+
# of {Example}
|
|
95
95
|
|
|
96
96
|
# @method example_failed
|
|
97
97
|
# @api public
|
|
@@ -99,8 +99,8 @@ module RSpec
|
|
|
99
99
|
#
|
|
100
100
|
# Invoked when an example fails.
|
|
101
101
|
#
|
|
102
|
-
# @param notification [ExampleNotification] containing example subclass
|
|
103
|
-
# of
|
|
102
|
+
# @param notification [Notifications::ExampleNotification] containing example subclass
|
|
103
|
+
# of {Example}
|
|
104
104
|
|
|
105
105
|
# @method message
|
|
106
106
|
# @api public
|
|
@@ -108,7 +108,7 @@ module RSpec
|
|
|
108
108
|
#
|
|
109
109
|
# Used by the reporter to send messages to the output stream.
|
|
110
110
|
#
|
|
111
|
-
# @param notification [MessageNotification] containing message
|
|
111
|
+
# @param notification [Notifications::MessageNotification] containing message
|
|
112
112
|
|
|
113
113
|
# @method stop
|
|
114
114
|
# @api public
|
|
@@ -117,7 +117,7 @@ module RSpec
|
|
|
117
117
|
# Invoked after all examples have executed, before dumping post-run
|
|
118
118
|
# reports.
|
|
119
119
|
#
|
|
120
|
-
# @param notification [NullNotification]
|
|
120
|
+
# @param notification [Notifications::NullNotification]
|
|
121
121
|
|
|
122
122
|
# @method start_dump
|
|
123
123
|
# @api public
|
|
@@ -128,7 +128,7 @@ module RSpec
|
|
|
128
128
|
# (BaseTextFormatter then calls {#dump_failures} once for each failed
|
|
129
129
|
# example).
|
|
130
130
|
#
|
|
131
|
-
# @param notification [NullNotification]
|
|
131
|
+
# @param notification [Notifications::NullNotification]
|
|
132
132
|
|
|
133
133
|
# @method dump_failures
|
|
134
134
|
# @api public
|
|
@@ -136,7 +136,7 @@ module RSpec
|
|
|
136
136
|
#
|
|
137
137
|
# Dumps detailed information about each example failure.
|
|
138
138
|
#
|
|
139
|
-
# @param notification [NullNotification]
|
|
139
|
+
# @param notification [Notifications::NullNotification]
|
|
140
140
|
|
|
141
141
|
# @method dump_summary
|
|
142
142
|
# @api public
|
|
@@ -145,7 +145,7 @@ module RSpec
|
|
|
145
145
|
# This method is invoked after the dumping of examples and failures.
|
|
146
146
|
# Each parameter is assigned to a corresponding attribute.
|
|
147
147
|
#
|
|
148
|
-
# @param summary [SummaryNotification] containing duration,
|
|
148
|
+
# @param summary [Notifications::SummaryNotification] containing duration,
|
|
149
149
|
# example_count, failure_count and pending_count
|
|
150
150
|
|
|
151
151
|
# @method dump_profile
|
|
@@ -155,7 +155,7 @@ module RSpec
|
|
|
155
155
|
# This method is invoked after the dumping the summary if profiling is
|
|
156
156
|
# enabled.
|
|
157
157
|
#
|
|
158
|
-
# @param profile [ProfileNotification] containing duration,
|
|
158
|
+
# @param profile [Notifications::ProfileNotification] containing duration,
|
|
159
159
|
# slowest_examples and slowest_example_groups
|
|
160
160
|
|
|
161
161
|
# @method dump_pending
|
|
@@ -165,7 +165,7 @@ module RSpec
|
|
|
165
165
|
# Outputs a report of pending examples. This gets invoked
|
|
166
166
|
# after the summary if option is set to do so.
|
|
167
167
|
#
|
|
168
|
-
# @param notification [NullNotification]
|
|
168
|
+
# @param notification [Notifications::NullNotification]
|
|
169
169
|
|
|
170
170
|
# @method close
|
|
171
171
|
# @api public
|
|
@@ -174,7 +174,7 @@ module RSpec
|
|
|
174
174
|
# Invoked at the very end, `close` allows the formatter to clean
|
|
175
175
|
# up resources, e.g. open streams, etc.
|
|
176
176
|
#
|
|
177
|
-
# @param notification [NullNotification]
|
|
177
|
+
# @param notification [Notifications::NullNotification]
|
|
178
178
|
end
|
|
179
179
|
end
|
|
180
180
|
end
|
|
@@ -24,7 +24,7 @@ RSpec::Support.require_rspec_support "directory_maker"
|
|
|
24
24
|
# ## Custom Formatters
|
|
25
25
|
#
|
|
26
26
|
# You can tell RSpec to use a custom formatter by passing its path and name to
|
|
27
|
-
# the `rspec`
|
|
27
|
+
# the `rspec` command. For example, if you define MyCustomFormatter in
|
|
28
28
|
# path/to/my_custom_formatter.rb, you would type this command:
|
|
29
29
|
#
|
|
30
30
|
# rspec --require path/to/my_custom_formatter.rb --format MyCustomFormatter
|
|
@@ -49,16 +49,34 @@ module RSpec
|
|
|
49
49
|
# @private
|
|
50
50
|
class PrintVersion
|
|
51
51
|
def call(_options, _err, out)
|
|
52
|
-
|
|
52
|
+
overall_version = RSpec::Core::Version::STRING
|
|
53
|
+
unless overall_version =~ /[a-zA-Z]+/
|
|
54
|
+
overall_version = overall_version.split('.').first(2).join('.')
|
|
55
|
+
end
|
|
56
|
+
|
|
57
|
+
out.puts "RSpec #{overall_version}"
|
|
58
|
+
|
|
59
|
+
[:Core, :Expectations, :Mocks, :Rails, :Support].each do |const_name|
|
|
60
|
+
lib_name = const_name.to_s.downcase
|
|
61
|
+
begin
|
|
62
|
+
require "rspec/#{lib_name}/version"
|
|
63
|
+
rescue LoadError
|
|
64
|
+
# Not worth mentioning libs that are not installed
|
|
65
|
+
nil
|
|
66
|
+
else
|
|
67
|
+
out.puts " - rspec-#{lib_name} #{RSpec.const_get(const_name)::Version::STRING}"
|
|
68
|
+
end
|
|
69
|
+
end
|
|
70
|
+
|
|
53
71
|
0
|
|
54
72
|
end
|
|
55
73
|
end
|
|
56
74
|
|
|
57
75
|
# @private
|
|
58
|
-
PrintHelp = Struct.new(:parser, :
|
|
76
|
+
PrintHelp = Struct.new(:parser, :hidden_options) do
|
|
59
77
|
def call(_options, _err, out)
|
|
60
|
-
# Removing the
|
|
61
|
-
out.puts parser.to_s.gsub(/^\s+(#{
|
|
78
|
+
# Removing the hidden options from the output.
|
|
79
|
+
out.puts parser.to_s.gsub(/^\s+(#{hidden_options.join('|')})\b.*$\n/, '')
|
|
62
80
|
0
|
|
63
81
|
end
|
|
64
82
|
end
|
|
@@ -13,24 +13,19 @@ module RSpec
|
|
|
13
13
|
end
|
|
14
14
|
|
|
15
15
|
# @private
|
|
16
|
-
def filter_applies?(key,
|
|
16
|
+
def filter_applies?(key, filter_value, metadata)
|
|
17
17
|
silence_metadata_example_group_deprecations do
|
|
18
|
-
return location_filter_applies?(
|
|
19
|
-
return id_filter_applies?(
|
|
20
|
-
return filters_apply?(key,
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
return
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
when Proc
|
|
30
|
-
proc_filter_applies?(key, value, metadata)
|
|
31
|
-
else
|
|
32
|
-
metadata[key].to_s == value.to_s
|
|
33
|
-
end
|
|
18
|
+
return location_filter_applies?(filter_value, metadata) if key == :locations
|
|
19
|
+
return id_filter_applies?(filter_value, metadata) if key == :ids
|
|
20
|
+
return filters_apply?(key, filter_value, metadata) if Hash === filter_value
|
|
21
|
+
|
|
22
|
+
meta_value = metadata.fetch(key) { return false }
|
|
23
|
+
|
|
24
|
+
return true if TrueClass === filter_value && meta_value
|
|
25
|
+
return proc_filter_applies?(key, filter_value, metadata) if Proc === filter_value
|
|
26
|
+
return filter_applies_to_any_value?(key, filter_value, metadata) if Array === meta_value
|
|
27
|
+
|
|
28
|
+
filter_value === meta_value || filter_value.to_s == meta_value.to_s
|
|
34
29
|
end
|
|
35
30
|
end
|
|
36
31
|
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
RSpec::Support.require_rspec_core "formatters/console_codes"
|
|
1
2
|
RSpec::Support.require_rspec_core "formatters/exception_presenter"
|
|
2
3
|
RSpec::Support.require_rspec_core "formatters/helpers"
|
|
3
4
|
RSpec::Support.require_rspec_core "shell_escape"
|
|
@@ -199,6 +200,12 @@ module RSpec::Core
|
|
|
199
200
|
@exception_presenter.fully_formatted(failure_number, colorizer)
|
|
200
201
|
end
|
|
201
202
|
|
|
203
|
+
# @return [Array<string>] The failure information fully formatted in the way that
|
|
204
|
+
# RSpec's built-in formatters emit, split by line.
|
|
205
|
+
def fully_formatted_lines(failure_number, colorizer=::RSpec::Core::Formatters::ConsoleCodes)
|
|
206
|
+
@exception_presenter.fully_formatted_lines(failure_number, colorizer)
|
|
207
|
+
end
|
|
208
|
+
|
|
202
209
|
private
|
|
203
210
|
|
|
204
211
|
def initialize(example, exception_presenter=Formatters::ExceptionPresenter::Factory.new(example).build)
|
|
@@ -280,8 +287,12 @@ module RSpec::Core
|
|
|
280
287
|
# @attr pending_examples [Array<RSpec::Core::Example>] the pending examples
|
|
281
288
|
# @attr load_time [Float] the number of seconds taken to boot RSpec
|
|
282
289
|
# and load the spec files
|
|
290
|
+
# @attr errors_outside_of_examples_count [Integer] the number of errors that
|
|
291
|
+
# have occurred processing
|
|
292
|
+
# the spec suite
|
|
283
293
|
SummaryNotification = Struct.new(:duration, :examples, :failed_examples,
|
|
284
|
-
:pending_examples, :load_time
|
|
294
|
+
:pending_examples, :load_time,
|
|
295
|
+
:errors_outside_of_examples_count)
|
|
285
296
|
class SummaryNotification
|
|
286
297
|
# @api
|
|
287
298
|
# @return [Fixnum] the number of examples run
|
|
@@ -307,6 +318,11 @@ module RSpec::Core
|
|
|
307
318
|
summary = Formatters::Helpers.pluralize(example_count, "example")
|
|
308
319
|
summary << ", " << Formatters::Helpers.pluralize(failure_count, "failure")
|
|
309
320
|
summary << ", #{pending_count} pending" if pending_count > 0
|
|
321
|
+
if errors_outside_of_examples_count > 0
|
|
322
|
+
summary << ", "
|
|
323
|
+
summary << Formatters::Helpers.pluralize(errors_outside_of_examples_count, "error")
|
|
324
|
+
summary << " occurred outside of examples"
|
|
325
|
+
end
|
|
310
326
|
summary
|
|
311
327
|
end
|
|
312
328
|
|
|
@@ -39,6 +39,8 @@ module RSpec::Core
|
|
|
39
39
|
# rubocop:disable PerceivedComplexity
|
|
40
40
|
def parser(options)
|
|
41
41
|
OptionParser.new do |parser|
|
|
42
|
+
parser.summary_width = 34
|
|
43
|
+
|
|
42
44
|
parser.banner = "Usage: rspec [options] [files or directories]\n\n"
|
|
43
45
|
|
|
44
46
|
parser.on('-I PATH', 'Specify PATH to add to $LOAD_PATH (may be used more than once).') do |dirs|
|
|
@@ -93,11 +95,6 @@ module RSpec::Core
|
|
|
93
95
|
options[:failure_exit_code] = code
|
|
94
96
|
end
|
|
95
97
|
|
|
96
|
-
parser.on('--dry-run', 'Print the formatter output of your suite without',
|
|
97
|
-
' running any examples or hooks') do |_o|
|
|
98
|
-
options[:dry_run] = true
|
|
99
|
-
end
|
|
100
|
-
|
|
101
98
|
parser.on('-X', '--[no-]drb', 'Run examples via DRb.') do |use_drb|
|
|
102
99
|
options[:drb] = use_drb
|
|
103
100
|
options[:runner] = RSpec::Core::Invocations::DRbWithFallback.new if use_drb
|
|
@@ -107,10 +104,6 @@ module RSpec::Core
|
|
|
107
104
|
options[:drb_port] = o.to_i
|
|
108
105
|
end
|
|
109
106
|
|
|
110
|
-
parser.on('--init', 'Initialize your project with RSpec.') do |_cmd|
|
|
111
|
-
options[:runner] = RSpec::Core::Invocations::InitializeProject.new
|
|
112
|
-
end
|
|
113
|
-
|
|
114
107
|
parser.separator("\n **** Output ****\n\n")
|
|
115
108
|
|
|
116
109
|
parser.on('-f', '--format FORMATTER', 'Choose a formatter.',
|
|
@@ -140,8 +133,24 @@ module RSpec::Core
|
|
|
140
133
|
options[:full_backtrace] = true
|
|
141
134
|
end
|
|
142
135
|
|
|
143
|
-
parser.on('-c', '--
|
|
144
|
-
|
|
136
|
+
parser.on('-c', '--color', '--colour', '') do |_o|
|
|
137
|
+
# flag will be excluded from `--help` output because it is deprecated
|
|
138
|
+
options[:color] = true
|
|
139
|
+
options[:color_mode] = :automatic
|
|
140
|
+
end
|
|
141
|
+
|
|
142
|
+
parser.on('--force-color', '--force-colour', 'Force the output to be in color, even if the output is not a TTY') do |_o|
|
|
143
|
+
if options[:color_mode] == :off
|
|
144
|
+
abort "Please only use one of `--force-color` and `--no-color`"
|
|
145
|
+
end
|
|
146
|
+
options[:color_mode] = :on
|
|
147
|
+
end
|
|
148
|
+
|
|
149
|
+
parser.on('--no-color', '--no-colour', 'Force the output to not be in color, even if the output is a TTY') do |_o|
|
|
150
|
+
if options[:color_mode] == :on
|
|
151
|
+
abort "Please only use one of --force-color and --no-color"
|
|
152
|
+
end
|
|
153
|
+
options[:color_mode] = :off
|
|
145
154
|
end
|
|
146
155
|
|
|
147
156
|
parser.on('-p', '--[no-]profile [COUNT]',
|
|
@@ -163,6 +172,11 @@ module RSpec::Core
|
|
|
163
172
|
end
|
|
164
173
|
end
|
|
165
174
|
|
|
175
|
+
parser.on('--dry-run', 'Print the formatter output of your suite without',
|
|
176
|
+
' running any examples or hooks') do |_o|
|
|
177
|
+
options[:dry_run] = true
|
|
178
|
+
end
|
|
179
|
+
|
|
166
180
|
parser.on('-w', '--warnings', 'Enable ruby warnings') do
|
|
167
181
|
$VERBOSE = true
|
|
168
182
|
end
|
|
@@ -244,6 +258,10 @@ FILTERING
|
|
|
244
258
|
|
|
245
259
|
parser.separator("\n **** Utility ****\n\n")
|
|
246
260
|
|
|
261
|
+
parser.on('--init', 'Initialize your project with RSpec.') do |_cmd|
|
|
262
|
+
options[:runner] = RSpec::Core::Invocations::InitializeProject.new
|
|
263
|
+
end
|
|
264
|
+
|
|
247
265
|
parser.on('-v', '--version', 'Display the version.') do
|
|
248
266
|
options[:runner] = RSpec::Core::Invocations::PrintVersion.new
|
|
249
267
|
end
|
|
@@ -256,8 +274,10 @@ FILTERING
|
|
|
256
274
|
# trigger --default-path.
|
|
257
275
|
invalid_options = %w[-d --I]
|
|
258
276
|
|
|
277
|
+
hidden_options = invalid_options + %w[-c]
|
|
278
|
+
|
|
259
279
|
parser.on_tail('-h', '--help', "You're looking at it.") do
|
|
260
|
-
options[:runner] = RSpec::Core::Invocations::PrintHelp.new(parser,
|
|
280
|
+
options[:runner] = RSpec::Core::Invocations::PrintHelp.new(parser, hidden_options)
|
|
261
281
|
end
|
|
262
282
|
|
|
263
283
|
# This prevents usage of the invalid_options.
|
|
@@ -80,7 +80,7 @@ RSpec.configure do |config|
|
|
|
80
80
|
# Use the documentation formatter for detailed output,
|
|
81
81
|
# unless a formatter has already been configured
|
|
82
82
|
# (e.g. via a command-line flag).
|
|
83
|
-
config.default_formatter =
|
|
83
|
+
config.default_formatter = "doc"
|
|
84
84
|
end
|
|
85
85
|
|
|
86
86
|
# Print the 10 slowest examples and example groups at the
|
data/lib/rspec/core/reporter.rb
CHANGED
|
@@ -18,6 +18,7 @@ module RSpec::Core
|
|
|
18
18
|
@failed_examples = []
|
|
19
19
|
@pending_examples = []
|
|
20
20
|
@duration = @start = @load_time = nil
|
|
21
|
+
@non_example_exception_count = 0
|
|
21
22
|
end
|
|
22
23
|
|
|
23
24
|
# @private
|
|
@@ -153,10 +154,11 @@ module RSpec::Core
|
|
|
153
154
|
|
|
154
155
|
# @private
|
|
155
156
|
# Provides a way to notify of an exception that is not tied to any
|
|
156
|
-
# particular
|
|
157
|
+
# particular example (such as an exception encountered in a :suite hook).
|
|
157
158
|
# Exceptions will be formatted the same way they normally are.
|
|
158
159
|
def notify_non_example_exception(exception, context_description)
|
|
159
160
|
@configuration.world.non_example_failure = true
|
|
161
|
+
@non_example_exception_count += 1
|
|
160
162
|
|
|
161
163
|
example = Example.new(AnonymousExampleGroup, context_description, {})
|
|
162
164
|
presenter = Formatters::ExceptionPresenter.new(exception, example, :indentation => 0)
|
|
@@ -177,7 +179,8 @@ module RSpec::Core
|
|
|
177
179
|
@profiler.example_groups)
|
|
178
180
|
end
|
|
179
181
|
notify :dump_summary, Notifications::SummaryNotification.new(@duration, @examples, @failed_examples,
|
|
180
|
-
@pending_examples, @load_time
|
|
182
|
+
@pending_examples, @load_time,
|
|
183
|
+
@non_example_exception_count)
|
|
181
184
|
notify :seed, Notifications::SeedNotification.new(@configuration.seed, seed_used?)
|
|
182
185
|
end
|
|
183
186
|
end
|
data/lib/rspec/core/runner.rb
CHANGED
|
@@ -108,8 +108,13 @@ module RSpec
|
|
|
108
108
|
# or the configured failure exit code (1 by default) if specs
|
|
109
109
|
# failed.
|
|
110
110
|
def run_specs(example_groups)
|
|
111
|
-
|
|
111
|
+
examples_count = @world.example_count(example_groups)
|
|
112
|
+
success = @configuration.reporter.report(examples_count) do |reporter|
|
|
112
113
|
@configuration.with_suite_hooks do
|
|
114
|
+
if examples_count == 0 && @configuration.fail_if_no_examples
|
|
115
|
+
return @configuration.failure_exit_code
|
|
116
|
+
end
|
|
117
|
+
|
|
113
118
|
example_groups.map { |g| g.run(reporter) }.all?
|
|
114
119
|
end
|
|
115
120
|
end && !@world.non_example_failure
|
|
@@ -153,6 +153,12 @@ module RSpec
|
|
|
153
153
|
# @private
|
|
154
154
|
class Registry
|
|
155
155
|
def add(context, name, *metadata_args, &block)
|
|
156
|
+
unless block
|
|
157
|
+
RSpec.warning "Shared example group #{name} was defined without a "\
|
|
158
|
+
"block and will have no effect. Please define a "\
|
|
159
|
+
"block or remove the definition."
|
|
160
|
+
end
|
|
161
|
+
|
|
156
162
|
if RSpec.configuration.shared_context_metadata_behavior == :trigger_inclusion
|
|
157
163
|
return legacy_add(context, name, *metadata_args, &block)
|
|
158
164
|
end
|
|
@@ -213,20 +219,43 @@ module RSpec
|
|
|
213
219
|
|
|
214
220
|
def warn_if_key_taken(context, key, new_block)
|
|
215
221
|
existing_module = shared_example_groups[context][key]
|
|
216
|
-
|
|
217
222
|
return unless existing_module
|
|
218
223
|
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
224
|
+
old_definition_location = formatted_location existing_module.definition
|
|
225
|
+
new_definition_location = formatted_location new_block
|
|
226
|
+
loaded_spec_files = RSpec.configuration.loaded_spec_files
|
|
227
|
+
|
|
228
|
+
if loaded_spec_files.include?(new_definition_location) && old_definition_location == new_definition_location
|
|
229
|
+
RSpec.warn_with <<-WARNING.gsub(/^ +\|/, ''), :call_site => nil
|
|
230
|
+
|WARNING: Your shared example group, '#{key}', defined at:
|
|
231
|
+
| #{old_definition_location}
|
|
232
|
+
|was automatically loaded by RSpec because the file name
|
|
233
|
+
|matches the configured autoloading pattern (#{RSpec.configuration.pattern}),
|
|
234
|
+
|and is also being required from somewhere else. To fix this
|
|
235
|
+
|warning, either rename the file to not match the pattern, or
|
|
236
|
+
|do not explicitly require the file.
|
|
237
|
+
WARNING
|
|
238
|
+
else
|
|
239
|
+
RSpec.warn_with <<-WARNING.gsub(/^ +\|/, ''), :call_site => nil
|
|
240
|
+
|WARNING: Shared example group '#{key}' has been previously defined at:
|
|
241
|
+
| #{old_definition_location}
|
|
242
|
+
|...and you are now defining it at:
|
|
243
|
+
| #{new_definition_location}
|
|
244
|
+
|The new definition will overwrite the original one.
|
|
245
|
+
WARNING
|
|
246
|
+
end
|
|
226
247
|
end
|
|
227
248
|
|
|
228
|
-
|
|
229
|
-
block
|
|
249
|
+
if RUBY_VERSION.to_f >= 1.9
|
|
250
|
+
def formatted_location(block)
|
|
251
|
+
block.source_location.join(":")
|
|
252
|
+
end
|
|
253
|
+
else # 1.8.7
|
|
254
|
+
# :nocov:
|
|
255
|
+
def formatted_location(block)
|
|
256
|
+
block.source_location.join(":").gsub(/:in.*$/, '')
|
|
257
|
+
end
|
|
258
|
+
# :nocov:
|
|
230
259
|
end
|
|
231
260
|
|
|
232
261
|
if Proc.method_defined?(:source_location)
|
|
@@ -31,12 +31,32 @@ module RSpec
|
|
|
31
31
|
def color_enabled_implementation
|
|
32
32
|
@color_enabled_implementation ||= begin
|
|
33
33
|
require 'coderay'
|
|
34
|
+
self.class.attempt_to_add_rspec_terms_to_coderay_keywords
|
|
34
35
|
CodeRayImplementation
|
|
35
36
|
rescue LoadError
|
|
36
37
|
NoSyntaxHighlightingImplementation
|
|
37
38
|
end
|
|
38
39
|
end
|
|
39
40
|
|
|
41
|
+
# rubocop:disable Lint/RescueException
|
|
42
|
+
# rubocop:disable Lint/HandleExceptions
|
|
43
|
+
def self.attempt_to_add_rspec_terms_to_coderay_keywords
|
|
44
|
+
CodeRay::Scanners::Ruby::Patterns::IDENT_KIND.add(%w[
|
|
45
|
+
describe context
|
|
46
|
+
it specify
|
|
47
|
+
before after around
|
|
48
|
+
let subject
|
|
49
|
+
expect allow
|
|
50
|
+
], :keyword)
|
|
51
|
+
rescue Exception
|
|
52
|
+
# Mutating CodeRay's contants like this is not a public API
|
|
53
|
+
# and might not always work. If we cannot add our keywords
|
|
54
|
+
# to CodeRay it is not a big deal and not worth raising an
|
|
55
|
+
# error over, so we ignore it.
|
|
56
|
+
end
|
|
57
|
+
# rubocop:enable Lint/HandleExceptions
|
|
58
|
+
# rubocop:enable Lint/RescueException
|
|
59
|
+
|
|
40
60
|
# @private
|
|
41
61
|
module CodeRayImplementation
|
|
42
62
|
RESET_CODE = "\e[0m"
|
data/lib/rspec/core/version.rb
CHANGED
data/lib/rspec/core/world.rb
CHANGED
data/lib/rspec/core.rb
CHANGED
|
@@ -56,6 +56,7 @@ module RSpec
|
|
|
56
56
|
# they use the runner multiple times within the same process. Users must deal
|
|
57
57
|
# themselves with re-configuration of RSpec before run.
|
|
58
58
|
def self.reset
|
|
59
|
+
RSpec::ExampleGroups.remove_all_constants
|
|
59
60
|
@world = nil
|
|
60
61
|
@configuration = nil
|
|
61
62
|
end
|
data.tar.gz.sig
CHANGED
|
Binary file
|
metadata
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: rspec-core
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 3.
|
|
4
|
+
version: 3.6.0.beta2
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Steven Baker
|
|
@@ -46,22 +46,22 @@ cert_chain:
|
|
|
46
46
|
ZsVDj6a7lH3cNqtWXZxrb2wO38qV5AkYj8SQK7Hj3/Yui9myUX3crr+PdetazSqQ
|
|
47
47
|
F3MdtaDehhjC
|
|
48
48
|
-----END CERTIFICATE-----
|
|
49
|
-
date: 2016-
|
|
49
|
+
date: 2016-12-12 00:00:00.000000000 Z
|
|
50
50
|
dependencies:
|
|
51
51
|
- !ruby/object:Gem::Dependency
|
|
52
52
|
name: rspec-support
|
|
53
53
|
requirement: !ruby/object:Gem::Requirement
|
|
54
54
|
requirements:
|
|
55
|
-
- -
|
|
55
|
+
- - '='
|
|
56
56
|
- !ruby/object:Gem::Version
|
|
57
|
-
version: 3.
|
|
57
|
+
version: 3.6.0.beta2
|
|
58
58
|
type: :runtime
|
|
59
59
|
prerelease: false
|
|
60
60
|
version_requirements: !ruby/object:Gem::Requirement
|
|
61
61
|
requirements:
|
|
62
|
-
- -
|
|
62
|
+
- - '='
|
|
63
63
|
- !ruby/object:Gem::Version
|
|
64
|
-
version: 3.
|
|
64
|
+
version: 3.6.0.beta2
|
|
65
65
|
- !ruby/object:Gem::Dependency
|
|
66
66
|
name: cucumber
|
|
67
67
|
requirement: !ruby/object:Gem::Requirement
|
|
@@ -275,14 +275,14 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
|
275
275
|
version: 1.8.7
|
|
276
276
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
|
277
277
|
requirements:
|
|
278
|
-
- - "
|
|
278
|
+
- - ">"
|
|
279
279
|
- !ruby/object:Gem::Version
|
|
280
|
-
version:
|
|
280
|
+
version: 1.3.1
|
|
281
281
|
requirements: []
|
|
282
282
|
rubyforge_project:
|
|
283
|
-
rubygems_version: 2.
|
|
283
|
+
rubygems_version: 2.5.1
|
|
284
284
|
signing_key:
|
|
285
285
|
specification_version: 4
|
|
286
|
-
summary: rspec-core-3.
|
|
286
|
+
summary: rspec-core-3.6.0.beta2
|
|
287
287
|
test_files: []
|
|
288
288
|
has_rdoc:
|
metadata.gz.sig
CHANGED
|
Binary file
|