rspec-core 3.4.4 → 3.5.0.beta1

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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 80afd0a6f2838eb53ebb2217151c1fb0923b24f7
4
- data.tar.gz: 6e16ffeac1295c98109d282d4ba08cfb64686f0a
3
+ metadata.gz: 764d595de1ccd035e52340a849aa668815e8dae7
4
+ data.tar.gz: f7e933e063ee39c7813b9a9618f19b74174ab569
5
5
  SHA512:
6
- metadata.gz: 940d7b7c9ae596935443556c7faf294c917daa995441d5123ef93c21902bb8be092ae981c0afc1cac0f6f551a743865b3209f5b1710671980ae4cbd082d983a1
7
- data.tar.gz: 97e2e19769e250c59a00a205cf8e2388deae8de8290e3d2d372c4a582db638c296ec318b75ff86036e96ec462501910272bf4bb3ed421daca77f11f9f62a203c
6
+ metadata.gz: e18131d908d6c1ab5329e13005261cc07aaabade69dfd9ccb09078ec6c2f7efb43231f229168b9eab2ea2ccdde573c55f42cf7beca42e9e2f8cf107e58873944
7
+ data.tar.gz: 8e38f681409c92781111082573df67e2e138670f1e063a24088eb92102943818eef279e33bef02cac8c38aa73d9228a105f4bcfd39963409ddf51e90ccb4af91
@@ -1,5 +1,4 @@
1
- _rE׻�E����������"U_��1w�3$h���be��L��k�,�Ժ)��K���isK��P|�.�۔<
2
- e� ��@yz>(U�
3
- |����^�̞����]����0��  ��Bnڀ��QQM��"��B�`]ze Iν{�J\>"�S))����`Gg[ȣϹ����9;����-��/�
4
- A�" 7ɞ.�R*�+4p�+A�)�����Wg?Dx0o��bRlJ�sE8a��S$V�6g��nY70��t�˄ x�,) ](�\� ��IQ%�޿�Y�Z��s+"1
5
- @�,��[+} ���U~���G�mN)I�C��Hl��l�4�M֬Z�{�Q�+j�����f��:�I+§89��E��ǀ�H��!� >�A�͝ 2ց+� G5���0��-��C�b��~��
1
+ __�m�^�=ĽYi��¦���i�8����E�F/���Ұ">�獈-�7 �okac�8<�Ȁ�\�niNhr�8̤�*F��I���=
2
+ �R_Il��Mb*�63Ou�@~.)�D�Ynv_��,nzV��e�}km[����D��� ɫ<��!�G��[���d|:3.��G�e����>�
3
+ �u<u8x��j��;�� O8������ �h�H��Rt��#�U� #�|�'~Q�G^c-gS�� iR;�'��D8Q�8����t{�d��g+�<���A�V��?�V
4
+ ����?Gh]vX�間��E���$�8��ņ�C���̍z��<�X��P����vTlI��]��VV��M49^�ĝ��;�c]��?�}��u��tV���L+{��T���^潏�Bķ��Ľv�)7;II,��Z�ɤ�3A��
data.tar.gz.sig CHANGED
Binary file
@@ -1,27 +1,8 @@
1
1
  ### Development
2
- [Full Changelog](http://github.com/rspec/rspec-core/compare/v3.4.4...3-4-maintenance)
2
+ [Full Changelog](http://github.com/rspec/rspec-core/compare/v3.5.0.beta1...master)
3
3
 
4
- ### 3.4.4 / 2016-03-09
5
- [Full Changelog](http://github.com/rspec/rspec-core/compare/v3.4.3...3.4.4)
6
-
7
- Bug Fixes:
8
-
9
- * Fix `RSpec::Core::RakeTask` so that it works with Rake 11.
10
- (Travis Grathwell, #2197)
11
-
12
- ### 3.4.3 / 2016-02-19
13
- [Full Changelog](http://github.com/rspec/rspec-core/compare/v3.4.2...3.4.3)
14
-
15
- Bug Fixes:
16
-
17
- * Prevent a `TypeError` from occuring when running via the rake task when
18
- Ruby crashes. (Patrik Wenger, #2161)
19
- * Only consider example and group declaration lines from a specific file
20
- when applying line number filtering, instead of considering all
21
- declaration lines from all spec files. (Myron Marston, #2170)
22
- * Fix failure snippet extraction so that snippets that contain `do-end` style
23
- block and end with `end`-only line can be extracted properly.
24
- (Yuji Nakayama, #2173)
4
+ ### 3.5.0.beta1 / 2016-02-06
5
+ [Full Changelog](http://github.com/rspec/rspec-core/compare/v3.4.2...v3.5.0.beta1)
25
6
 
26
7
  ### 3.4.2 / 2016-01-26
27
8
  [Full Changelog](http://github.com/rspec/rspec-core/compare/v3.4.1...v3.4.2)
@@ -9,7 +9,7 @@ module RSpec
9
9
  #
10
10
  # This allows us to provide rich metadata about each individual
11
11
  # example without adding tons of methods directly to the ExampleGroup
12
- # that users may inadvertantly redefine.
12
+ # that users may inadvertently redefine.
13
13
  #
14
14
  # Useful for configuring logging and/or taking some action based
15
15
  # on the state of an example's metadata.
@@ -347,7 +347,7 @@ module RSpec
347
347
  @descendant_filtered_examples = nil
348
348
  @_descendants = nil
349
349
  @parent_groups = nil
350
- @declaration_locations = nil
350
+ @declaration_line_numbers = nil
351
351
  end
352
352
 
353
353
  # Adds an example to the example group
@@ -414,6 +414,8 @@ module RSpec
414
414
  )
415
415
  ExampleGroups.assign_const(self)
416
416
 
417
+ @currently_executing_a_context_hook = false
418
+
417
419
  hooks.register_globals(self, RSpec.configuration.hooks)
418
420
  RSpec.configuration.configure_group(self)
419
421
  end
@@ -486,15 +488,24 @@ module RSpec
486
488
  end
487
489
  end
488
490
 
491
+ # Returns true if a `before(:context)` or `after(:context)`
492
+ # hook is currently executing.
493
+ def self.currently_executing_a_context_hook?
494
+ @currently_executing_a_context_hook
495
+ end
496
+
489
497
  # @private
490
498
  def self.run_before_context_hooks(example_group_instance)
491
499
  set_ivars(example_group_instance, superclass_before_context_ivars)
492
500
 
501
+ @currently_executing_a_context_hook = true
502
+
493
503
  ContextHookMemoized::Before.isolate_for_context_hook(example_group_instance) do
494
504
  hooks.run(:before, :context, example_group_instance)
495
505
  end
496
506
  ensure
497
507
  store_before_context_ivars(example_group_instance)
508
+ @currently_executing_a_context_hook = false
498
509
  end
499
510
 
500
511
  if RUBY_VERSION.to_f >= 1.9
@@ -525,11 +536,14 @@ module RSpec
525
536
  def self.run_after_context_hooks(example_group_instance)
526
537
  set_ivars(example_group_instance, before_context_ivars)
527
538
 
539
+ @currently_executing_a_context_hook = true
540
+
528
541
  ContextHookMemoized::After.isolate_for_context_hook(example_group_instance) do
529
542
  hooks.run(:after, :context, example_group_instance)
530
543
  end
531
544
  ensure
532
545
  before_context_ivars.clear
546
+ @currently_executing_a_context_hook = false
533
547
  end
534
548
 
535
549
  # Runs all the examples in this group.
@@ -599,10 +613,10 @@ module RSpec
599
613
  end
600
614
 
601
615
  # @private
602
- def self.declaration_locations
603
- @declaration_locations ||= [Metadata.location_tuple_from(metadata)] +
604
- examples.map { |e| Metadata.location_tuple_from(e.metadata) } +
605
- FlatMap.flat_map(children, &:declaration_locations)
616
+ def self.declaration_line_numbers
617
+ @declaration_line_numbers ||= [metadata[:line_number]] +
618
+ examples.map { |e| e.metadata[:line_number] } +
619
+ FlatMap.flat_map(children, &:declaration_line_numbers)
606
620
  end
607
621
 
608
622
  # @return [String] the unique id of this example group. Pass
@@ -408,6 +408,8 @@ module RSpec
408
408
  # ignore it.
409
409
  return if Pending::PendingExampleFixedError === exception
410
410
 
411
+ return if exception == self
412
+
411
413
  all_exceptions << exception
412
414
 
413
415
  if exception.class.name =~ /RSpec/
@@ -23,6 +23,13 @@ module RSpec
23
23
  if RSpec::Support::RubyFeatures.ripper_supported?
24
24
  NoExpressionAtLineError = Class.new(StandardError)
25
25
 
26
+ PAREN_TOKEN_TYPE_PAIRS = {
27
+ :on_lbracket => :on_rbracket,
28
+ :on_lparen => :on_rparen,
29
+ :on_lbrace => :on_rbrace,
30
+ :on_heredoc_beg => :on_heredoc_end
31
+ }
32
+
26
33
  attr_reader :source, :beginning_line_number, :max_line_count
27
34
 
28
35
  def self.extract_expression_lines_at(file_path, beginning_line_number, max_line_count=nil)
@@ -57,29 +64,29 @@ module RSpec
57
64
  def line_range_of_expression
58
65
  @line_range_of_expression ||= begin
59
66
  line_range = line_range_of_location_nodes_in_expression
60
- initial_unclosed_tokens = unclosed_tokens_in_line_range(line_range)
61
- unclosed_tokens = initial_unclosed_tokens
67
+ initial_unclosed_parens = unclosed_paren_tokens_in_line_range(line_range)
68
+ unclosed_parens = initial_unclosed_parens
62
69
 
63
- until (initial_unclosed_tokens & unclosed_tokens).empty?
70
+ until (initial_unclosed_parens & unclosed_parens).empty?
64
71
  line_range = (line_range.begin)..(line_range.end + 1)
65
- unclosed_tokens = unclosed_tokens_in_line_range(line_range)
72
+ unclosed_parens = unclosed_paren_tokens_in_line_range(line_range)
66
73
  end
67
74
 
68
75
  line_range
69
76
  end
70
77
  end
71
78
 
72
- def unclosed_tokens_in_line_range(line_range)
79
+ def unclosed_paren_tokens_in_line_range(line_range)
73
80
  tokens = FlatMap.flat_map(line_range) do |line_number|
74
81
  source.tokens_by_line_number[line_number]
75
82
  end
76
83
 
77
84
  tokens.each_with_object([]) do |token, unclosed_tokens|
78
- if token.opening?
85
+ if PAREN_TOKEN_TYPE_PAIRS.keys.include?(token.type)
79
86
  unclosed_tokens << token
80
87
  else
81
88
  index = unclosed_tokens.rindex do |unclosed_token|
82
- unclosed_token.closed_by?(token)
89
+ PAREN_TOKEN_TYPE_PAIRS[unclosed_token.type] == token.type
83
90
  end
84
91
  unclosed_tokens.delete_at(index) if index
85
92
  end
@@ -106,11 +106,6 @@ module RSpec
106
106
  "#{metadata[:rerun_file_path]}[#{metadata[:scoped_id]}]"
107
107
  end
108
108
 
109
- # @private
110
- def self.location_tuple_from(metadata)
111
- [metadata[:absolute_file_path], metadata[:line_number]]
112
- end
113
-
114
109
  # @private
115
110
  # Used internally to populate metadata hashes with computed keys
116
111
  # managed by RSpec.
@@ -15,9 +15,9 @@ module RSpec
15
15
  # @private
16
16
  def filter_applies?(key, value, metadata)
17
17
  silence_metadata_example_group_deprecations do
18
- return location_filter_applies?(value, metadata) if key == :locations
19
- return id_filter_applies?(value, metadata) if key == :ids
20
- return filters_apply?(key, value, metadata) if Hash === value
18
+ return location_filter_applies?(value, metadata) if key == :locations
19
+ return id_filter_applies?(value, metadata) if key == :ids
20
+ return filters_apply?(key, value, metadata) if Hash === value
21
21
 
22
22
  return false unless metadata.key?(key)
23
23
  return true if TrueClass === value && !!metadata[key]
@@ -49,14 +49,13 @@ module RSpec
49
49
  end
50
50
 
51
51
  def location_filter_applies?(locations, metadata)
52
- Metadata.ascend(metadata).any? do |meta|
53
- file_path = meta[:absolute_file_path]
54
- line_num = meta[:line_number]
52
+ line_numbers = example_group_declaration_lines(locations, metadata)
53
+ line_number_filter_applies?(line_numbers, metadata)
54
+ end
55
55
 
56
- locations[file_path].any? do |filter_line_num|
57
- line_num == RSpec.world.preceding_declaration_line(file_path, filter_line_num)
58
- end
59
- end
56
+ def line_number_filter_applies?(line_numbers, metadata)
57
+ preceding_declaration_lines = line_numbers.map { |n| RSpec.world.preceding_declaration_line(n) }
58
+ !(relevant_line_numbers(metadata) & preceding_declaration_lines).empty?
60
59
  end
61
60
 
62
61
  def proc_filter_applies?(key, proc, metadata)
@@ -67,6 +66,16 @@ module RSpec
67
66
  end
68
67
  end
69
68
 
69
+ def relevant_line_numbers(metadata)
70
+ Metadata.ascend(metadata).map { |meta| meta[:line_number] }
71
+ end
72
+
73
+ def example_group_declaration_lines(locations, metadata)
74
+ FlatMap.flat_map(Metadata.ascend(metadata)) do |meta|
75
+ locations[meta[:absolute_file_path]]
76
+ end.uniq
77
+ end
78
+
70
79
  def filters_apply?(key, value, metadata)
71
80
  subhash = metadata[key]
72
81
  return false unless Hash === subhash || HashImitatable === subhash
@@ -151,7 +151,7 @@ module RSpec::Core
151
151
  begin
152
152
  Integer(argument)
153
153
  rescue ArgumentError
154
- RSpec.warning "Non integer specified as profile count, seperate " \
154
+ RSpec.warning "Non integer specified as profile count, separate " \
155
155
  "your path from options with -- e.g. " \
156
156
  "`rspec --profile -- #{argument}`",
