rspec-core 3.5.2 → 3.5.3
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 +0 -0
- data.tar.gz.sig +0 -0
- data/Changelog.md +14 -0
- data/lib/rspec/core/configuration.rb +12 -5
- data/lib/rspec/core/example.rb +5 -5
- data/lib/rspec/core/example_group.rb +4 -4
- data/lib/rspec/core/formatters/exception_presenter.rb +2 -1
- data/lib/rspec/core/hooks.rb +1 -8
- data/lib/rspec/core/metadata.rb +1 -0
- data/lib/rspec/core/notifications.rb +2 -3
- data/lib/rspec/core/reporter.rb +12 -0
- data/lib/rspec/core/runner.rb +5 -3
- data/lib/rspec/core/version.rb +1 -1
- data/lib/rspec/core/world.rb +9 -0
- metadata +3 -3
- 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: c9ac822b43683de914c3aa410444eb1c169d0f2d
|
4
|
+
data.tar.gz: ac809f4a29ae13c01faf12e9da68cebb52382be0
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 810b2232c50232d568af42436cb1b81dc5b109b9534f8d82a554a069713ce23b0775f8c24eb9edb42f9b51590db57804fe0d2dce55a5af473da81c4dd94b9c9f
|
7
|
+
data.tar.gz: a0e5e3b3f939ac9518d3b527b40e576ea221f80b66f37fada8f122f960b1720035330fa6c28c3ca583f19ba60ef117ca16a8d0ac15750228d0fe71b0e53d26e1
|
checksums.yaml.gz.sig
CHANGED
Binary file
|
data.tar.gz.sig
CHANGED
Binary file
|
data/Changelog.md
CHANGED
@@ -1,3 +1,17 @@
|
|
1
|
+
### 3.5.3 / 2016-09-02
|
2
|
+
[Full Changelog](http://github.com/rspec/rspec-core/compare/v3.5.2...v3.5.3)
|
3
|
+
|
4
|
+
Bug Fixes:
|
5
|
+
|
6
|
+
* When applying shared group metadata to a host group, overwrite
|
7
|
+
conflicting keys if the value in the host group was inherited from
|
8
|
+
a parent group instead of being specified at that level.
|
9
|
+
(Myron Marston, #2307)
|
10
|
+
* Handle errors in `:suite` hooks and provide the same nicely formatted
|
11
|
+
output as errors that happen in examples. (Myron Marston, #2316)
|
12
|
+
* Set the exit status to non-zero when an error occurs in an
|
13
|
+
`after(:context)` hook. (Myron Marston, #2320)
|
14
|
+
|
1
15
|
### 3.5.2 / 2016-07-28
|
2
16
|
[Full Changelog](http://github.com/rspec/rspec-core/compare/v3.5.1...v3.5.2)
|
3
17
|
|
@@ -1830,12 +1830,11 @@ module RSpec
|
|
1830
1830
|
def with_suite_hooks
|
1831
1831
|
return yield if dry_run?
|
1832
1832
|
|
1833
|
-
hook_context = SuiteHookContext.new
|
1834
1833
|
begin
|
1835
|
-
|
1834
|
+
run_suite_hooks("a `before(:suite)` hook", @before_suite_hooks)
|
1836
1835
|
yield
|
1837
1836
|
ensure
|
1838
|
-
|
1837
|
+
run_suite_hooks("an `after(:suite)` hook", @after_suite_hooks)
|
1839
1838
|
end
|
1840
1839
|
end
|
1841
1840
|
|
@@ -1875,8 +1874,16 @@ module RSpec
|
|
1875
1874
|
yield
|
1876
1875
|
end
|
1877
1876
|
|
1878
|
-
def
|
1879
|
-
|
1877
|
+
def run_suite_hooks(hook_description, hooks)
|
1878
|
+
context = SuiteHookContext.new(hook_description, reporter)
|
1879
|
+
|
1880
|
+
hooks.each do |hook|
|
1881
|
+
begin
|
1882
|
+
hook.run(context)
|
1883
|
+
rescue Support::AllExceptionsExceptOnesWeMustNotRescue => ex
|
1884
|
+
context.set_exception(ex)
|
1885
|
+
end
|
1886
|
+
end
|
1880
1887
|
end
|
1881
1888
|
|
1882
1889
|
def get_files_to_run(paths)
|
data/lib/rspec/core/example.rb
CHANGED
@@ -632,16 +632,16 @@ module RSpec
|
|
632
632
|
# @private
|
633
633
|
# Provides an execution context for before/after :suite hooks.
|
634
634
|
class SuiteHookContext < Example
|
635
|
-
def initialize
|
636
|
-
super(AnonymousExampleGroup,
|
635
|
+
def initialize(hook_description, reporter)
|
636
|
+
super(AnonymousExampleGroup, hook_description, {})
|
637
637
|
@example_group_instance = AnonymousExampleGroup.new
|
638
|
+
@reporter = reporter
|
638
639
|
end
|
639
640
|
|
640
641
|
# rubocop:disable Style/AccessorMethodName
|
641
|
-
|
642
|
-
# To ensure we don't silence errors.
|
643
642
|
def set_exception(exception)
|
644
|
-
|
643
|
+
reporter.notify_non_example_exception(exception, "An error occurred in #{description}.")
|
644
|
+
RSpec.world.wants_to_quit = true
|
645
645
|
end
|
646
646
|
# rubocop:enable Style/AccessorMethodName
|
647
647
|
end
|
@@ -415,10 +415,10 @@ module RSpec
|
|
415
415
|
# not be applied where they should.
|
416
416
|
registration_collection << self
|
417
417
|
|
418
|
-
user_metadata = Metadata.build_hash_from(args)
|
418
|
+
@user_metadata = Metadata.build_hash_from(args)
|
419
419
|
|
420
420
|
@metadata = Metadata::ExampleGroupHash.create(
|
421
|
-
superclass_metadata, user_metadata,
|
421
|
+
superclass_metadata, @user_metadata,
|
422
422
|
superclass.method(:next_runnable_index_for),
|
423
423
|
description, *args, &example_group_block
|
424
424
|
)
|
@@ -705,8 +705,8 @@ module RSpec
|
|
705
705
|
|
706
706
|
# @private
|
707
707
|
def self.update_inherited_metadata(updates)
|
708
|
-
metadata.update(updates) do |
|
709
|
-
existing_group_value
|
708
|
+
metadata.update(updates) do |key, existing_group_value, new_inherited_value|
|
709
|
+
@user_metadata.key?(key) ? existing_group_value : new_inherited_value
|
710
710
|
end
|
711
711
|
|
712
712
|
RSpec.configuration.configure_group(self)
|
@@ -122,7 +122,8 @@ module RSpec
|
|
122
122
|
end
|
123
123
|
|
124
124
|
def indent_lines(lines, failure_number)
|
125
|
-
alignment_basis =
|
125
|
+
alignment_basis = ' ' * @indentation
|
126
|
+
alignment_basis << "#{failure_number}) " if failure_number
|
126
127
|
indentation = ' ' * alignment_basis.length
|
127
128
|
|
128
129
|
lines.each_with_index.map do |line, index|
|
data/lib/rspec/core/hooks.rb
CHANGED
@@ -365,14 +365,7 @@ module RSpec
|
|
365
365
|
def run(example)
|
366
366
|
example.instance_exec(example, &block)
|
367
367
|
rescue Support::AllExceptionsExceptOnesWeMustNotRescue => e
|
368
|
-
|
369
|
-
RSpec.configuration.reporter.message <<-EOS
|
370
|
-
|
371
|
-
An error occurred in an `after(:context)` hook.
|
372
|
-
#{e.class}: #{e.message}
|
373
|
-
occurred at #{e.backtrace.first}
|
374
|
-
|
375
|
-
EOS
|
368
|
+
RSpec.configuration.reporter.notify_non_example_exception(e, "An error occurred in an `after(:context)` hook.")
|
376
369
|
end
|
377
370
|
end
|
378
371
|
|
data/lib/rspec/core/metadata.rb
CHANGED
@@ -178,6 +178,7 @@ module RSpec
|
|
178
178
|
|
179
179
|
def build_description_from(parent_description=nil, my_description=nil)
|
180
180
|
return parent_description.to_s unless my_description
|
181
|
+
return my_description.to_s if parent_description.to_s == ''
|
181
182
|
separator = description_separator(parent_description, my_description)
|
182
183
|
(parent_description.to_s + separator) << my_description.to_s
|
183
184
|
end
|
@@ -51,8 +51,7 @@ module RSpec::Core
|
|
51
51
|
FailedExampleNotification
|
52
52
|
end
|
53
53
|
|
54
|
-
|
55
|
-
klass.new(example, exception_presenter)
|
54
|
+
klass.new(example)
|
56
55
|
end
|
57
56
|
|
58
57
|
private_class_method :new
|
@@ -202,7 +201,7 @@ module RSpec::Core
|
|
202
201
|
|
203
202
|
private
|
204
203
|
|
205
|
-
def initialize(example, exception_presenter)
|
204
|
+
def initialize(example, exception_presenter=Formatters::ExceptionPresenter::Factory.new(example).build)
|
206
205
|
@exception_presenter = exception_presenter
|
207
206
|
super(example)
|
208
207
|
end
|
data/lib/rspec/core/reporter.rb
CHANGED
@@ -151,6 +151,18 @@ module RSpec::Core
|
|
151
151
|
notify :deprecation, Notifications::DeprecationNotification.from_hash(hash)
|
152
152
|
end
|
153
153
|
|
154
|
+
# @private
|
155
|
+
# Provides a way to notify of an exception that is not tied to any
|
156
|
+
# particular exception (such as an exception encountered in a :suite hook).
|
157
|
+
# Exceptions will be formatted the same way they normally are.
|
158
|
+
def notify_non_example_exception(exception, context_description)
|
159
|
+
@configuration.world.non_example_failure = true
|
160
|
+
|
161
|
+
example = Example.new(AnonymousExampleGroup, context_description, {})
|
162
|
+
presenter = Formatters::ExceptionPresenter.new(exception, example, :indentation => 0)
|
163
|
+
message presenter.fully_formatted(nil)
|
164
|
+
end
|
165
|
+
|
154
166
|
# @private
|
155
167
|
def finish
|
156
168
|
close_after do
|
data/lib/rspec/core/runner.rb
CHANGED
@@ -108,11 +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
|
-
@configuration.reporter.report(@world.example_count(example_groups)) do |reporter|
|
111
|
+
success = @configuration.reporter.report(@world.example_count(example_groups)) do |reporter|
|
112
112
|
@configuration.with_suite_hooks do
|
113
|
-
example_groups.map { |g| g.run(reporter) }.all?
|
113
|
+
example_groups.map { |g| g.run(reporter) }.all?
|
114
114
|
end
|
115
|
-
end
|
115
|
+
end && !@world.non_example_failure
|
116
|
+
|
117
|
+
success ? 0 : @configuration.failure_exit_code
|
116
118
|
end
|
117
119
|
|
118
120
|
private
|
data/lib/rspec/core/version.rb
CHANGED
data/lib/rspec/core/world.rb
CHANGED
@@ -10,6 +10,12 @@ module RSpec
|
|
10
10
|
# Used internally to determine what to do when a SIGINT is received.
|
11
11
|
attr_accessor :wants_to_quit
|
12
12
|
|
13
|
+
# Used internally to signal that a failure outside of an example
|
14
|
+
# has occurred, and that therefore the exit status should indicate
|
15
|
+
# the run failed.
|
16
|
+
# @private
|
17
|
+
attr_accessor :non_example_failure
|
18
|
+
|
13
19
|
def initialize(configuration=RSpec.configuration)
|
14
20
|
@configuration = configuration
|
15
21
|
configuration.world = self
|
@@ -224,6 +230,9 @@ module RSpec
|
|
224
230
|
# @private
|
225
231
|
# Provides a null implementation for initial use by configuration.
|
226
232
|
module Null
|
233
|
+
def self.non_example_failure; end
|
234
|
+
def self.non_example_failure=(_); end
|
235
|
+
|
227
236
|
def self.registered_example_group_files
|
228
237
|
[]
|
229
238
|
end
|
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.3
|
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-
|
49
|
+
date: 2016-09-02 00:00:00.000000000 Z
|
50
50
|
dependencies:
|
51
51
|
- !ruby/object:Gem::Dependency
|
52
52
|
name: rspec-support
|
@@ -283,6 +283,6 @@ rubyforge_project:
|
|
283
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.3
|
287
287
|
test_files: []
|
288
288
|
has_rdoc:
|
metadata.gz.sig
CHANGED
Binary file
|