rspec-core 3.0.1 → 3.0.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
  SHA1:
3
- metadata.gz: 3092c05455e9d13f8b3210dbd2639f924247d702
4
- data.tar.gz: 4bce575854d38e0b31caa77ca2d7556a6f0a8158
3
+ metadata.gz: c5447ecf782b107af7573626ade27fdf62fb0307
4
+ data.tar.gz: ca82f9eb6c9f35b3c0b59c104eeb34752320cab2
5
5
  SHA512:
6
- metadata.gz: fcb2fe193cfd0fa78a4165457be57c998bb18626568bbe47744af259d86e75ee2312285eabbf7a0ee734b7ea94461e06a8fcf7412247c9dd78e9341eaf613a68
7
- data.tar.gz: 1928429c6a01daf9e6b6ed9e30a0308e03590868ff7131b61c9d316dc12ed0a65544818bb99f80e2ae9a78a787d2ca92d2d5a07c278c611c4b2302bcce101064
6
+ metadata.gz: 2452515ed3b91a42b6afda517a914819e73c6fbfce3e8cc724ca7067388e9f75318cf62a1ca7787529d5cec8c8c0d7441ebe3f475fd5f64ebfa7c29db2d88b24
7
+ data.tar.gz: d4de137f453c1188858c4e5a77a208182f24f7dce0241f04691217082aaf601fc88faacdfcb5fbbb5ab4470fbfd51bf197fa995a85e069629011b2b12039acd4
Binary file
data.tar.gz.sig CHANGED
@@ -1 +1 @@
1
- yar򊨡s���lL8<���^� W��*2V�9l�^��t��MB�� ��:�}z��%����a?�\���i�v~�"P�B-{oi�\@x������?��R��*5Œ L��R��3~��� Nj��������-.`���uq��Vd�6VSy��Ç��0�� ���D'��['!6�ѳ�{�
1
+ _@�+�חb4ұTi��;Y� n��� �&��w��v08�:RĦxOAC��_tb4�_��-9�{�9t���R��iS}�ע|4�՟�v]׻��j����|D/kFWyK:� }F��Y�B���!�x5�۸g [i��uG��ۚH5e
@@ -1,3 +1,19 @@
1
+ ### 3.0.2 / 2014-06-19
2
+ [Full Changelog](http://github.com/rspec/rspec-core/compare/v3.0.1...v3.0.2)
3
+
4
+ Bug Fixes:
5
+
6
+ * Fix regression in CLI option handling that prevented `--tag slow`
7
+ passed at the command line from overriding `--tag ~slow` in `.rspec`.
8
+ (Colin Jones, #1602)
9
+ * Fix metadata `:example_group` deprecation warning so that it gets
10
+ issued at the call site of the configuration that specified it as
11
+ a filter rather than later when an example group is defined.
12
+ (Myron Marston, #1562)
13
+ * Make the line that is printed when a shared example group fails indicating
14
+ where the concrete example group is white, separating it from the stack trace
15
+ that is produced for the failure. (Sam Phippen, Jon Rowe, #1606)
16
+
1
17
  ### 3.0.1 / 2014-06-12
2
18
  [Full Changelog](http://github.com/rspec/rspec-core/compare/v3.0.0...v3.0.1)
3
19
 
@@ -275,7 +291,7 @@ Bug Fixes:
275
291
  or `default_path`. (Matijs van Zuijlen)
276
292
 
277
293
  ### 3.0.0.beta1 / 2013-11-07
278
- [Full Changelog](http://github.com/rspec/rspec-core/compare/v2.99.0...v3.0.0.beta1)
294
+ [Full Changelog](http://github.com/rspec/rspec-core/compare/v2.99.1...v3.0.0.beta1)
279
295
 
280
296
  Breaking Changes for 3.0.0:
281
297
 
@@ -346,6 +362,20 @@ Deprecations:
346
362
  longer has an affect now that the behavior it enabled is always
347
363
  enabled. (Myron Marston)
348
364
 
365
+ ### 2.99.1 / 2014-06-19
366
+ [Full Changelog](http://github.com/rspec/rspec-core/compare/v2.99.0...v2.99.1)
367
+
368
+ Bug Fixes:
369
+
370
+ * Add missing deprecation warning for when `RSpec::Core::Runner` is used
371
+ multiple times in the same process. In 2.x RSpec's global state was
372
+ automatically cleared between runs but in 3.0 you need to call `RSpec.reset`
373
+ manually in these situations. (Sam Phippen, #1587)
374
+ * Prevent deprecation being accidentally issues when doubles used with `be_`
375
+ matchers due to automatically generated descriptions. (Jon Rowe, #1573)
376
+ * Load `rspec/core` when loading `rspec/core/rake_task` to ensure we can
377
+ issue deprecations correctly. (Jon Rowe, #1612)
378
+
349
379
  ### 2.99.0 / 2014-06-01
350
380
  [Full Changelog](http://github.com/rspec/rspec-core/compare/v2.99.0.rc1...v2.99.0)
351
381
 
@@ -850,7 +850,8 @@ module RSpec
850
850
  #
851
851
  # filter_run_including :foo # same as filter_run_including :foo => true
852
852
  def filter_run_including(*args)
853
- filter_manager.include_with_low_priority Metadata.build_hash_from(args)
853
+ meta = Metadata.build_hash_from(args, :warn_about_example_group_filtering)
854
+ filter_manager.include_with_low_priority meta
854
855
  end
855
856
 
856
857
  alias_method :filter_run, :filter_run_including
@@ -863,7 +864,8 @@ module RSpec
863
864
  # This overrides any inclusion filters/tags set on the command line or in
864
865
  # configuration files.
865
866
  def inclusion_filter=(filter)
866
- filter_manager.include_only Metadata.build_hash_from([filter])
867
+ meta = Metadata.build_hash_from([filter], :warn_about_example_group_filtering)
868
+ filter_manager.include_only meta
867
869
  end
868
870
 
869
871
  alias_method :filter=, :inclusion_filter=
@@ -906,7 +908,8 @@ module RSpec
906
908
  #
907
909
  # filter_run_excluding :foo # same as filter_run_excluding :foo => true
908
910
  def filter_run_excluding(*args)
909
- filter_manager.exclude_with_low_priority Metadata.build_hash_from(args)
911
+ meta = Metadata.build_hash_from(args, :warn_about_example_group_filtering)
912
+ filter_manager.exclude_with_low_priority meta
910
913
  end
911
914
 
912
915
  # Clears and reassigns the `exclusion_filter`. Set to `nil` if you don't
@@ -917,7 +920,8 @@ module RSpec
917
920
  # This overrides any exclusion filters/tags set on the command line or in
918
921
  # configuration files.
919
922
  def exclusion_filter=(filter)
920
- filter_manager.exclude_only Metadata.build_hash_from([filter])
923
+ meta = Metadata.build_hash_from([filter], :warn_about_example_group_filtering)
924
+ filter_manager.exclude_only meta
921
925
  end
922
926
 
923
927
  # Returns the `exclusion_filter`. If none has been set, returns an empty
@@ -959,7 +963,8 @@ module RSpec
959
963
  #
960
964
  # @see #extend
961
965
  def include(mod, *filters)
962
- include_or_extend_modules << [:include, mod, Metadata.build_hash_from(filters)]
966
+ meta = Metadata.build_hash_from(filters, :warn_about_example_group_filtering)
967
+ include_or_extend_modules << [:include, mod, meta]
963
968
  end
964
969
 
965
970
  # Tells RSpec to extend example groups with `mod`. Methods defined in
@@ -992,7 +997,8 @@ module RSpec
992
997
  #
993
998
  # @see #include
994
999
  def extend(mod, *filters)
995
- include_or_extend_modules << [:extend, mod, Metadata.build_hash_from(filters)]
1000
+ meta = Metadata.build_hash_from(filters, :warn_about_example_group_filtering)
1001
+ include_or_extend_modules << [:extend, mod, meta]
996
1002
  end
997
1003
 
998
1004
  # @private
@@ -1255,7 +1261,8 @@ module RSpec
1255
1261
  # end
1256
1262
  # end
1257
1263
  def define_derived_metadata(*filters, &block)
1258
- @derived_metadata_blocks << [Metadata.build_hash_from(filters), block]
1264
+ meta = Metadata.build_hash_from(filters, :warn_about_example_group_filtering)
1265
+ @derived_metadata_blocks << [meta, block]
1259
1266
  end
1260
1267
 
1261
1268
  # @private
@@ -28,8 +28,9 @@ module RSpec
28
28
  # Updates the provided {FilterManager} based on the filter options.
29
29
  # @param filter_manager [FilterManager] instance to update
30
30
  def configure_filter_manager(filter_manager)
31
- @filter_manager_inclusions.each { |val| filter_manager.include(val) }
32
- @filter_manager_exclusions.each { |val| filter_manager.exclude(val) }
31
+ @filter_manager_options.each do |command, value|
32
+ filter_manager.__send__ command, value
33
+ end
33
34
  end
34
35
 
35
36
  # @return [Hash] the final merged options, drawn from all external sources
@@ -38,12 +39,11 @@ module RSpec
38
39
  private
39
40
 
40
41
  def organize_options
41
- @filter_manager_inclusions = []
42
- @filter_manager_exclusions = []
42
+ @filter_manager_options = []
43
43
 
44
44
  @options = (file_options << command_line_options << env_options).each { |opts|
45
- @filter_manager_inclusions << opts.delete(:inclusion_filter) if opts.key?(:inclusion_filter)
46
- @filter_manager_exclusions << opts.delete(:exclusion_filter) if opts.key?(:exclusion_filter)
45
+ @filter_manager_options << [:include, opts.delete(:inclusion_filter)] if opts.key?(:inclusion_filter)
46
+ @filter_manager_options << [:exclude, opts.delete(:exclusion_filter)] if opts.key?(:exclusion_filter)
47
47
  }.inject(:libs => [], :requires => []) { |hash, opts|
48
48
  hash.merge(opts) { |key, oldval, newval|
49
49
  [:libs, :requires].include?(key) ? oldval + newval : newval
@@ -508,7 +508,9 @@ EOS
508
508
  end
509
509
 
510
510
  def scope_and_options_from(*args)
511
- return extract_scope_from(args), Metadata.build_hash_from(args)
511
+ scope = extract_scope_from(args)
512
+ meta = Metadata.build_hash_from(args, :warn_about_example_group_filtering)
513
+ return scope, meta
512
514
  end
513
515
 
514
516
  def extract_scope_from(args)
@@ -43,13 +43,18 @@ module RSpec
43
43
  # Symbols are converted into hash keys with a value of `true`.
44
44
  # This is done to support simple tagging using a symbol, rather
45
45
  # than needing to do `:symbol => true`.
46
- def self.build_hash_from(args)
46
+ def self.build_hash_from(args, warn_about_example_group_filtering=false)
47
47
  hash = args.last.is_a?(Hash) ? args.pop : {}
48
48
 
49
49
  while args.last.is_a?(Symbol)
50
50
  hash[args.pop] = true
51
51
  end
52
52
 
53
+ if warn_about_example_group_filtering && hash.key?(:example_group)
54
+ RSpec.deprecate("Filtering by an `:example_group` subhash",
55
+ :replacement => "the subhash to filter directly")
56
+ end
57
+
53
58
  hash
54
59
  end
55
60
 
@@ -200,10 +205,23 @@ module RSpec
200
205
  Proc.new do |hash, key|
201
206
  case key
202
207
  when :example_group
203
- RSpec.deprecate("The `:example_group` key in an example group's metadata hash",
204
- :replacement => "the example group's hash directly for the " +
205
- "computed keys and `:parent_example_group` to access the parent " +
206
- "example group metadata")
208
+ # We commonly get here when rspec-core is applying a previously configured
209
+ # filter rule, such as when a gem configures:
210
+ #
211
+ # RSpec.configure do |c|
212
+ # c.include MyGemHelpers, :example_group => { :file_path => /spec\/my_gem_specs/ }
213
+ # end
214
+ #
215
+ # It's confusing for a user to get a deprecation at this point in the code, so instead
216
+ # we issue a deprecation from the config APIs that take a metadata hash, and MetadataFilter
217
+ # sets this thread local to silence the warning here since it would be so confusing.
218
+ unless RSpec.thread_local_metadata[:silence_metadata_example_group_deprecations]
219
+ RSpec.deprecate("The `:example_group` key in an example group's metadata hash",
220
+ :replacement => "the example group's hash directly for the " +
221
+ "computed keys and `:parent_example_group` to access the parent " +
222
+ "example group metadata")
223
+ end
224
+
207
225
  group_hash = example_group_selector.call(hash)
208
226
  LegacyExampleGroupHash.new(group_hash) if group_hash
209
227
  when :example_group_block
@@ -20,23 +20,25 @@ module RSpec
20
20
 
21
21
  # @private
22
22
  def filter_applies?(key, value, metadata)
23
- return filter_applies_to_any_value?(key, value, metadata) if Array === metadata[key] && !(Proc === value)
24
- return location_filter_applies?(value, metadata) if key == :locations
25
- return filters_apply?(key, value, metadata) if Hash === value
23
+ silence_metadata_example_group_deprecations do
24
+ return filter_applies_to_any_value?(key, value, metadata) if Array === metadata[key] && !(Proc === value)
25
+ return location_filter_applies?(value, metadata) if key == :locations
26
+ return filters_apply?(key, value, metadata) if Hash === value
26
27
 
27
- return false unless metadata.has_key?(key)
28
+ return false unless metadata.has_key?(key)
28
29
 
29
- case value
30
- when Regexp
31
- metadata[key] =~ value
32
- when Proc
33
- case value.arity
34
- when 0 then value.call
35
- when 2 then value.call(metadata[key], metadata)
36
- else value.call(metadata[key])
30
+ case value
31
+ when Regexp
32
+ metadata[key] =~ value
33
+ when Proc
34
+ case value.arity
35
+ when 0 then value.call
36
+ when 2 then value.call(metadata[key], metadata)
37
+ else value.call(metadata[key])
38
+ end
39
+ else
40
+ metadata[key].to_s == value.to_s
37
41
  end
38
- else
39
- metadata[key].to_s == value.to_s
40
42
  end
41
43
  end
42
44
 
@@ -81,6 +83,13 @@ module RSpec
81
83
  metadata[:parent_example_group]
82
84
  end
83
85
  end
86
+
87
+ def silence_metadata_example_group_deprecations
88
+ RSpec.thread_local_metadata[:silence_metadata_example_group_deprecations] = true
89
+ yield
90
+ ensure
91
+ RSpec.thread_local_metadata.delete(:silence_metadata_example_group_deprecations)
92
+ end
84
93
  end
85
94
  end
86
95
  end
@@ -5,6 +5,13 @@ module RSpec::Core
5
5
  # with information about a particular event of interest.
6
6
  module Notifications
7
7
 
8
+ # @private
9
+ class NullColorizer
10
+ def wrap(line)
11
+ line
12
+ end
13
+ end
14
+
8
15
  # The `StartNotification` represents a notification sent by the reporter
9
16
  # when the suite is started. It contains the expected amount of examples
10
17
  # to be executed, and the load time of RSpec.
@@ -147,19 +154,7 @@ module RSpec::Core
147
154
  #
148
155
  # @return [Array(String)] The example failure message
149
156
  def message_lines
150
- @lines ||=
151
- begin
152
- lines = ["Failure/Error: #{read_failed_line.strip}"]
153
- lines << "#{exception_class_name}:" unless exception_class_name =~ /RSpec/
154
- exception.message.to_s.split("\n").each do |line|
155
- lines << " #{line}" if exception.message
156
- end
157
- if shared_group
158
- lines << "Shared Example Group: \"#{shared_group.metadata[:shared_group_name]}\"" +
159
- " called from #{backtrace_formatter.backtrace_line(shared_group.location)}"
160
- end
161
- lines
162
- end
157
+ add_shared_group_line(failure_lines, NullColorizer)
163
158
  end
164
159
 
165
160
  # Returns the message generated for this failure colorized line by line.
@@ -167,7 +162,7 @@ module RSpec::Core
167
162
  # @param colorizer [#wrap] An object to colorize the message_lines by
168
163
  # @return [Array(String)] The example failure message colorized
169
164
  def colorized_message_lines(colorizer = ::RSpec::Core::Formatters::ConsoleCodes)
170
- message_lines.map do |line|
165
+ add_shared_group_line(failure_lines, colorizer).map do |line|
171
166
  colorizer.wrap line, RSpec.configuration.failure_color
172
167
  end
173
168
  end
@@ -217,10 +212,39 @@ module RSpec::Core
217
212
  name
218
213
  end
219
214
 
215
+ def failure_lines
216
+ @failure_lines ||=
217
+ begin
218
+ lines = ["Failure/Error: #{read_failed_line.strip}"]
219
+ lines << "#{exception_class_name}:" unless exception_class_name =~ /RSpec/
220
+ exception.message.to_s.split("\n").each do |line|
221
+ lines << " #{line}" if exception.message
222
+ end
223
+ lines
224
+ end
225
+ end
226
+
227
+ def add_shared_group_line(lines, colorizer)
228
+ unless shared_group_line == ""
229
+ lines << colorizer.wrap(shared_group_line, RSpec.configuration.default_color)
230
+ end
231
+ lines
232
+ end
233
+
220
234
  def shared_group
221
235
  @shared_group ||= group_and_parent_groups.find { |group| group.metadata[:shared_group_name] }
222
236
  end
223
237
 
238
+ def shared_group_line
239
+ @shared_group_line ||=
240
+ if shared_group
241
+ "Shared Example Group: \"#{shared_group.metadata[:shared_group_name]}\"" +
242
+ " called from #{backtrace_formatter.backtrace_line(shared_group.location)}"
243
+ else
244
+ ""
245
+ end
246
+ end
247
+
224
248
  def group_and_parent_groups
225
249
  example.example_group.parent_groups + [example.example_group]
226
250
  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.0.1'
6
+ STRING = '3.0.2'
7
7
  end
8
8
  end
9
9
  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.0.1
4
+ version: 3.0.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Steven Baker
@@ -34,7 +34,7 @@ cert_chain:
34
34
  1yHC1AcSYpvi2dAbOiHT5iQF+krm4wse8KctXgTNnjMsHEoGKulJS2/sZl90jcCz
35
35
  muA=
36
36
  -----END CERTIFICATE-----
37
- date: 2014-06-12 00:00:00.000000000 Z
37
+ date: 2014-06-20 00:00:00.000000000 Z
38
38
  dependencies:
39
39
  - !ruby/object:Gem::Dependency
40
40
  name: rspec-support
@@ -265,6 +265,6 @@ rubyforge_project: rspec
265
265
  rubygems_version: 2.2.2
266
266
  signing_key:
267
267
  specification_version: 4
268
- summary: rspec-core-3.0.1
268
+ summary: rspec-core-3.0.2
269
269
  test_files: []
270
270
  has_rdoc:
metadata.gz.sig CHANGED
Binary file