157
157
  :call_site => nil
@@ -81,14 +81,14 @@ module RSpec
81
81
 
82
82
  return unless fail_on_error
83
83
  $stderr.puts "#{command} failed" if verbose
84
- exit $?.exitstatus || 1
84
+ exit $?.exitstatus
85
85
  end
86
86
 
87
87
  private
88
88
 
89
89
  # @private
90
90
  def define(args, &task_block)
91
- desc "Run RSpec code examples" unless ::Rake.application.last_description
91
+ desc "Run RSpec code examples" unless ::Rake.application.last_comment
92
92
 
93
93
  task name, *args do |_, task_args|
94
94
  RakeFileUtils.__send__(:verbose, verbose) do
@@ -152,7 +152,7 @@ module RSpec
152
152
  # @private
153
153
  # rubocop:disable Lint/EnsureReturn
154
154
  def self.running_in_drb?
155
- if defined?(DRb) && DRb.current_server
155
+ if defined?(DRb) && DRb.current_server && DRb.current_server.alive?
156
156
  require 'socket'
157
157
  require 'uri'
158
158
  local_ipv4 = IPSocket.getaddress(Socket.gethostname)
@@ -6,17 +6,6 @@ module RSpec
6
6
  # @private
7
7
  # A wrapper for Ripper token which is generated with `Ripper.lex`.
