rspec-core 3.5.0 → 3.5.1
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 +0 -0
- data.tar.gz.sig +0 -0
- data/Changelog.md +8 -0
- data/lib/rspec/core/configuration.rb +27 -8
- data/lib/rspec/core/example_group.rb +14 -0
- data/lib/rspec/core/hooks.rb +2 -2
- data/lib/rspec/core/version.rb +1 -1
- data/lib/rspec/core/world.rb +16 -0
- metadata +4 -4
- metadata.gz.sig +4 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 8edadb66ad16d53a8e8b9c24bcb0d6e0d0cf60a4
|
4
|
+
data.tar.gz: 482215825781fdb27385c38e782ae15eea0d4340
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 033297ca6896a612fda69a3a7c4f60b98dac28da47312c866a0c1bbfcf799163393b9520f4e158f48d7bdf5b0d8d21dd65091f79779e9fe4e0e0530913588079
|
7
|
+
data.tar.gz: 290acfab949ab5e5bf54b6cb67d298c232e03c3c00155a18754e327d79aa68d0bf8f210db2ee1f6aea2fc9b7271dd518cd08ee606c31a8f66035b4eee92b6e0f
|
checksums.yaml.gz.sig
CHANGED
Binary file
|
data.tar.gz.sig
CHANGED
Binary file
|
data/Changelog.md
CHANGED
@@ -1,3 +1,11 @@
|
|
1
|
+
### 3.5.1 / 2016-07-06
|
2
|
+
[Full Changelog](http://github.com/rspec/rspec-core/compare/v3.5.0...v3.5.1)
|
3
|
+
|
4
|
+
Bug Fixes:
|
5
|
+
|
6
|
+
* Ensure that config hooks that are added to existing example groups are
|
7
|
+
added only once. (Eugene Kenny, #2280)
|
8
|
+
|
1
9
|
### 3.5.0 / 2016-07-01
|
2
10
|
[Full Changelog](http://github.com/rspec/rspec-core/compare/v3.5.0.beta4...v3.5.0)
|
3
11
|
|
@@ -1749,7 +1749,7 @@ module RSpec
|
|
1749
1749
|
handle_suite_hook(scope, meta) do
|
1750
1750
|
@before_suite_hooks << Hooks::BeforeHook.new(block, {})
|
1751
1751
|
end || begin
|
1752
|
-
|
1752
|
+
add_hook_to_existing_matching_groups(meta, scope) { |g| g.before(scope, *meta, &block) }
|
1753
1753
|
super(scope, *meta, &block)
|
1754
1754
|
end
|
1755
1755
|
end
|
@@ -1772,7 +1772,7 @@ module RSpec
|
|
1772
1772
|
handle_suite_hook(scope, meta) do
|
1773
1773
|
@before_suite_hooks.unshift Hooks::BeforeHook.new(block, {})
|
1774
1774
|
end || begin
|
1775
|
-
|
1775
|
+
add_hook_to_existing_matching_groups(meta, scope) { |g| g.prepend_before(scope, *meta, &block) }
|
1776
1776
|
super(scope, *meta, &block)
|
1777
1777
|
end
|
1778
1778
|
end
|
@@ -1790,7 +1790,7 @@ module RSpec
|
|
1790
1790
|
handle_suite_hook(scope, meta) do
|
1791
1791
|
@after_suite_hooks.unshift Hooks::AfterHook.new(block, {})
|
1792
1792
|
end || begin
|
1793
|
-
|
1793
|
+
add_hook_to_existing_matching_groups(meta, scope) { |g| g.after(scope, *meta, &block) }
|
1794
1794
|
super(scope, *meta, &block)
|
1795
1795
|
end
|
1796
1796
|
end
|
@@ -1813,7 +1813,7 @@ module RSpec
|
|
1813
1813
|
handle_suite_hook(scope, meta) do
|
1814
1814
|
@after_suite_hooks << Hooks::AfterHook.new(block, {})
|
1815
1815
|
end || begin
|
1816
|
-
|
1816
|
+
add_hook_to_existing_matching_groups(meta, scope) { |g| g.append_after(scope, *meta, &block) }
|
1817
1817
|
super(scope, *meta, &block)
|
1818
1818
|
end
|
1819
1819
|
end
|
@@ -1822,8 +1822,7 @@ module RSpec
|
|
1822
1822
|
#
|
1823
1823
|
# See {Hooks#around} for full `around` hook docs.
|
1824
1824
|
def around(scope=nil, *meta, &block)
|
1825
|
-
|
1826
|
-
|
1825
|
+
add_hook_to_existing_matching_groups(meta, scope) { |g| g.around(scope, *meta, &block) }
|
1827
1826
|
super(scope, *meta, &block)
|
1828
1827
|
end
|
1829
1828
|
|
@@ -2027,12 +2026,32 @@ module RSpec
|
|
2027
2026
|
end
|
2028
2027
|
end
|
2029
2028
|
|
2029
|
+
def add_hook_to_existing_matching_groups(meta, scope, &block)
|
2030
|
+
# For example hooks, we have to apply it to each of the top level
|
2031
|
+
# groups, even if the groups do not match. When we apply it, we
|
2032
|
+
# apply it with the metadata, so it will only apply to examples
|
2033
|
+
# in the group that match the metadata.
|
2034
|
+
# #2280 for background and discussion.
|
2035
|
+
if scope == :example || scope == :each || scope.nil?
|
2036
|
+
world.example_groups.each(&block)
|
2037
|
+
else
|
2038
|
+
meta = Metadata.build_hash_from(meta.dup)
|
2039
|
+
on_existing_matching_groups(meta, &block)
|
2040
|
+
end
|
2041
|
+
end
|
2042
|
+
|
2030
2043
|
def on_existing_matching_groups(meta)
|
2031
|
-
world.
|
2032
|
-
|
2044
|
+
world.traverse_example_group_trees_until do |group|
|
2045
|
+
metadata_applies_to_group?(meta, group).tap do |applies|
|
2046
|
+
yield group if applies
|
2047
|
+
end
|
2033
2048
|
end
|
2034
2049
|
end
|
2035
2050
|
|
2051
|
+
def metadata_applies_to_group?(meta, group)
|
2052
|
+
meta.empty? || MetadataFilter.apply?(:any?, meta, group.metadata)
|
2053
|
+
end
|
2054
|
+
|
2036
2055
|
if RSpec::Support::RubyFeatures.module_prepends_supported?
|
2037
2056
|
def safe_prepend(mod, host)
|
2038
2057
|
host.__send__(:prepend, mod) unless host < mod
|
@@ -450,6 +450,20 @@ module RSpec
|
|
450
450
|
@children ||= []
|
451
451
|
end
|
452
452
|
|
453
|
+
# @private
|
454
|
+
# Traverses the tree of groups, starting with `self`, then the children, recursively.
|
455
|
+
# Halts the traversal of a branch of the tree as soon as the passed block returns true.
|
456
|
+
# Note that siblings groups and their sub-trees will continue to be explored.
|
457
|
+
# This is intended to make it easy to find the top-most group that satisfies some
|
458
|
+
# condition.
|
459
|
+
def self.traverse_tree_until(&block)
|
460
|
+
return if yield self
|
461
|
+
|
462
|
+
children.each do |child|
|
463
|
+
child.traverse_tree_until(&block)
|
464
|
+
end
|
465
|
+
end
|
466
|
+
|
453
467
|
# @private
|
454
468
|
def self.next_runnable_index_for(file)
|
455
469
|
if self == ExampleGroup
|
data/lib/rspec/core/hooks.rb
CHANGED
@@ -191,7 +191,7 @@ module RSpec
|
|
191
191
|
#
|
192
192
|
# @note The `:example` and `:context` scopes are also available as
|
193
193
|
# `:each` and `:all`, respectively. Use whichever you prefer.
|
194
|
-
# @note The `:
|
194
|
+
# @note The `:suite` scope is only supported for hooks registered on
|
195
195
|
# `RSpec.configuration` since they exist independently of any
|
196
196
|
# example or example group.
|
197
197
|
def before(*args, &block)
|
@@ -265,7 +265,7 @@ module RSpec
|
|
265
265
|
#
|
266
266
|
# @note The `:example` and `:context` scopes are also available as
|
267
267
|
# `:each` and `:all`, respectively. Use whichever you prefer.
|
268
|
-
# @note The `:
|
268
|
+
# @note The `:suite` scope is only supported for hooks registered on
|
269
269
|
# `RSpec.configuration` since they exist independently of any
|
270
270
|
# example or example group.
|
271
271
|
def after(*args, &block)
|
data/lib/rspec/core/version.rb
CHANGED
data/lib/rspec/core/world.rb
CHANGED
@@ -92,6 +92,19 @@ module RSpec
|
|
92
92
|
FlatMap.flat_map(all_example_groups) { |g| g.examples }
|
93
93
|
end
|
94
94
|
|
95
|
+
# @private
|
96
|
+
# Traverses the tree of each top level group.
|
97
|
+
# For each it yields the group, then the children, recursively.
|
98
|
+
# Halts the traversal of a branch of the tree as soon as the passed block returns true.
|
99
|
+
# Note that siblings groups and their sub-trees will continue to be explored.
|
100
|
+
# This is intended to make it easy to find the top-most group that satisfies some
|
101
|
+
# condition.
|
102
|
+
def traverse_example_group_trees_until(&block)
|
103
|
+
example_groups.each do |group|
|
104
|
+
group.traverse_tree_until(&block)
|
105
|
+
end
|
106
|
+
end
|
107
|
+
|
95
108
|
# @api private
|
96
109
|
#
|
97
110
|
# Find line number of previous declaration.
|
@@ -215,6 +228,9 @@ module RSpec
|
|
215
228
|
[]
|
216
229
|
end
|
217
230
|
|
231
|
+
def self.traverse_example_group_trees_until
|
232
|
+
end
|
233
|
+
|
218
234
|
# :nocov:
|
219
235
|
def self.example_groups
|
220
236
|
[]
|
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.5.
|
4
|
+
version: 3.5.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Steven Baker
|
@@ -46,7 +46,7 @@ cert_chain:
|
|
46
46
|
ZsVDj6a7lH3cNqtWXZxrb2wO38qV5AkYj8SQK7Hj3/Yui9myUX3crr+PdetazSqQ
|
47
47
|
F3MdtaDehhjC
|
48
48
|
-----END CERTIFICATE-----
|
49
|
-
date: 2016-07-
|
49
|
+
date: 2016-07-07 00:00:00.000000000 Z
|
50
50
|
dependencies:
|
51
51
|
- !ruby/object:Gem::Dependency
|
52
52
|
name: rspec-support
|
@@ -280,9 +280,9 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
280
280
|
version: '0'
|
281
281
|
requirements: []
|
282
282
|
rubyforge_project:
|
283
|
-
rubygems_version: 2.
|
283
|
+
rubygems_version: 2.2.2
|
284
284
|
signing_key:
|
285
285
|
specification_version: 4
|
286
|
-
summary: rspec-core-3.5.
|
286
|
+
summary: rspec-core-3.5.1
|
287
287
|
test_files: []
|
288
288
|
has_rdoc:
|
metadata.gz.sig
CHANGED
@@ -1,3 +1,4 @@
|
|
1
|
-
|
2
|
-
|
3
|
-
�
|
1
|
+
Q��AP�3�%,�ֶ�U�NfJD`��2d\�pF*���(&�A�ڹC�ع��e g�C��/�'�rMfp},
|
2
|
+
`Չ&O�X�L(@IJEc���o���[M؞�DQTI�T�5��~ xD��ф��)������9+-fy�ۜ�e���^�f~���"���"�пc��sV��h�����)Pvߕ�{sؗ$�� ���>V����ƪX
|
3
|
+
E�'�K�qq�J*�v�?$� F�N8����7���k/�#�?���'`Jœ�Y�ͷŕRƭ�����$�`dҡQ�P�y��.tGН�G�T7�ϫ@�l�ތ2����Y�0U���!�X���,���fL���F݀ٴV�/�����p�&��+��Mx֟ݔX��
|
4
|
+
(�����u���}�ZgY�2^"��yݦ�<d�^z_ �(�JgrNMI�y=KLyXx?Q9�Ǜ�z�-F%U$��0���@���7�G�ܬ�ٟ�g'k�k�0�IE��?Ϳ�&����^��[{�֤
|