rspec-core 3.4.4 → 3.5.0.beta1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- checksums.yaml.gz.sig +4 -5
- data.tar.gz.sig +0 -0
- data/Changelog.md +3 -22
- data/lib/rspec/core/example.rb +1 -1
- data/lib/rspec/core/example_group.rb +19 -5
- data/lib/rspec/core/formatters/exception_presenter.rb +2 -0
- data/lib/rspec/core/formatters/snippet_extractor.rb +14 -7
- data/lib/rspec/core/metadata.rb +0 -5
- data/lib/rspec/core/metadata_filter.rb +19 -10
- data/lib/rspec/core/option_parser.rb +1 -1
- data/lib/rspec/core/rake_task.rb +2 -2
- data/lib/rspec/core/runner.rb +1 -1
- data/lib/rspec/core/source/token.rb +0 -43
- data/lib/rspec/core/version.rb +1 -1
- data/lib/rspec/core/world.rb +5 -21
- metadata +11 -11
- 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: 764d595de1ccd035e52340a849aa668815e8dae7
|
4
|
+
data.tar.gz: f7e933e063ee39c7813b9a9618f19b74174ab569
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: e18131d908d6c1ab5329e13005261cc07aaabade69dfd9ccb09078ec6c2f7efb43231f229168b9eab2ea2ccdde573c55f42cf7beca42e9e2f8cf107e58873944
|
7
|
+
data.tar.gz: 8e38f681409c92781111082573df67e2e138670f1e063a24088eb92102943818eef279e33bef02cac8c38aa73d9228a105f4bcfd39963409ddf51e90ccb4af91
|
checksums.yaml.gz.sig
CHANGED
@@ -1,5 +1,4 @@
|
|
1
|
-
|
2
|
-
e
|
3
|
-
|
4
|
-
|
5
|
-
@�,��[+}���U~���G�mN)I�C��Hl��l�4�M֬Z�{�Q�+j�����f��:�I+§89��E��ǀ�H��!�>�A�͝2ց+�G5���0��-��C�b��~��
|
1
|
+
__�m�^�=ĽYi��¦���i�8����E�F/���Ұ">�獈-�7�o�kac�8<�Ȁ�\�ni�Nhr�8̤�*F��I���=
|
2
|
+
�R_Il��Mb*�63Ou�@~.)�D�Ynv_��,nzV��e�}k�m�[����D���ɫ<��!�G��[���d|:3.��G�e����>�
|
3
|
+
�u<u8x��j��;�� O8������ �h�H��R�t��#�U� #�|�'~Q�G^c-gS�� iR;�'��D8Q�8����t{�d��g+�<���A�V��?�V
|
4
|
+
����?Gh]vX�間��E���$�8��ņ�C���̍z��<�X��P����vTlI��]��VV��M49^�ĝ��;�c�]��?�}��u��tV���L+{��T���^潏�Bķ��Ľv�)7;II,��Z�ɤ�3�A��
|
data.tar.gz.sig
CHANGED
Binary file
|
data/Changelog.md
CHANGED
@@ -1,27 +1,8 @@
|
|
1
1
|
### Development
|
2
|
-
[Full Changelog](http://github.com/rspec/rspec-core/compare/v3.
|
2
|
+
[Full Changelog](http://github.com/rspec/rspec-core/compare/v3.5.0.beta1...master)
|
3
3
|
|
4
|
-
### 3.
|
5
|
-
[Full Changelog](http://github.com/rspec/rspec-core/compare/v3.4.
|
6
|
-
|
7
|
-
Bug Fixes:
|
8
|
-
|
9
|
-
* Fix `RSpec::Core::RakeTask` so that it works with Rake 11.
|
10
|
-
(Travis Grathwell, #2197)
|
11
|
-
|
12
|
-
### 3.4.3 / 2016-02-19
|
13
|
-
[Full Changelog](http://github.com/rspec/rspec-core/compare/v3.4.2...3.4.3)
|
14
|
-
|
15
|
-
Bug Fixes:
|
16
|
-
|
17
|
-
* Prevent a `TypeError` from occuring when running via the rake task when
|
18
|
-
Ruby crashes. (Patrik Wenger, #2161)
|
19
|
-
* Only consider example and group declaration lines from a specific file
|
20
|
-
when applying line number filtering, instead of considering all
|
21
|
-
declaration lines from all spec files. (Myron Marston, #2170)
|
22
|
-
* Fix failure snippet extraction so that snippets that contain `do-end` style
|
23
|
-
block and end with `end`-only line can be extracted properly.
|
24
|
-
(Yuji Nakayama, #2173)
|
4
|
+
### 3.5.0.beta1 / 2016-02-06
|
5
|
+
[Full Changelog](http://github.com/rspec/rspec-core/compare/v3.4.2...v3.5.0.beta1)
|
25
6
|
|
26
7
|
### 3.4.2 / 2016-01-26
|
27
8
|
[Full Changelog](http://github.com/rspec/rspec-core/compare/v3.4.1...v3.4.2)
|
data/lib/rspec/core/example.rb
CHANGED
@@ -9,7 +9,7 @@ module RSpec
|
|
9
9
|
#
|
10
10
|
# This allows us to provide rich metadata about each individual
|
11
11
|
# example without adding tons of methods directly to the ExampleGroup
|
12
|
-
# that users may
|
12
|
+
# that users may inadvertently redefine.
|
13
13
|
#
|
14
14
|
# Useful for configuring logging and/or taking some action based
|
15
15
|
# on the state of an example's metadata.
|
@@ -347,7 +347,7 @@ module RSpec
|
|
347
347
|
@descendant_filtered_examples = nil
|
348
348
|
@_descendants = nil
|
349
349
|
@parent_groups = nil
|
350
|
-
@
|
350
|
+
@declaration_line_numbers = nil
|
351
351
|
end
|
352
352
|
|
353
353
|
# Adds an example to the example group
|
@@ -414,6 +414,8 @@ module RSpec
|
|
414
414
|
)
|
415
415
|
ExampleGroups.assign_const(self)
|
416
416
|
|
417
|
+
@currently_executing_a_context_hook = false
|
418
|
+
|
417
419
|
hooks.register_globals(self, RSpec.configuration.hooks)
|
418
420
|
RSpec.configuration.configure_group(self)
|
419
421
|
end
|
@@ -486,15 +488,24 @@ module RSpec
|
|
486
488
|
end
|
487
489
|
end
|
488
490
|
|
491
|
+
# Returns true if a `before(:context)` or `after(:context)`
|
492
|
+
# hook is currently executing.
|
493
|
+
def self.currently_executing_a_context_hook?
|
494
|
+
@currently_executing_a_context_hook
|
495
|
+
end
|
496
|
+
|
489
497
|
# @private
|
490
498
|
def self.run_before_context_hooks(example_group_instance)
|
491
499
|
set_ivars(example_group_instance, superclass_before_context_ivars)
|
492
500
|
|
501
|
+
@currently_executing_a_context_hook = true
|
502
|
+
|
493
503
|
ContextHookMemoized::Before.isolate_for_context_hook(example_group_instance) do
|
494
504
|
hooks.run(:before, :context, example_group_instance)
|
495
505
|
end
|
496
506
|
ensure
|
497
507
|
store_before_context_ivars(example_group_instance)
|
508
|
+
@currently_executing_a_context_hook = false
|
498
509
|
end
|
499
510
|
|
500
511
|
if RUBY_VERSION.to_f >= 1.9
|
@@ -525,11 +536,14 @@ module RSpec
|
|
525
536
|
def self.run_after_context_hooks(example_group_instance)
|
526
537
|
set_ivars(example_group_instance, before_context_ivars)
|
527
538
|
|
539
|
+
@currently_executing_a_context_hook = true
|
540
|
+
|
528
541
|
ContextHookMemoized::After.isolate_for_context_hook(example_group_instance) do
|
529
542
|
hooks.run(:after, :context, example_group_instance)
|
530
543
|
end
|
531
544
|
ensure
|
532
545
|
before_context_ivars.clear
|
546
|
+
@currently_executing_a_context_hook = false
|
533
547
|
end
|
534
548
|
|
535
549
|
# Runs all the examples in this group.
|
@@ -599,10 +613,10 @@ module RSpec
|
|
599
613
|
end
|
600
614
|
|
601
615
|
# @private
|
602
|
-
def self.
|
603
|
-
@
|
604
|
-
examples.map { |e|
|
605
|
-
FlatMap.flat_map(children, &:
|
616
|
+
def self.declaration_line_numbers
|
617
|
+
@declaration_line_numbers ||= [metadata[:line_number]] +
|
618
|
+
examples.map { |e| e.metadata[:line_number] } +
|
619
|
+
FlatMap.flat_map(children, &:declaration_line_numbers)
|
606
620
|
end
|
607
621
|
|
608
622
|
# @return [String] the unique id of this example group. Pass
|
@@ -23,6 +23,13 @@ module RSpec
|
|
23
23
|
if RSpec::Support::RubyFeatures.ripper_supported?
|
24
24
|
NoExpressionAtLineError = Class.new(StandardError)
|
25
25
|
|
26
|
+
PAREN_TOKEN_TYPE_PAIRS = {
|
27
|
+
:on_lbracket => :on_rbracket,
|
28
|
+
:on_lparen => :on_rparen,
|
29
|
+
:on_lbrace => :on_rbrace,
|
30
|
+
:on_heredoc_beg => :on_heredoc_end
|
31
|
+
}
|
32
|
+
|
26
33
|
attr_reader :source, :beginning_line_number, :max_line_count
|
27
34
|
|
28
35
|
def self.extract_expression_lines_at(file_path, beginning_line_number, max_line_count=nil)
|
@@ -57,29 +64,29 @@ module RSpec
|
|
57
64
|
def line_range_of_expression
|
58
65
|
@line_range_of_expression ||= begin
|
59
66
|
line_range = line_range_of_location_nodes_in_expression
|
60
|
-
|
61
|
-
|
67
|
+
initial_unclosed_parens = unclosed_paren_tokens_in_line_range(line_range)
|
68
|
+
unclosed_parens = initial_unclosed_parens
|
62
69
|
|
63
|
-
until (
|
70
|
+
until (initial_unclosed_parens & unclosed_parens).empty?
|
64
71
|
line_range = (line_range.begin)..(line_range.end + 1)
|
65
|
-
|
72
|
+
unclosed_parens = unclosed_paren_tokens_in_line_range(line_range)
|
66
73
|
end
|
67
74
|
|
68
75
|
line_range
|
69
76
|
end
|
70
77
|
end
|
71
78
|
|
72
|
-
def
|
79
|
+
def unclosed_paren_tokens_in_line_range(line_range)
|
73
80
|
tokens = FlatMap.flat_map(line_range) do |line_number|
|
74
81
|
source.tokens_by_line_number[line_number]
|
75
82
|
end
|
76
83
|
|
77
84
|
tokens.each_with_object([]) do |token, unclosed_tokens|
|
78
|
-
if token.
|
85
|
+
if PAREN_TOKEN_TYPE_PAIRS.keys.include?(token.type)
|
79
86
|
unclosed_tokens << token
|
80
87
|
else
|
81
88
|
index = unclosed_tokens.rindex do |unclosed_token|
|
82
|
-
unclosed_token.
|
89
|
+
PAREN_TOKEN_TYPE_PAIRS[unclosed_token.type] == token.type
|
83
90
|
end
|
84
91
|
unclosed_tokens.delete_at(index) if index
|
85
92
|
end
|
data/lib/rspec/core/metadata.rb
CHANGED
@@ -106,11 +106,6 @@ module RSpec
|
|
106
106
|
"#{metadata[:rerun_file_path]}[#{metadata[:scoped_id]}]"
|
107
107
|
end
|
108
108
|
|
109
|
-
# @private
|
110
|
-
def self.location_tuple_from(metadata)
|
111
|
-
[metadata[:absolute_file_path], metadata[:line_number]]
|
112
|
-
end
|
113
|
-
|
114
109
|
# @private
|
115
110
|
# Used internally to populate metadata hashes with computed keys
|
116
111
|
# managed by RSpec.
|
@@ -15,9 +15,9 @@ module RSpec
|
|
15
15
|
# @private
|
16
16
|
def filter_applies?(key, value, metadata)
|
17
17
|
silence_metadata_example_group_deprecations do
|
18
|
-
return location_filter_applies?(value, metadata)
|
19
|
-
return id_filter_applies?(value, metadata)
|
20
|
-
return filters_apply?(key, value, metadata)
|
18
|
+
return location_filter_applies?(value, metadata) if key == :locations
|
19
|
+
return id_filter_applies?(value, metadata) if key == :ids
|
20
|
+
return filters_apply?(key, value, metadata) if Hash === value
|
21
21
|
|
22
22
|
return false unless metadata.key?(key)
|
23
23
|
return true if TrueClass === value && !!metadata[key]
|
@@ -49,14 +49,13 @@ module RSpec
|
|
49
49
|
end
|
50
50
|
|
51
51
|
def location_filter_applies?(locations, metadata)
|
52
|
-
|
53
|
-
|
54
|
-
|
52
|
+
line_numbers = example_group_declaration_lines(locations, metadata)
|
53
|
+
line_number_filter_applies?(line_numbers, metadata)
|
54
|
+
end
|
55
55
|
|
56
|
-
|
57
|
-
|
58
|
-
|
59
|
-
end
|
56
|
+
def line_number_filter_applies?(line_numbers, metadata)
|
57
|
+
preceding_declaration_lines = line_numbers.map { |n| RSpec.world.preceding_declaration_line(n) }
|
58
|
+
!(relevant_line_numbers(metadata) & preceding_declaration_lines).empty?
|
60
59
|
end
|
61
60
|
|
62
61
|
def proc_filter_applies?(key, proc, metadata)
|
@@ -67,6 +66,16 @@ module RSpec
|
|
67
66
|
end
|
68
67
|
end
|
69
68
|
|
69
|
+
def relevant_line_numbers(metadata)
|
70
|
+
Metadata.ascend(metadata).map { |meta| meta[:line_number] }
|
71
|
+
end
|
72
|
+
|
73
|
+
def example_group_declaration_lines(locations, metadata)
|
74
|
+
FlatMap.flat_map(Metadata.ascend(metadata)) do |meta|
|
75
|
+
locations[meta[:absolute_file_path]]
|
76
|
+
end.uniq
|
77
|
+
end
|
78
|
+
|
70
79
|
def filters_apply?(key, value, metadata)
|
71
80
|
subhash = metadata[key]
|
72
81
|
return false unless Hash === subhash || HashImitatable === subhash
|
@@ -151,7 +151,7 @@ module RSpec::Core
|
|
151
151
|
begin
|
152
152
|
Integer(argument)
|
153
153
|
rescue ArgumentError
|
154
|
-
RSpec.warning "Non integer specified as profile count,
|
154
|
+
RSpec.warning "Non integer specified as profile count, separate " \
|
155
155
|
"your path from options with -- e.g. " \
|
156
156
|
"`rspec --profile -- #{argument}`",
|
157
157
|
:call_site => nil
|
data/lib/rspec/core/rake_task.rb
CHANGED
@@ -81,14 +81,14 @@ module RSpec
|
|
81
81
|
|
82
82
|
return unless fail_on_error
|
83
83
|
$stderr.puts "#{command} failed" if verbose
|
84
|
-
exit $?.exitstatus
|
84
|
+
exit $?.exitstatus
|
85
85
|
end
|
86
86
|
|
87
87
|
private
|
88
88
|
|
89
89
|
# @private
|
90
90
|
def define(args, &task_block)
|
91
|
-
desc "Run RSpec code examples" unless ::Rake.application.
|
91
|
+
desc "Run RSpec code examples" unless ::Rake.application.last_comment
|
92
92
|
|
93
93
|
task name, *args do |_, task_args|
|
94
94
|
RakeFileUtils.__send__(:verbose, verbose) do
|
data/lib/rspec/core/runner.rb
CHANGED
@@ -152,7 +152,7 @@ module RSpec
|
|
152
152
|
# @private
|
153
153
|
# rubocop:disable Lint/EnsureReturn
|
154
154
|
def self.running_in_drb?
|
155
|
-
if defined?(DRb) && DRb.current_server
|
155
|
+
if defined?(DRb) && DRb.current_server && DRb.current_server.alive?
|
156
156
|
require 'socket'
|
157
157
|
require 'uri'
|
158
158
|
local_ipv4 = IPSocket.getaddress(Socket.gethostname)
|
@@ -6,17 +6,6 @@ module RSpec
|
|
6
6
|
# @private
|
7
7
|
# A wrapper for Ripper token which is generated with `Ripper.lex`.
|
8
8
|
class Token
|
9
|
-
CLOSING_TYPES_BY_OPENING_TYPE = {
|
10
|
-
:on_lbracket => :on_rbracket,
|
11
|
-
:on_lparen => :on_rparen,
|
12
|
-
:on_lbrace => :on_rbrace,
|
13
|
-
:on_heredoc_beg => :on_heredoc_end
|
14
|
-
}.freeze
|
15
|
-
|
16
|
-
CLOSING_KEYWORDS_BY_OPENING_KEYWORD = {
|
17
|
-
'do' => 'end'
|
18
|
-
}.freeze
|
19
|
-
|
20
9
|
attr_reader :token
|
21
10
|
|
22
11
|
def self.tokens_from_ripper_tokens(ripper_tokens)
|
@@ -48,38 +37,6 @@ module RSpec
|
|
48
37
|
def inspect
|
49
38
|
"#<#{self.class} #{type} #{string.inspect}>"
|
50
39
|
end
|
51
|
-
|
52
|
-
def keyword?
|
53
|
-
type == :on_kw
|
54
|
-
end
|
55
|
-
|
56
|
-
def opening?
|
57
|
-
opening_delimiter? || opening_keyword?
|
58
|
-
end
|
59
|
-
|
60
|
-
def closed_by?(other)
|
61
|
-
closed_by_delimiter?(other) || closed_by_keyword?(other)
|
62
|
-
end
|
63
|
-
|
64
|
-
private
|
65
|
-
|
66
|
-
def opening_delimiter?
|
67
|
-
CLOSING_TYPES_BY_OPENING_TYPE.key?(type)
|
68
|
-
end
|
69
|
-
|
70
|
-
def opening_keyword?
|
71
|
-
return false unless keyword?
|
72
|
-
CLOSING_KEYWORDS_BY_OPENING_KEYWORD.key?(string)
|
73
|
-
end
|
74
|
-
|
75
|
-
def closed_by_delimiter?(other)
|
76
|
-
other.type == CLOSING_TYPES_BY_OPENING_TYPE[type]
|
77
|
-
end
|
78
|
-
|
79
|
-
def closed_by_keyword?(other)
|
80
|
-
return false unless other.keyword?
|
81
|
-
other.string == CLOSING_KEYWORDS_BY_OPENING_KEYWORD[string]
|
82
|
-
end
|
83
40
|
end
|
84
41
|
end
|
85
42
|
end
|
data/lib/rspec/core/version.rb
CHANGED
data/lib/rspec/core/world.rb
CHANGED
@@ -96,12 +96,10 @@ module RSpec
|
|
96
96
|
# @api private
|
97
97
|
#
|
98
98
|
# Find line number of previous declaration.
|
99
|
-
def preceding_declaration_line(
|
100
|
-
|
101
|
-
|
99
|
+
def preceding_declaration_line(filter_line)
|
100
|
+
declaration_line_numbers.sort.inject(nil) do |highest_prior_declaration_line, line|
|
101
|
+
line <= filter_line ? line : highest_prior_declaration_line
|
102
102
|
end
|
103
|
-
|
104
|
-
line_numbers.find { |num| num <= filter_line }
|
105
103
|
end
|
106
104
|
|
107
105
|
# @private
|
@@ -181,22 +179,8 @@ module RSpec
|
|
181
179
|
|
182
180
|
private
|
183
181
|
|
184
|
-
def
|
185
|
-
@
|
186
|
-
declaration_locations = FlatMap.flat_map(example_groups, &:declaration_locations)
|
187
|
-
hash_of_arrays = Hash.new { |h, k| h[k] = [] }
|
188
|
-
|
189
|
-
# TODO: change `inject` to `each_with_object` when we drop 1.8.7 support.
|
190
|
-
line_nums_by_file = declaration_locations.inject(hash_of_arrays) do |hash, (file_name, line_number)|
|
191
|
-
hash[file_name] << line_number
|
192
|
-
hash
|
193
|
-
end
|
194
|
-
|
195
|
-
line_nums_by_file.each_value do |list|
|
196
|
-
list.sort!
|
197
|
-
list.reverse!
|
198
|
-
end
|
199
|
-
end
|
182
|
+
def declaration_line_numbers
|
183
|
+
@declaration_line_numbers ||= FlatMap.flat_map(example_groups, &:declaration_line_numbers)
|
200
184
|
end
|
201
185
|
|
202
186
|
def fail_if_config_and_cli_options_invalid
|
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.5.0.beta1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Steven Baker
|
@@ -46,34 +46,34 @@ cert_chain:
|
|
46
46
|
ZsVDj6a7lH3cNqtWXZxrb2wO38qV5AkYj8SQK7Hj3/Yui9myUX3crr+PdetazSqQ
|
47
47
|
F3MdtaDehhjC
|
48
48
|
-----END CERTIFICATE-----
|
49
|
-
date: 2016-
|
49
|
+
date: 2016-02-06 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.5.0.beta1
|
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.5.0.beta1
|
65
65
|
- !ruby/object:Gem::Dependency
|
66
66
|
name: rake
|
67
67
|
requirement: !ruby/object:Gem::Requirement
|
68
68
|
requirements:
|
69
|
-
- - "
|
69
|
+
- - "~>"
|
70
70
|
- !ruby/object:Gem::Version
|
71
71
|
version: 10.0.0
|
72
72
|
type: :development
|
73
73
|
prerelease: false
|
74
74
|
version_requirements: !ruby/object:Gem::Requirement
|
75
75
|
requirements:
|
76
|
-
- - "
|
76
|
+
- - "~>"
|
77
77
|
- !ruby/object:Gem::Version
|
78
78
|
version: 10.0.0
|
79
79
|
- !ruby/object:Gem::Dependency
|
@@ -288,14 +288,14 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
288
288
|
version: 1.8.7
|
289
289
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
290
290
|
requirements:
|
291
|
-
- - "
|
291
|
+
- - ">"
|
292
292
|
- !ruby/object:Gem::Version
|
293
|
-
version:
|
293
|
+
version: 1.3.1
|
294
294
|
requirements: []
|
295
295
|
rubyforge_project:
|
296
296
|
rubygems_version: 2.4.5.1
|
297
297
|
signing_key:
|
298
298
|
specification_version: 4
|
299
|
-
summary: rspec-core-3.
|
299
|
+
summary: rspec-core-3.5.0.beta1
|
300
300
|
test_files: []
|
301
301
|
has_rdoc:
|
metadata.gz.sig
CHANGED
Binary file
|