8
8
  class Token
9
- CLOSING_TYPES_BY_OPENING_TYPE = {
10
- :on_lbracket => :on_rbracket,
11
- :on_lparen => :on_rparen,
12
- :on_lbrace => :on_rbrace,
13
- :on_heredoc_beg => :on_heredoc_end
14
- }.freeze
15
-
16
- CLOSING_KEYWORDS_BY_OPENING_KEYWORD = {
17
- 'do' => 'end'
18
- }.freeze
19
-
20
9
  attr_reader :token
21
10
 
22
11
  def self.tokens_from_ripper_tokens(ripper_tokens)
@@ -48,38 +37,6 @@ module RSpec
48
37
  def inspect
49
38
  "#<#{self.class} #{type} #{string.inspect}>"
50
39
  end
51
-
52
- def keyword?
53
- type == :on_kw
54
- end
55
-
56
- def opening?
57
- opening_delimiter? || opening_keyword?
58
- end
59
-
60
- def closed_by?(other)
61
- closed_by_delimiter?(other) || closed_by_keyword?(other)
62
- end
63
-
64
- private
65
-
66
- def opening_delimiter?
67
- CLOSING_TYPES_BY_OPENING_TYPE.key?(type)
68
- end
69
-
70
- def opening_keyword?
71
- return false unless keyword?
72
- CLOSING_KEYWORDS_BY_OPENING_KEYWORD.key?(string)
73
- end
74
-
75
- def closed_by_delimiter?(other)
76
- other.type == CLOSING_TYPES_BY_OPENING_TYPE[type]
77
- end
78
-
79
- def closed_by_keyword?(other)
80
- return false unless other.keyword?
81
- other.string == CLOSING_KEYWORDS_BY_OPENING_KEYWORD[string]
82
- end
83
40
  end
