rspec-core 3.8.2 → 3.9.0
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 +23 -1
- data/README.md +1 -1
- data/lib/rspec/core.rb +1 -0
- data/lib/rspec/core/bisect/server.rb +1 -1
- data/lib/rspec/core/configuration.rb +35 -7
- data/lib/rspec/core/did_you_mean.rb +46 -0
- data/lib/rspec/core/example_group.rb +2 -2
- data/lib/rspec/core/formatters.rb +3 -0
- data/lib/rspec/core/formatters/documentation_formatter.rb +35 -3
- data/lib/rspec/core/formatters/failure_list_formatter.rb +23 -0
- data/lib/rspec/core/hooks.rb +14 -6
- data/lib/rspec/core/memoized_helpers.rb +11 -11
- data/lib/rspec/core/metadata.rb +1 -1
- data/lib/rspec/core/option_parser.rb +8 -0
- data/lib/rspec/core/rake_task.rb +21 -1
- data/lib/rspec/core/reporter.rb +8 -0
- data/lib/rspec/core/runner.rb +5 -0
- data/lib/rspec/core/shared_example_group.rb +1 -1
- data/lib/rspec/core/version.rb +1 -1
- metadata +11 -9
- metadata.gz.sig +0 -0
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: dfc313a9688827e1869e5e7f8a77c48e4de3dae1e5c482ff025ff1ab10d8a5f9
|
4
|
+
data.tar.gz: 778eadf545aad964419c6726a1528d437270b271e144406e0bafe66dea7145ee
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 4e3079c080a916da726c6f5fc09d72a80c0f91273ef2cbbe1301708eb458b86773cf336c8f1aa297c819f882ee0b55952f86692c9db0fe2c0a62af5b7a8abf2e
|
7
|
+
data.tar.gz: 90d9fb02c3de9af80b516bf2b3b76520281a0926e16ba383e9384a86a7843be0f20268daba0dd0baa9ca2cb135e58e1bc123b15f5dffd3f0a269ab854b5e3316
|
checksums.yaml.gz.sig
CHANGED
Binary file
|
data.tar.gz.sig
CHANGED
Binary file
|
data/Changelog.md
CHANGED
@@ -1,3 +1,25 @@
|
|
1
|
+
### 3.9.0 / 2019-10-07
|
2
|
+
[Full Changelog](http://github.com/rspec/rspec-core/compare/v3.8.2...v3.9.0)
|
3
|
+
|
4
|
+
Enhancements:
|
5
|
+
* Improve the handling of errors during loading support files, if a file
|
6
|
+
errors before loading specs, RSpec will now skip loading the specs.
|
7
|
+
(David Rodríguez, #2568)
|
8
|
+
* Add support for --example-matches to run examples by regular expression.
|
9
|
+
(Sam Joseph, Matt Rider, @okothkongo1, #2586)
|
10
|
+
* Add `did_you_mean` suggestions for file names encountering a `LoadError`
|
11
|
+
outside of examples. (@obromios, #2601)
|
12
|
+
* Add a minimalist quick fix style formatter, only outputs failures as
|
13
|
+
`file:line:message`. (Romain Tartière, #2614)
|
14
|
+
* Convert string number values to integer when used for `RSpec::Configuration#fail_fast`
|
15
|
+
(Viktor Fonic, #2634)
|
16
|
+
* Issue warning when invalid values are used for `RSpec::Configuration#fail_fast`
|
17
|
+
(Viktor Fonic, #2634)
|
18
|
+
* Add support for running the Rake task in a clean environment.
|
19
|
+
(Jon Rowe, #2632)
|
20
|
+
* Indent messages by there example group / example in the documentation formatter.
|
21
|
+
(Samuel Williams, #2649)
|
22
|
+
|
1
23
|
### 3.8.2 / 2019-06-29
|
2
24
|
[Full Changelog](http://github.com/rspec/rspec-core/compare/v3.8.1...v3.8.2)
|
3
25
|
|
@@ -8,7 +30,7 @@ Bug Fixes:
|
|
8
30
|
(Myron Marston, #2635).
|
9
31
|
|
10
32
|
### 3.8.1 / 2019-06-13
|
11
|
-
[Full Changelog](http://github.com/rspec/rspec-core/compare/v3.8.0...
|
33
|
+
[Full Changelog](http://github.com/rspec/rspec-core/compare/v3.8.0...v3.8.1)
|
12
34
|
|
13
35
|
Bug Fixes:
|
14
36
|
|
data/README.md
CHANGED
data/lib/rspec/core.rb
CHANGED
@@ -139,6 +139,7 @@ module RSpec
|
|
139
139
|
module Core
|
140
140
|
autoload :ExampleStatusPersister, "rspec/core/example_status_persister"
|
141
141
|
autoload :Profiler, "rspec/core/profiler"
|
142
|
+
autoload :DidYouMean, "rspec/core/did_you_mean"
|
142
143
|
|
143
144
|
# @private
|
144
145
|
# This avoids issues with reporting time caused by examples that
|
@@ -33,7 +33,7 @@ module RSpec
|
|
33
33
|
|
34
34
|
def start
|
35
35
|
# Only allow remote DRb requests from this machine.
|
36
|
-
DRb.install_acl ACL.new(%w[ deny all allow localhost allow 127.0.0.1 ])
|
36
|
+
DRb.install_acl ACL.new(%w[ deny all allow localhost allow 127.0.0.1 allow ::1 ])
|
37
37
|
|
38
38
|
# We pass `nil` as the first arg to allow it to pick a DRb port.
|
39
39
|
@drb = DRb.start_service(nil, self)
|
@@ -202,10 +202,33 @@ module RSpec
|
|
202
202
|
only_failures? && !example_status_persistence_file_path
|
203
203
|
end
|
204
204
|
|
205
|
-
# @macro
|
205
|
+
# @macro define_reader
|
206
206
|
# If specified, indicates the number of failures required before cleaning
|
207
|
-
# up and exit (default: `nil`).
|
208
|
-
|
207
|
+
# up and exit (default: `nil`). Can also be `true` to fail and exit on first
|
208
|
+
# failure
|
209
|
+
define_reader :fail_fast
|
210
|
+
|
211
|
+
# @see fail_fast
|
212
|
+
def fail_fast=(value)
|
213
|
+
case value
|
214
|
+
when true, 'true'
|
215
|
+
@fail_fast = true
|
216
|
+
when false, 'false', 0
|
217
|
+
@fail_fast = false
|
218
|
+
when nil
|
219
|
+
@fail_fast = nil
|
220
|
+
else
|
221
|
+
@fail_fast = value.to_i
|
222
|
+
|
223
|
+
if value.to_i == 0
|
224
|
+
# TODO: in RSpec 4, consider raising an error here.
|
225
|
+
RSpec.warning "Cannot set `RSpec.configuration.fail_fast`" \
|
226
|
+
" to `#{value.inspect}`. Only `true`, `false`, `nil` and integers" \
|
227
|
+
" are valid values."
|
228
|
+
@fail_fast = true
|
229
|
+
end
|
230
|
+
end
|
231
|
+
end
|
209
232
|
|
210
233
|
# @macro add_setting
|
211
234
|
# Prints the formatter output of your suite without running any
|
@@ -1106,7 +1129,7 @@ module RSpec
|
|
1106
1129
|
#
|
1107
1130
|
# # This lets you do this:
|
1108
1131
|
#
|
1109
|
-
# describe Thing do
|
1132
|
+
# RSpec.describe Thing do
|
1110
1133
|
# pending "does something" do
|
1111
1134
|
# thing = Thing.new
|
1112
1135
|
# end
|
@@ -1114,7 +1137,7 @@ module RSpec
|
|
1114
1137
|
#
|
1115
1138
|
# # ... which is the equivalent of
|
1116
1139
|
#
|
1117
|
-
# describe Thing do
|
1140
|
+
# RSpec.describe Thing do
|
1118
1141
|
# it "does something", :pending => true do
|
1119
1142
|
# thing = Thing.new
|
1120
1143
|
# end
|
@@ -1167,7 +1190,7 @@ module RSpec
|
|
1167
1190
|
#
|
1168
1191
|
# # allows the user to include a shared example group like:
|
1169
1192
|
#
|
1170
|
-
# describe Entity do
|
1193
|
+
# RSpec.describe Entity do
|
1171
1194
|
# it_has_behavior 'sortability' do
|
1172
1195
|
# let(:sortable) { Entity.new }
|
1173
1196
|
# end
|
@@ -1718,7 +1741,7 @@ module RSpec
|
|
1718
1741
|
# rspec.expose_current_running_example_as :example
|
1719
1742
|
# end
|
1720
1743
|
#
|
1721
|
-
# describe MyClass do
|
1744
|
+
# RSpec.describe MyClass do
|
1722
1745
|
# before do
|
1723
1746
|
# # `example` can be used here because of the above config.
|
1724
1747
|
# do_something if example.metadata[:type] == "foo"
|
@@ -2051,6 +2074,11 @@ module RSpec
|
|
2051
2074
|
|
2052
2075
|
def load_file_handling_errors(method, file)
|
2053
2076
|
__send__(method, file)
|
2077
|
+
rescue LoadError => ex
|
2078
|
+
relative_file = Metadata.relative_path(file)
|
2079
|
+
suggestions = DidYouMean.new(relative_file).call
|
2080
|
+
reporter.notify_non_example_exception(ex, "An error occurred while loading #{relative_file}.#{suggestions}")
|
2081
|
+
RSpec.world.wants_to_quit = true
|
2054
2082
|
rescue Support::AllExceptionsExceptOnesWeMustNotRescue => ex
|
2055
2083
|
relative_file = Metadata.relative_path(file)
|
2056
2084
|
reporter.notify_non_example_exception(ex, "An error occurred while loading #{relative_file}.")
|
@@ -0,0 +1,46 @@
|
|
1
|
+
module RSpec
|
2
|
+
module Core
|
3
|
+
# @private
|
4
|
+
# Wrapper around Ruby's `DidYouMean::SpellChecker` when available to provide file name suggestions.
|
5
|
+
class DidYouMean
|
6
|
+
attr_reader :relative_file_name
|
7
|
+
|
8
|
+
def initialize(relative_file_name)
|
9
|
+
@relative_file_name = relative_file_name
|
10
|
+
end
|
11
|
+
|
12
|
+
if defined?(::DidYouMean::SpellChecker)
|
13
|
+
# provide probable suggestions
|
14
|
+
def call
|
15
|
+
checker = ::DidYouMean::SpellChecker.new(:dictionary => Dir["spec/**/*.rb"])
|
16
|
+
probables = checker.correct(relative_file_name.sub('./', ''))[0..2]
|
17
|
+
return '' unless probables.any?
|
18
|
+
|
19
|
+
formats probables
|
20
|
+
end
|
21
|
+
else
|
22
|
+
# return a hint if API for ::DidYouMean::SpellChecker not supported
|
23
|
+
def call
|
24
|
+
"\nHint: Install the `did_you_mean` gem in order to provide suggestions for similarly named files."
|
25
|
+
end
|
26
|
+
end
|
27
|
+
|
28
|
+
private
|
29
|
+
|
30
|
+
def formats(probables)
|
31
|
+
rspec_format = probables.map { |s, _| "rspec ./#{s}" }
|
32
|
+
red_font(top_and_tail rspec_format)
|
33
|
+
end
|
34
|
+
|
35
|
+
def top_and_tail(rspec_format)
|
36
|
+
spaces = ' ' * 20
|
37
|
+
rspec_format.insert(0, ' - Did you mean?').join("\n#{spaces}") + "\n"
|
38
|
+
end
|
39
|
+
|
40
|
+
def red_font(mytext)
|
41
|
+
colorizer = ::RSpec::Core::Formatters::ConsoleCodes
|
42
|
+
colorizer.wrap mytext, :failure
|
43
|
+
end
|
44
|
+
end
|
45
|
+
end
|
46
|
+
end
|
@@ -7,7 +7,7 @@ module RSpec
|
|
7
7
|
# ExampleGroup and {Example} are the main structural elements of
|
8
8
|
# rspec-core. Consider this example:
|
9
9
|
#
|
10
|
-
# describe Thing do
|
10
|
+
# RSpec.describe Thing do
|
11
11
|
# it "does something" do
|
12
12
|
# end
|
13
13
|
# end
|
@@ -90,7 +90,7 @@ module RSpec
|
|
90
90
|
# Returns the class or module passed to the `describe` method (or alias).
|
91
91
|
# Returns nil if the subject is not a class or module.
|
92
92
|
# @example
|
93
|
-
# describe Thing do
|
93
|
+
# RSpec.describe Thing do
|
94
94
|
# it "does something" do
|
95
95
|
# described_class == Thing
|
96
96
|
# end
|
@@ -74,6 +74,7 @@ module RSpec::Core::Formatters
|
|
74
74
|
autoload :JsonFormatter, 'rspec/core/formatters/json_formatter'
|
75
75
|
autoload :BisectDRbFormatter, 'rspec/core/formatters/bisect_drb_formatter'
|
76
76
|
autoload :ExceptionPresenter, 'rspec/core/formatters/exception_presenter'
|
77
|
+
autoload :FailureListFormatter, 'rspec/core/formatters/failure_list_formatter'
|
77
78
|
|
78
79
|
# Register the formatter class
|
79
80
|
# @param formatter_class [Class] formatter class to register
|
@@ -212,6 +213,8 @@ module RSpec::Core::Formatters
|
|
212
213
|
JsonFormatter
|
213
214
|
when 'bisect-drb'
|
214
215
|
BisectDRbFormatter
|
216
|
+
when 'f', 'failures'
|
217
|
+
FailureListFormatter
|
215
218
|
end
|
216
219
|
end
|
217
220
|
|
@@ -6,12 +6,19 @@ module RSpec
|
|
6
6
|
module Formatters
|
7
7
|
# @private
|
8
8
|
class DocumentationFormatter < BaseTextFormatter
|
9
|
-
Formatters.register self, :example_group_started, :example_group_finished,
|
9
|
+
Formatters.register self, :example_started, :example_group_started, :example_group_finished,
|
10
10
|
:example_passed, :example_pending, :example_failed
|
11
11
|
|
12
12
|
def initialize(output)
|
13
13
|
super
|
14
14
|
@group_level = 0
|
15
|
+
|
16
|
+
@example_running = false
|
17
|
+
@messages = []
|
18
|
+
end
|
19
|
+
|
20
|
+
def example_started(_notification)
|
21
|
+
@example_running = true
|
15
22
|
end
|
16
23
|
|
17
24
|
def example_group_started(notification)
|
@@ -27,19 +34,44 @@ module RSpec
|
|
27
34
|
|
28
35
|
def example_passed(passed)
|
29
36
|
output.puts passed_output(passed.example)
|
37
|
+
|
38
|
+
flush_messages
|
39
|
+
@example_running = false
|
30
40
|
end
|
31
41
|
|
32
42
|
def example_pending(pending)
|
33
43
|
output.puts pending_output(pending.example,
|
34
44
|
pending.example.execution_result.pending_message)
|
45
|
+
|
46
|
+
flush_messages
|
47
|
+
@example_running = false
|
35
48
|
end
|
36
49
|
|
37
50
|
def example_failed(failure)
|
38
51
|
output.puts failure_output(failure.example)
|
52
|
+
|
53
|
+
flush_messages
|
54
|
+
@example_running = false
|
55
|
+
end
|
56
|
+
|
57
|
+
def message(notification)
|
58
|
+
if @example_running
|
59
|
+
@messages << notification.message
|
60
|
+
else
|
61
|
+
output.puts "#{current_indentation}#{notification.message}"
|
62
|
+
end
|
39
63
|
end
|
40
64
|
|
41
65
|
private
|
42
66
|
|
67
|
+
def flush_messages
|
68
|
+
@messages.each do |message|
|
69
|
+
output.puts "#{current_indentation(1)}#{message}"
|
70
|
+
end
|
71
|
+
|
72
|
+
@messages.clear
|
73
|
+
end
|
74
|
+
|
43
75
|
def passed_output(example)
|
44
76
|
ConsoleCodes.wrap("#{current_indentation}#{example.description.strip}", :success)
|
45
77
|
end
|
@@ -61,8 +93,8 @@ module RSpec
|
|
61
93
|
@next_failure_index += 1
|
62
94
|
end
|
63
95
|
|
64
|
-
def current_indentation
|
65
|
-
' ' * @group_level
|
96
|
+
def current_indentation(offset=0)
|
97
|
+
' ' * (@group_level + offset)
|
66
98
|
end
|
67
99
|
end
|
68
100
|
end
|
@@ -0,0 +1,23 @@
|
|
1
|
+
RSpec::Support.require_rspec_core "formatters/base_formatter"
|
2
|
+
|
3
|
+
module RSpec
|
4
|
+
module Core
|
5
|
+
module Formatters
|
6
|
+
# @private
|
7
|
+
class FailureListFormatter < BaseFormatter
|
8
|
+
Formatters.register self, :example_failed, :dump_profile, :message
|
9
|
+
|
10
|
+
def example_failed(failure)
|
11
|
+
output.puts "#{failure.example.location}:#{failure.example.description}"
|
12
|
+
end
|
13
|
+
|
14
|
+
# Discard profile and messages
|
15
|
+
#
|
16
|
+
# These outputs are not really relevant in the context of this failure
|
17
|
+
# list formatter.
|
18
|
+
def dump_profile(_profile); end
|
19
|
+
def message(_message); end
|
20
|
+
end
|
21
|
+
end
|
22
|
+
end
|
23
|
+
end
|
data/lib/rspec/core/hooks.rb
CHANGED
@@ -60,7 +60,8 @@ module RSpec
|
|
60
60
|
# before(:example) # Declared in the current group.
|
61
61
|
#
|
62
62
|
# If more than one `before` is declared within any one scope, they are run
|
63
|
-
# in the order in which they are declared.
|
63
|
+
# in the order in which they are declared. Any `around` hooks will execute
|
64
|
+
# later than any `before` hook regardless of scope.
|
64
65
|
#
|
65
66
|
# ### Conditions
|
66
67
|
#
|
@@ -74,11 +75,11 @@ module RSpec
|
|
74
75
|
# end
|
75
76
|
# end
|
76
77
|
#
|
77
|
-
# describe Something, :authorized => true do
|
78
|
+
# RSpec.describe Something, :authorized => true do
|
78
79
|
# # The before hook will run in before each example in this group.
|
79
80
|
# end
|
80
81
|
#
|
81
|
-
# describe SomethingElse do
|
82
|
+
# RSpec.describe SomethingElse do
|
82
83
|
# it "does something", :authorized => true do
|
83
84
|
# # The before hook will run before this example.
|
84
85
|
# end
|
@@ -159,7 +160,7 @@ module RSpec
|
|
159
160
|
#
|
160
161
|
# @example before(:example) declared in an {ExampleGroup}
|
161
162
|
#
|
162
|
-
# describe Thing do
|
163
|
+
# RSpec.describe Thing do
|
163
164
|
# before(:example) do
|
164
165
|
# @thing = Thing.new
|
165
166
|
# end
|
@@ -171,7 +172,7 @@ module RSpec
|
|
171
172
|
#
|
172
173
|
# @example before(:context) declared in an {ExampleGroup}
|
173
174
|
#
|
174
|
-
# describe Parser do
|
175
|
+
# RSpec.describe Parser do
|
175
176
|
# before(:context) do
|
176
177
|
# File.open(file_to_parse, 'w') do |f|
|
177
178
|
# f.write <<-CONTENT
|
@@ -261,7 +262,8 @@ module RSpec
|
|
261
262
|
#
|
262
263
|
# This is the reverse of the order in which `before` hooks are run.
|
263
264
|
# Similarly, if more than one `after` is declared within any one scope,
|
264
|
-
# they are run in reverse order of that in which they are declared.
|
265
|
+
# they are run in reverse order of that in which they are declared. Also
|
266
|
+
# `around` hooks will all have run before any after hooks are invoked.
|
265
267
|
#
|
266
268
|
# @note The `:example` and `:context` scopes are also available as
|
267
269
|
# `:each` and `:all`, respectively. Use whichever you prefer.
|
@@ -329,6 +331,12 @@ module RSpec
|
|
329
331
|
# around(:example) {|ex| Database.transaction(&ex)}
|
330
332
|
# around(:example) {|ex| FakeFS(&ex)}
|
331
333
|
#
|
334
|
+
# ### Order
|
335
|
+
#
|
336
|
+
# All `around` hooks execute immediately surrounding an example, this means
|
337
|
+
# that all `before` hooks will have run and no `after` hooks will have run yet.
|
338
|
+
#
|
339
|
+
# They are not a synonym for `before`/`after`.
|
332
340
|
def around(*args, &block)
|
333
341
|
hooks.register :prepend, :around, *args, &block
|
334
342
|
end
|
@@ -10,7 +10,7 @@ module RSpec
|
|
10
10
|
# @note `subject` was contributed by Joe Ferris to support the one-liner
|
11
11
|
# syntax embraced by shoulda matchers:
|
12
12
|
#
|
13
|
-
# describe Widget do
|
13
|
+
# RSpec.describe Widget do
|
14
14
|
# it { is_expected.to validate_presence_of(:name) }
|
15
15
|
# # or
|
16
16
|
# it { should validate_presence_of(:name) }
|
@@ -23,7 +23,7 @@ module RSpec
|
|
23
23
|
# @example
|
24
24
|
#
|
25
25
|
# # Explicit declaration of subject.
|
26
|
-
# describe Person do
|
26
|
+
# RSpec.describe Person do
|
27
27
|
# subject { Person.new(:birthdate => 19.years.ago) }
|
28
28
|
# it "should be eligible to vote" do
|
29
29
|
# subject.should be_eligible_to_vote
|
@@ -32,7 +32,7 @@ module RSpec
|
|
32
32
|
# end
|
33
33
|
#
|
34
34
|
# # Implicit subject => { Person.new }.
|
35
|
-
# describe Person do
|
35
|
+
# RSpec.describe Person do
|
36
36
|
# it "should be eligible to vote" do
|
37
37
|
# subject.should be_eligible_to_vote
|
38
38
|
# # ^ ^ explicit reference to subject not recommended
|
@@ -40,7 +40,7 @@ module RSpec
|
|
40
40
|
# end
|
41
41
|
#
|
42
42
|
# # One-liner syntax - expectation is set on the subject.
|
43
|
-
# describe Person do
|
43
|
+
# RSpec.describe Person do
|
44
44
|
# it { is_expected.to be_eligible_to_vote }
|
45
45
|
# # or
|
46
46
|
# it { should be_eligible_to_vote }
|
@@ -67,7 +67,7 @@ module RSpec
|
|
67
67
|
#
|
68
68
|
# @example
|
69
69
|
#
|
70
|
-
# describe Person do
|
70
|
+
# RSpec.describe Person do
|
71
71
|
# it { should be_eligible_to_vote }
|
72
72
|
# end
|
73
73
|
#
|
@@ -86,7 +86,7 @@ module RSpec
|
|
86
86
|
#
|
87
87
|
# @example
|
88
88
|
#
|
89
|
-
# describe Person do
|
89
|
+
# RSpec.describe Person do
|
90
90
|
# it { should_not be_eligible_to_vote }
|
91
91
|
# end
|
92
92
|
#
|
@@ -270,7 +270,7 @@ EOS
|
|
270
270
|
#
|
271
271
|
# @example
|
272
272
|
#
|
273
|
-
# describe Thing do
|
273
|
+
# RSpec.describe Thing do
|
274
274
|
# let(:thing) { Thing.new }
|
275
275
|
#
|
276
276
|
# it "does something" do
|
@@ -342,7 +342,7 @@ EOS
|
|
342
342
|
# end
|
343
343
|
# end
|
344
344
|
#
|
345
|
-
# describe Thing do
|
345
|
+
# RSpec.describe Thing do
|
346
346
|
# after(:example) { Thing.reset_count }
|
347
347
|
#
|
348
348
|
# context "using let" do
|
@@ -398,13 +398,13 @@ EOS
|
|
398
398
|
#
|
399
399
|
# @example
|
400
400
|
#
|
401
|
-
# describe CheckingAccount, "with $50" do
|
401
|
+
# RSpec.describe CheckingAccount, "with $50" do
|
402
402
|
# subject { CheckingAccount.new(Money.new(50, :USD)) }
|
403
403
|
# it { is_expected.to have_a_balance_of(Money.new(50, :USD)) }
|
404
404
|
# it { is_expected.not_to be_overdrawn }
|
405
405
|
# end
|
406
406
|
#
|
407
|
-
# describe CheckingAccount, "with a non-zero starting balance" do
|
407
|
+
# RSpec.describe CheckingAccount, "with a non-zero starting balance" do
|
408
408
|
# subject(:account) { CheckingAccount.new(Money.new(50, :USD)) }
|
409
409
|
# it { is_expected.not_to be_overdrawn }
|
410
410
|
# it "has a balance equal to the starting balance" do
|
@@ -452,7 +452,7 @@ EOS
|
|
452
452
|
# end
|
453
453
|
# end
|
454
454
|
#
|
455
|
-
# describe Thing do
|
455
|
+
# RSpec.describe Thing do
|
456
456
|
# after(:example) { Thing.reset_count }
|
457
457
|
#
|
458
458
|
# context "using subject" do
|
data/lib/rspec/core/metadata.rb
CHANGED
@@ -7,7 +7,7 @@ module RSpec
|
|
7
7
|
# In addition to metadata that is used internally, this also stores
|
8
8
|
# user-supplied metadata, e.g.
|
9
9
|
#
|
10
|
-
# describe Something, :type => :ui do
|
10
|
+
# RSpec.describe Something, :type => :ui do
|
11
11
|
# it "does something", :slow => true do
|
12
12
|
# # ...
|
13
13
|
# end
|
@@ -37,6 +37,7 @@ module RSpec::Core
|
|
37
37
|
# rubocop:disable Metrics/AbcSize
|
38
38
|
# rubocop:disable CyclomaticComplexity
|
39
39
|
# rubocop:disable PerceivedComplexity
|
40
|
+
# rubocop:disable Metrics/BlockLength
|
40
41
|
def parser(options)
|
41
42
|
OptionParser.new do |parser|
|
42
43
|
parser.summary_width = 34
|
@@ -111,6 +112,7 @@ module RSpec::Core
|
|
111
112
|
' [d]ocumentation (group and example names)',
|
112
113
|
' [h]tml',
|
113
114
|
' [j]son',
|
115
|
+
' [f]ailures ("file:line:reason", suitable for editors integration)',
|
114
116
|
' custom formatter class name') do |o|
|
115
117
|
options[:formatters] ||= []
|
116
118
|
options[:formatters] << [o]
|
@@ -226,6 +228,11 @@ FILTERING
|
|
226
228
|
(options[:full_description] ||= []) << Regexp.compile(Regexp.escape(o))
|
227
229
|
end
|
228
230
|
|
231
|
+
parser.on('-E', '--example-matches REGEX', "Run examples whose full nested names match REGEX (may be",
|
232
|
+
" used more than once)") do |o|
|
233
|
+
(options[:full_description] ||= []) << Regexp.compile(o)
|
234
|
+
end
|
235
|
+
|
229
236
|
parser.on('-t', '--tag TAG[:VALUE]',
|
230
237
|
'Run examples with the specified tag, or exclude examples',
|
231
238
|
'by adding ~ before the tag.',
|
@@ -288,6 +295,7 @@ FILTERING
|
|
288
295
|
end
|
289
296
|
end
|
290
297
|
end
|
298
|
+
# rubocop:enable Metrics/BlockLength
|
291
299
|
# rubocop:enable Metrics/AbcSize
|
292
300
|
# rubocop:enable MethodLength
|
293
301
|
# rubocop:enable CyclomaticComplexity
|
data/lib/rspec/core/rake_task.rb
CHANGED
@@ -45,6 +45,21 @@ module RSpec
|
|
45
45
|
# A message to print to stderr when there are failures.
|
46
46
|
attr_accessor :failure_message
|
47
47
|
|
48
|
+
if RUBY_VERSION < "1.9.0" || Support::Ruby.jruby?
|
49
|
+
# Run RSpec with a clean (empty) environment is not supported
|
50
|
+
def with_clean_environment=(_value)
|
51
|
+
raise ArgumentError, "Running in a clean environment is not supported on Ruby versions before 1.9.0"
|
52
|
+
end
|
53
|
+
|
54
|
+
# Run RSpec with a clean (empty) environment is not supported
|
55
|
+
def with_clean_environment
|
56
|
+
false
|
57
|
+
end
|
58
|
+
else
|
59
|
+
# Run RSpec with a clean (empty) environment.
|
60
|
+
attr_accessor :with_clean_environment
|
61
|
+
end
|
62
|
+
|
48
63
|
# Use verbose output. If this is set to true, the task will print the
|
49
64
|
# executed spec command to stdout. Defaults to `true`.
|
50
65
|
attr_accessor :verbose
|
@@ -76,7 +91,12 @@ module RSpec
|
|
76
91
|
command = spec_command
|
77
92
|
puts command if verbose
|
78
93
|
|
79
|
-
|
94
|
+
if with_clean_environment
|
95
|
+
return if system({}, command, :unsetenv_others => true)
|
96
|
+
else
|
97
|
+
return if system(command)
|
98
|
+
end
|
99
|
+
|
80
100
|
puts failure_message if failure_message
|
81
101
|
|
82
102
|
return unless fail_on_error
|
data/lib/rspec/core/reporter.rb
CHANGED
@@ -77,6 +77,14 @@ module RSpec::Core
|
|
77
77
|
end
|
78
78
|
end
|
79
79
|
|
80
|
+
# @param exit_code [Integer] the exit_code to be return by the reporter
|
81
|
+
#
|
82
|
+
# Reports a run that exited early without having run any examples.
|
83
|
+
#
|
84
|
+
def exit_early(exit_code)
|
85
|
+
report(0) { exit_code }
|
86
|
+
end
|
87
|
+
|
80
88
|
# @private
|
81
89
|
def start(expected_example_count, time=RSpec::Core::Time.now)
|
82
90
|
@start = time
|
data/lib/rspec/core/runner.rb
CHANGED
@@ -84,6 +84,8 @@ module RSpec
|
|
84
84
|
# @param out [IO] output stream
|
85
85
|
def run(err, out)
|
86
86
|
setup(err, out)
|
87
|
+
return @configuration.reporter.exit_early(@configuration.failure_exit_code) if RSpec.world.wants_to_quit
|
88
|
+
|
87
89
|
run_specs(@world.ordered_example_groups).tap do
|
88
90
|
persist_example_statuses
|
89
91
|
end
|
@@ -95,7 +97,10 @@ module RSpec
|
|
95
97
|
# @param out [IO] output stream
|
96
98
|
def setup(err, out)
|
97
99
|
configure(err, out)
|
100
|
+
return if RSpec.world.wants_to_quit
|
101
|
+
|
98
102
|
@configuration.load_spec_files
|
103
|
+
ensure
|
99
104
|
@world.announce_filters
|
100
105
|
end
|
101
106
|
|
data/lib/rspec/core/version.rb
CHANGED
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.9.0
|
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: 2019-
|
49
|
+
date: 2019-10-07 00:00:00.000000000 Z
|
50
50
|
dependencies:
|
51
51
|
- !ruby/object:Gem::Dependency
|
52
52
|
name: rspec-support
|
@@ -54,14 +54,14 @@ dependencies:
|
|
54
54
|
requirements:
|
55
55
|
- - "~>"
|
56
56
|
- !ruby/object:Gem::Version
|
57
|
-
version: 3.
|
57
|
+
version: 3.9.0
|
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.9.0
|
65
65
|
- !ruby/object:Gem::Dependency
|
66
66
|
name: cucumber
|
67
67
|
requirement: !ruby/object:Gem::Requirement
|
@@ -96,14 +96,14 @@ dependencies:
|
|
96
96
|
requirements:
|
97
97
|
- - "~>"
|
98
98
|
- !ruby/object:Gem::Version
|
99
|
-
version: 0.
|
99
|
+
version: 0.14.9
|
100
100
|
type: :development
|
101
101
|
prerelease: false
|
102
102
|
version_requirements: !ruby/object:Gem::Requirement
|
103
103
|
requirements:
|
104
104
|
- - "~>"
|
105
105
|
- !ruby/object:Gem::Version
|
106
|
-
version: 0.
|
106
|
+
version: 0.14.9
|
107
107
|
- !ruby/object:Gem::Dependency
|
108
108
|
name: coderay
|
109
109
|
requirement: !ruby/object:Gem::Requirement
|
@@ -199,6 +199,7 @@ files:
|
|
199
199
|
- lib/rspec/core/bisect/utilities.rb
|
200
200
|
- lib/rspec/core/configuration.rb
|
201
201
|
- lib/rspec/core/configuration_options.rb
|
202
|
+
- lib/rspec/core/did_you_mean.rb
|
202
203
|
- lib/rspec/core/drb.rb
|
203
204
|
- lib/rspec/core/dsl.rb
|
204
205
|
- lib/rspec/core/example.rb
|
@@ -216,6 +217,7 @@ files:
|
|
216
217
|
- lib/rspec/core/formatters/deprecation_formatter.rb
|
217
218
|
- lib/rspec/core/formatters/documentation_formatter.rb
|
218
219
|
- lib/rspec/core/formatters/exception_presenter.rb
|
220
|
+
- lib/rspec/core/formatters/failure_list_formatter.rb
|
219
221
|
- lib/rspec/core/formatters/fallback_message_formatter.rb
|
220
222
|
- lib/rspec/core/formatters/helpers.rb
|
221
223
|
- lib/rspec/core/formatters/html_formatter.rb
|
@@ -265,7 +267,7 @@ licenses:
|
|
265
267
|
- MIT
|
266
268
|
metadata:
|
267
269
|
bug_tracker_uri: https://github.com/rspec/rspec-core/issues
|
268
|
-
changelog_uri: https://github.com/rspec/rspec-core/blob/v3.
|
270
|
+
changelog_uri: https://github.com/rspec/rspec-core/blob/v3.9.0/Changelog.md
|
269
271
|
documentation_uri: https://rspec.info/documentation/
|
270
272
|
mailing_list_uri: https://groups.google.com/forum/#!forum/rspec
|
271
273
|
source_code_uri: https://github.com/rspec/rspec-core
|
@@ -285,8 +287,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
285
287
|
- !ruby/object:Gem::Version
|
286
288
|
version: '0'
|
287
289
|
requirements: []
|
288
|
-
rubygems_version: 3.0.
|
290
|
+
rubygems_version: 3.0.6
|
289
291
|
signing_key:
|
290
292
|
specification_version: 4
|
291
|
-
summary: rspec-core-3.
|
293
|
+
summary: rspec-core-3.9.0
|
292
294
|
test_files: []
|
metadata.gz.sig
CHANGED
Binary file
|