rspec-core 3.9.1 → 3.9.2

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: e615fddb7c885813e1b54224b96cdf2b724e9783cdd2a3fdf903fd9c561e6732
4
- data.tar.gz: '068b4c74b0af7a44ab360a165ed68e68dbe91defeeab8599cc21e453a3eaef9a'
3
+ metadata.gz: 2cc9f19659522abe89f981dabbc306e49bcdc46e4d4093e775ccfc1854a4423c
4
+ data.tar.gz: 972c6d305095d83813cea29b0aa13d67b7376ac02b4bc41833e9a1f7a3339dfc
5
5
  SHA512:
6
- metadata.gz: 7fca5bfb160e00d75814d0883cbace3f0653a19a44158800626c97a7da3965627262b0acf5db82af14a23b9cbb1325325352ba4c07b969fb0363aa0f40583e61
7
- data.tar.gz: 949a9748e7c22dac5f1ec8ec2c2ba1849feb096ffff6e856454d1685954c3106a16f0a458186306d12e7fc43f256b52cc63cd42fac76214ade893a28617f2b13
6
+ metadata.gz: ca5855df2623196df34c3de4edcfa634e83a3204b3b637a7358b488b92c0c71791512b3da22da8517ab898205b644438187e9fb81846284a1b679537697f05cb
7
+ data.tar.gz: 4abca9be9bb867bb3456b6b91ea0b16c8a665e2b4e89dcae0003e435a0e1e7995c63484af9eadbcfdf8454ff955a2b82a3acf180235d06a4f9cc402a5d6fde33
Binary file
data.tar.gz.sig CHANGED
Binary file
@@ -1,3 +1,18 @@
1
+ ### 3.9.2 / 2020-05-02
2
+ [Full Changelog](http://github.com/rspec/rspec-core/compare/v3.9.1...v3.9.2)
3
+
4
+ Bug Fixes:
5
+
6
+ * Emit a warning when `around` hook is used with `:context` scope
7
+ (Phil Pirozhkov, #2687)
8
+ * Prevent invalid implementations of `Exception#cause` from being treated as a
9
+ valid cause (and causing strange errors) in `RSpec::Core::Formatters::ExceptionPresenter`.
10
+ (Jon Rowe, #2703)
11
+ * Correctly detect patterns when `rspec_opts` is an array in `RSpec::Core::RakeTask`.
12
+ (Marc-André Lafortune, #2704)
13
+ * Make `RSpec.clear_examples` reset example counts for example groups. This fixes
14
+ an issue with re-running specs not matching ids. (Agis Anastasopoulos, #2723)
15
+
1
16
  ### 3.9.1 / 2019-12-28
2
17
  [Full Changelog](http://github.com/rspec/rspec-core/compare/v3.9.0...v3.9.1)
3
18
 
@@ -11,6 +26,7 @@ Bug Fixes:
11
26
  [Full Changelog](http://github.com/rspec/rspec-core/compare/v3.8.2...v3.9.0)
12
27
 
13
28
  Enhancements:
29
+
14
30
  * Improve the handling of errors during loading support files, if a file
15
31
  errors before loading specs, RSpec will now skip loading the specs.
16
32
  (David Rodríguez, #2568)
@@ -2128,6 +2144,7 @@ Bug fixes
2128
2144
  [Full Changelog](http://github.com/rspec/rspec-core/compare/v2.2.0...v2.2.1)
2129
2145
 
2130
2146
  Bug fixes
2147
+
2131
2148
  * alias_method instead of override Kernel#method_missing (John Wilger)
2132
2149
  * changed --autotest to --tty in generated command (MIKAMI Yoshiyuki)
2133
2150
  * revert change to debugger (had introduced conflict with Rails)
@@ -1350,6 +1350,12 @@ module RSpec
1350
1350
  # end
1351
1351
  # end
1352
1352
  #
1353
+ # module PreferencesHelpers
1354
+ # def preferences(user, preferences = {})
1355
+ # # ...
1356
+ # end
1357
+ # end
1358
+ #
1353
1359
  # module UserHelpers
1354
1360
  # def users(username)
1355
1361
  # # ...
@@ -1358,12 +1364,17 @@ module RSpec
1358
1364
  #
1359
1365
  # RSpec.configure do |config|
1360
1366
  # config.include(UserHelpers) # included in all groups
1367
+ #
1368
+ # # included in examples with `:preferences` metadata
1369
+ # config.include(PreferenceHelpers, :preferences)
1370
+ #
1371
+ # # included in examples with `:type => :request` metadata
1361
1372
  # config.include(AuthenticationHelpers, :type => :request)
1362
1373
  # end
1363
1374
  #
1364
- # describe "edit profile", :type => :request do
1375
+ # describe "edit profile", :preferences, :type => :request do
1365
1376
  # it "can be viewed by owning user" do
1366
- # login_as users(:jdoe)
1377
+ # login_as preferences(users(:jdoe), :lang => 'es')
1367
1378
  # get "/profiles/jdoe"
1368
1379
  # assert_select ".username", :text => 'jdoe'
1369
1380
  # end
@@ -1391,17 +1402,21 @@ module RSpec
1391
1402
  #
1392
1403
  # @example
1393
1404
  #
1394
- # RSpec.shared_context "example users" do
1405
+ # RSpec.shared_context "example admin user" do
1395
1406
  # let(:admin_user) { create_user(:admin) }
1407
+ # end
1408
+ #
1409
+ # RSpec.shared_context "example guest user" do
1396
1410
  # let(:guest_user) { create_user(:guest) }
1397
1411
  # end
1398
1412
  #
1399
1413
  # RSpec.configure do |config|
1400
- # config.include_context "example users", :type => :request
1414
+ # config.include_context "example guest user", :type => :request
1415
+ # config.include_context "example admin user", :admin, :type => :request
1401
1416
  # end
1402
1417
  #
1403
1418
  # RSpec.describe "The admin page", :type => :request do
1404
- # it "can be viewed by admins" do
1419
+ # it "can be viewed by admins", :admin do
1405
1420
  # login_with admin_user
1406
1421
  # get "/admin"
1407
1422
  # expect(response).to be_ok
@@ -1443,12 +1458,20 @@ module RSpec
1443
1458
  # end
1444
1459
  # end
1445
1460
  #
1461
+ # module PermissionHelpers
1462
+ # def define_permissions
1463
+ # # ...
1464
+ # end
1465
+ # end
1466
+ #
1446
1467
  # RSpec.configure do |config|
1447
1468
  # config.extend(UiHelpers, :type => :request)
1469
+ # config.extend(PermissionHelpers, :with_permissions, :type => :request)
1448
1470
  # end
1449
1471
  #
1450
- # describe "edit profile", :type => :request do
1472
+ # describe "edit profile", :with_permissions, :type => :request do
1451
1473
  # run_in_browser
1474
+ # define_permissions
1452
1475
  #
1453
1476
  # it "does stuff in the client" do
1454
1477
  # # ...
@@ -1906,7 +1929,8 @@ module RSpec
1906
1929
  #
1907
1930
  # This method differs from {Hooks#before} in only one way: it supports
1908
1931
  # the `:suite` scope. Hooks with the `:suite` scope will be run once before
1909
- # the first example of the entire suite is executed.
1932
+ # the first example of the entire suite is executed. Conditions passed along
1933
+ # with `:suite` are effectively ignored.
1910
1934
  #
1911
1935
  # @see #prepend_before
1912
1936
  # @see #after
@@ -1935,7 +1959,8 @@ module RSpec
1935
1959
  #
1936
1960
  # This method differs from {Hooks#prepend_before} in only one way: it supports
1937
1961
  # the `:suite` scope. Hooks with the `:suite` scope will be run once before
1938
- # the first example of the entire suite is executed.
1962
+ # the first example of the entire suite is executed. Conditions passed along
1963
+ # with `:suite` are effectively ignored.
1939
1964
  #
1940
1965
  # @see #before
1941
1966
  # @see #after
@@ -1959,7 +1984,8 @@ module RSpec
1959
1984
  #
1960
1985
  # This method differs from {Hooks#after} in only one way: it supports
1961
1986
  # the `:suite` scope. Hooks with the `:suite` scope will be run once after
1962
- # the last example of the entire suite is executed.
1987
+ # the last example of the entire suite is executed. Conditions passed along
1988
+ # with `:suite` are effectively ignored.
1963
1989
  #
1964
1990
  # @see #append_after
1965
1991
  # @see #before
@@ -1988,7 +2014,8 @@ module RSpec
1988
2014
  #
1989
2015
  # This method differs from {Hooks#append_after} in only one way: it supports
1990
2016
  # the `:suite` scope. Hooks with the `:suite` scope will be run once after
1991
- # the last example of the entire suite is executed.
2017
+ # the last example of the entire suite is executed. Conditions passed along
2018
+ # with `:suite` are effectively ignored.
1992
2019
  #
1993
2020
  # @see #append_after
1994
2021
  # @see #before
@@ -111,16 +111,14 @@ module RSpec
111
111
  # @overload $1
112
112
  # @overload $1(&example_implementation)
113
113
  # @param example_implementation [Block] The implementation of the example.
114
- # @overload $1(doc_string, *metadata_keys, metadata={})
114
+ # @overload $1(doc_string, *metadata)
115
115
  # @param doc_string [String] The example's doc string.
116
- # @param metadata [Hash] Metadata for the example.
117
- # @param metadata_keys [Array<Symbol>] Metadata tags for the example.
118
- # Will be transformed into hash entries with `true` values.
119
- # @overload $1(doc_string, *metadata_keys, metadata={}, &example_implementation)
116
+ # @param metadata [Array<Symbol>, Hash] Metadata for the example.
117
+ # Symbols will be transformed into hash entries with `true` values.
118
+ # @overload $1(doc_string, *metadata, &example_implementation)
120
119
  # @param doc_string [String] The example's doc string.
121
- # @param metadata [Hash] Metadata for the example.
122
- # @param metadata_keys [Array<Symbol>] Metadata tags for the example.
123
- # Will be transformed into hash entries with `true` values.
120
+ # @param metadata [Array<Symbol>, Hash] Metadata for the example.
121
+ # Symbols will be transformed into hash entries with `true` values.
124
122
  # @param example_implementation [Block] The implementation of the example.
125
123
  # @yield [Example] the example object
126
124
  # @example
@@ -139,6 +137,11 @@ module RSpec
139
137
  # $1 "does something" do |ex|
140
138
  # # ex is the Example object that contains metadata about the example
141
139
  # end
140
+ #
141
+ # @example
142
+ # $1 "does something", :slow, :load_factor => 100 do
143
+ # end
144
+ #
142
145
  def self.define_example_method(name, extra_options={})
143
146
  idempotently_define_singleton_method(name) do |*all_args, &block|
144
147
  desc, *args = *all_args
@@ -204,11 +207,10 @@ module RSpec
204
207
  # @overload $1
205
208
  # @overload $1(&example_group_definition)
206
209
  # @param example_group_definition [Block] The definition of the example group.
207
- # @overload $1(doc_string, *metadata_keys, metadata={}, &example_implementation)
210
+ # @overload $1(doc_string, *metadata, &example_implementation)
208
211
  # @param doc_string [String] The group's doc string.
209
- # @param metadata [Hash] Metadata for the group.
210
- # @param metadata_keys [Array<Symbol>] Metadata tags for the group.
211
- # Will be transformed into hash entries with `true` values.
212
+ # @param metadata [Array<Symbol>, Hash] Metadata for the group.
213
+ # Symbols will be transformed into hash entries with `true` values.
212
214
  # @param example_group_definition [Block] The definition of the example group.
213
215
  #
214
216
  # Generates a subclass of this example group which inherits
@@ -223,12 +225,21 @@ module RSpec
223
225
  # do_something_before
224
226
  # end
225
227
  #
228
+ # before(:example, :clean_env) do
229
+ # env.clear!
230
+ # end
231
+ #
226
232
  # let(:thing) { Thing.new }
227
233
  #
228
234
  # $1 "attribute (of something)" do
229
235
  # # examples in the group get the before hook
230
236
  # # declared above, and can access `thing`
231
237
  # end
238
+ #
239
+ # $1 "needs additional setup", :clean_env, :implementation => JSON do
240
+ # # specifies that hooks with matching metadata
241
+ # # should be be run additionally
242
+ # end
232
243
  # end
233
244
  #
234
245
  # @see DSL#describe
@@ -1,4 +1,5 @@
1
1
  RSpec::Support.require_rspec_support "directory_maker"
2
+
2
3
  # ## Built-in Formatters
3
4
  #
4
5
  # * progress (default) - Prints dots for passing examples, `F` for failures, `*`
@@ -43,7 +43,7 @@ module RSpec
43
43
 
44
44
  if RSpec::Support::RubyFeatures.supports_exception_cause?
45
45
  def formatted_cause(exception)
46
- last_cause = final_exception(exception)
46
+ last_cause = final_exception(exception, [exception])
47
47
  cause = []
48
48
 
49
49
  if exception.cause
@@ -55,7 +55,9 @@ module RSpec
55
55
  cause << " #{line}"
56
56
  end
57
57
 
58
- cause << (" #{backtrace_formatter.format_backtrace(last_cause.backtrace, example.metadata).first}")
58
+ unless last_cause.backtrace.empty?
59
+ cause << (" #{backtrace_formatter.format_backtrace(last_cause.backtrace, example.metadata).first}")
60
+ end
59
61
  end
60
62
 
61
63
  cause
@@ -96,7 +98,8 @@ module RSpec
96
98
 
97
99
  def final_exception(exception, previous=[])
98
100
  cause = exception.cause
99
- if cause && !previous.include?(cause)
101
+
102
+ if cause && Exception === cause && !previous.include?(cause)
100
103
  previous << cause
101
104
  final_exception(cause, previous)
102
105
  else
@@ -13,13 +13,14 @@ module RSpec
13
13
  # @overload before(scope, &block)
14
14
  # @param scope [Symbol] `:example`, `:context`, or `:suite`
15
15
  # (defaults to `:example`)
16
- # @overload before(scope, conditions, &block)
16
+ # @overload before(scope, *conditions, &block)
17
17
  # @param scope [Symbol] `:example`, `:context`, or `:suite`
18
18
  # (defaults to `:example`)
19
- # @param conditions [Hash]
20
- # constrains this hook to examples matching these conditions e.g.
19
+ # @param conditions [Array<Symbol>, Hash] constrains this hook to
20
+ # examples matching these conditions e.g.
21
21
  # `before(:example, :ui => true) { ... }` will only run with examples
22
- # or groups declared with `:ui => true`.
22
+ # or groups declared with `:ui => true`. Symbols will be transformed
23
+ # into hash entries with `true` values.
23
24
  # @overload before(conditions, &block)
24
25
  # @param conditions [Hash]
25
26
  # constrains this hook to examples matching these conditions e.g.
@@ -214,13 +215,14 @@ module RSpec
214
215
  # @overload after(scope, &block)
215
216
  # @param scope [Symbol] `:example`, `:context`, or `:suite` (defaults to
216
217
  # `:example`)
217
- # @overload after(scope, conditions, &block)
218
+ # @overload after(scope, *conditions, &block)
218
219
  # @param scope [Symbol] `:example`, `:context`, or `:suite` (defaults to
219
220
  # `:example`)
220
- # @param conditions [Hash]
221
- # constrains this hook to examples matching these conditions e.g.
221
+ # @param conditions [Array<Symbol>, Hash] constrains this hook to
222
+ # examples matching these conditions e.g.
222
223
  # `after(:example, :ui => true) { ... }` will only run with examples
223
- # or groups declared with `:ui => true`.
224
+ # or groups declared with `:ui => true`. Symbols will be transformed
225
+ # into hash entries with `true` values.
224
226
  # @overload after(conditions, &block)
225
227
  # @param conditions [Hash]
226
228
  # constrains this hook to examples matching these conditions e.g.
@@ -290,13 +292,15 @@ module RSpec
290
292
  # @param scope [Symbol] `:example` (defaults to `:example`)
291
293
  # present for syntax parity with `before` and `after`, but
292
294
  # `:example`/`:each` is the only supported value.
293
- # @overload around(scope, conditions, &block)
295
+ # @overload around(scope, *conditions, &block)
294
296
  # @param scope [Symbol] `:example` (defaults to `:example`)
295
297
  # present for syntax parity with `before` and `after`, but
296
298
  # `:example`/`:each` is the only supported value.
297
- # @param conditions [Hash] constrains this hook to examples matching
298
- # these conditions e.g. `around(:example, :ui => true) { ... }` will
299
- # only run with examples or groups declared with `:ui => true`.
299
+ # @param conditions [Array<Symbol>, Hash] constrains this hook to
300
+ # examples matching these conditions e.g.
301
+ # `around(:example, :ui => true) { ... }` will only run with examples
302
+ # or groups declared with `:ui => true`. Symbols will be transformed
303
+ # into hash entries with `true` values.
300
304
  # @overload around(conditions, &block)
301
305
  # @param conditions [Hash] constrains this hook to examples matching
302
306
  # these conditions e.g. `around(:example, :ui => true) { ... }` will
@@ -448,6 +452,11 @@ module RSpec
448
452
  "`#{position}(:suite)` hook, registered on an example " \
449
453
  "group, will be ignored."
450
454
  return
455
+ elsif scope == :context && position == :around
456
+ # TODO: consider making this an error in RSpec 4. For SemVer reasons,
457
+ # we are only warning in RSpec 3.
458
+ RSpec.warn_with "WARNING: `around(:context)` hooks are not supported and " \
459
+ "behave like `around(:example)."
451
460
  end
452
461
 
453
462
  hook = HOOK_TYPES[position][scope].new(block, options)
@@ -122,7 +122,7 @@ module RSpec
122
122
  if ENV['SPEC']
123
123
  FileList[ENV['SPEC']].sort
124
124
  elsif String === pattern && !File.exist?(pattern)
125
- return if rspec_opts =~ /--pattern/
125
+ return if [*rspec_opts].any? { |opt| opt =~ /--pattern/ }
126
126
  "--pattern #{escape pattern}"
127
127
  else
128
128
  # Before RSpec 3.1, we used `FileList` to get the list of matched
@@ -1,3 +1,5 @@
1
+ RSpec::Support.require_rspec_support "with_keywords_when_needed"
2
+
1
3
  module RSpec
2
4
  module Core
3
5
  # Represents some functionality that is shared with multiple example groups.
@@ -33,7 +35,7 @@ module RSpec
33
35
  klass.update_inherited_metadata(@metadata) unless @metadata.empty?
34
36
 
35
37
  SharedExampleGroupInclusionStackFrame.with_frame(@description, inclusion_line) do
36
- klass.class_exec(*args, &@definition)
38
+ RSpec::Support::WithKeywordsWhenNeeded.class_exec(klass, *args, &@definition)
37
39
  klass.class_exec(&customization_block) if customization_block
38
40
  end
39
41
  end
@@ -3,7 +3,7 @@ module RSpec
3
3
  # Version information for RSpec Core.
4
4
  module Version
5
5
  # Current version of RSpec Core, in semantic versioning format.
6
- STRING = '3.9.1'
6
+ STRING = '3.9.2'
7
7
  end
8
8
  end
9
9
  end
@@ -5,7 +5,7 @@ module RSpec
5
5
  # Internal container for global non-configuration data.
6
6
  class World
7
7
  # @private
8
- attr_reader :example_groups, :filtered_examples
8
+ attr_reader :example_groups, :filtered_examples, :example_group_counts_by_spec_file
9
9
 
10
10
  # Used internally to determine what to do when a SIGINT is received.
11
11
  attr_accessor :wants_to_quit
@@ -53,6 +53,7 @@ module RSpec
53
53
  example_groups.clear
54
54
  @sources_by_path.clear if defined?(@sources_by_path)
55
55
  @syntax_highlighter = nil
56
+ @example_group_counts_by_spec_file = Hash.new(0)
56
57
  end
57
58
 
58
59
  # @private
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.9.1
4
+ version: 3.9.2
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-12-28 00:00:00.000000000 Z
49
+ date: 2020-05-02 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.9.1
57
+ version: 3.9.3
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.9.1
64
+ version: 3.9.3
65
65
  - !ruby/object:Gem::Dependency
66
66
  name: cucumber
67
67
  requirement: !ruby/object:Gem::Requirement
@@ -267,7 +267,7 @@ licenses:
267
267
  - MIT
268
268
  metadata:
269
269
  bug_tracker_uri: https://github.com/rspec/rspec-core/issues
270
- changelog_uri: https://github.com/rspec/rspec-core/blob/v3.9.1/Changelog.md
270
+ changelog_uri: https://github.com/rspec/rspec-core/blob/v3.9.2/Changelog.md
271
271
  documentation_uri: https://rspec.info/documentation/
272
272
  mailing_list_uri: https://groups.google.com/forum/#!forum/rspec
273
273
  source_code_uri: https://github.com/rspec/rspec-core
@@ -290,5 +290,5 @@ requirements: []
290
290
  rubygems_version: 3.1.2
291
291
  signing_key:
292
292
  specification_version: 4
293
- summary: rspec-core-3.9.1
293
+ summary: rspec-core-3.9.2
294
294
  test_files: []
metadata.gz.sig CHANGED
Binary file