84
41
  end
85
42
  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.4.4'
6
+ STRING = '3.5.0.beta1'
7
7
  end
8
8
  end
9
9
  end
@@ -96,12 +96,10 @@ module RSpec
96
96
  # @api private
97
97
  #
98
98
  # Find line number of previous declaration.
99
- def preceding_declaration_line(absolute_file_name, filter_line)
100
- line_numbers = descending_declaration_line_numbers_by_file.fetch(absolute_file_name) do
101
- return nil
99
+ def preceding_declaration_line(filter_line)
100
+ declaration_line_numbers.sort.inject(nil) do |highest_prior_declaration_line, line|
101
+ line <= filter_line ? line : highest_prior_declaration_line
102
102
  end
103
-
104
- line_numbers.find { |num| num <= filter_line }
105
103
  end
106
104
 
107
105
  # @private
@@ -181,22 +179,8 @@ module RSpec
181
179
 
182
180
  private
183
181
 
184
- def descending_declaration_line_numbers_by_file
185
- @descending_declaration_line_numbers_by_file ||= begin
186
- declaration_locations = FlatMap.flat_map(example_groups, &:declaration_locations)
187
- hash_of_arrays = Hash.new { |h, k| h[k] = [] }
188
-
189
- # TODO: change `inject` to `each_with_object` when we drop 1.8.7 support.
190
- line_nums_by_file = declaration_locations.inject(hash_of_arrays) do |hash, (file_name, line_number)|
191
- hash[file_name] << line_number
192
- hash
193
- end
194
-
195
- line_nums_by_file.each_value do |list|
196
- list.sort!
197
- list.reverse!
198
- end
199
- end
182
+ def declaration_line_numbers
183
+ @declaration_line_numbers ||= FlatMap.flat_map(example_groups, &:declaration_line_numbers)
200
184
  end
201
185
 
202
186
  def fail_if_config_and_cli_options_invalid
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.4
4
+ version: 3.5.0.beta1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Steven Baker
@@ -46,34 +46,34 @@ cert_chain:
46
46
  ZsVDj6a7lH3cNqtWXZxrb2wO38qV5AkYj8SQK7Hj3/Yui9myUX3crr+PdetazSqQ
47
47
  F3MdtaDehhjC
48
48
  -----END CERTIFICATE-----
49
- date: 2016-03-09 00:00:00.000000000 Z
49
+ date: 2016-02-06 00:00:00.000000000 Z
50
50
  dependencies:
51
51
  - !ruby/object:Gem::Dependency
52
52
  name: rspec-support
53
53
  requirement: !ruby/object:Gem::Requirement
54
54
  requirements:
55
- - - "~>"
55
+ - - '='
56
56
  - !ruby/object:Gem::Version
57
- version: 3.4.0
57
+ version: 3.5.0.beta1
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.4.0
64
+ version: 3.5.0.beta1
65
65
  - !ruby/object:Gem::Dependency
66
66
  name: rake
67
67
  requirement: !ruby/object:Gem::Requirement
68
68
  requirements:
69
- - - ">="
69
+ - - "~>"
70
70
  - !ruby/object:Gem::Version
71
71
  version: 10.0.0
72
72
  type: :development
73
73
  prerelease: false
74
74
  version_requirements: !ruby/object:Gem::Requirement
75
75
  requirements:
76
- - - ">="
76
+ - - "~>"
77
77
  - !ruby/object:Gem::Version
78
78
  version: 10.0.0
79
79
  - !ruby/object:Gem::Dependency
@@ -288,14 +288,14 @@ required_ruby_version: !ruby/object:Gem::Requirement
288
288
  version: 1.8.7
289
289
  required_rubygems_version: !ruby/object:Gem::Requirement
290
290
  requirements:
291
- - - ">="
291
+ - - ">"
292
292
  - !ruby/object:Gem::Version
293
- version: '0'
293
+ version: 1.3.1
294
294
  requirements: []
295
295
  rubyforge_project:
296
296
  rubygems_version: 2.4.5.1
297
297
  signing_key:
298
298
  specification_version: 4
299
- summary: rspec-core-3.4.4
299
+ summary: rspec-core-3.5.0.beta1
300
300
  test_files: []
301
301
  has_rdoc:
metadata.gz.sig CHANGED
Binary file