rspec-core 3.5.4 → 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.
Files changed (64) hide show
  1. checksums.yaml +5 -5
  2. checksums.yaml.gz.sig +0 -0
  3. data.tar.gz.sig +0 -0
  4. data/Changelog.md +165 -2
  5. data/README.md +16 -16
  6. data/lib/rspec/core.rb +2 -1
  7. data/lib/rspec/core/bisect/coordinator.rb +26 -30
  8. data/lib/rspec/core/bisect/example_minimizer.rb +12 -8
  9. data/lib/rspec/core/bisect/fork_runner.rb +134 -0
  10. data/lib/rspec/core/bisect/server.rb +10 -14
  11. data/lib/rspec/core/bisect/{runner.rb → shell_command.rb} +27 -70
  12. data/lib/rspec/core/bisect/shell_runner.rb +73 -0
  13. data/lib/rspec/core/bisect/utilities.rb +58 -0
  14. data/lib/rspec/core/configuration.rb +315 -79
  15. data/lib/rspec/core/configuration_options.rb +43 -4
  16. data/lib/rspec/core/did_you_mean.rb +46 -0
  17. data/lib/rspec/core/drb.rb +3 -1
  18. data/lib/rspec/core/example.rb +19 -12
  19. data/lib/rspec/core/example_group.rb +17 -7
  20. data/lib/rspec/core/formatters.rb +28 -11
  21. data/lib/rspec/core/formatters/base_bisect_formatter.rb +45 -0
  22. data/lib/rspec/core/formatters/base_formatter.rb +1 -1
  23. data/lib/rspec/core/formatters/base_text_formatter.rb +3 -5
  24. data/lib/rspec/core/formatters/bisect_drb_formatter.rb +29 -0
  25. data/lib/rspec/core/formatters/bisect_progress_formatter.rb +29 -16
  26. data/lib/rspec/core/formatters/console_codes.rb +7 -4
  27. data/lib/rspec/core/formatters/deprecation_formatter.rb +9 -9
  28. data/lib/rspec/core/formatters/documentation_formatter.rb +37 -4
  29. data/lib/rspec/core/formatters/exception_presenter.rb +21 -4
  30. data/lib/rspec/core/formatters/failure_list_formatter.rb +23 -0
  31. data/lib/rspec/core/formatters/html_formatter.rb +4 -2
  32. data/lib/rspec/core/formatters/html_printer.rb +3 -3
  33. data/lib/rspec/core/formatters/html_snippet_extractor.rb +4 -0
  34. data/lib/rspec/core/formatters/json_formatter.rb +9 -3
  35. data/lib/rspec/core/formatters/progress_formatter.rb +1 -0
  36. data/lib/rspec/core/formatters/protocol.rb +43 -42
  37. data/lib/rspec/core/formatters/snippet_extractor.rb +1 -3
  38. data/lib/rspec/core/{source → formatters}/syntax_highlighter.rb +21 -1
  39. data/lib/rspec/core/hooks.rb +18 -10
  40. data/lib/rspec/core/invocations.rb +30 -10
  41. data/lib/rspec/core/memoized_helpers.rb +36 -14
  42. data/lib/rspec/core/metadata.rb +2 -3
  43. data/lib/rspec/core/metadata_filter.rb +29 -17
  44. data/lib/rspec/core/notifications.rb +34 -11
  45. data/lib/rspec/core/option_parser.rb +32 -4
  46. data/lib/rspec/core/output_wrapper.rb +29 -0
  47. data/lib/rspec/core/profiler.rb +3 -1
  48. data/lib/rspec/core/project_initializer/.rspec +0 -1
  49. data/lib/rspec/core/project_initializer/spec/spec_helper.rb +1 -4
  50. data/lib/rspec/core/rake_task.rb +21 -1
  51. data/lib/rspec/core/reporter.rb +33 -16
  52. data/lib/rspec/core/runner.rb +31 -15
  53. data/lib/rspec/core/set.rb +5 -0
  54. data/lib/rspec/core/shared_example_group.rb +41 -19
  55. data/lib/rspec/core/shell_escape.rb +2 -2
  56. data/lib/rspec/core/version.rb +1 -1
  57. data/lib/rspec/core/world.rb +24 -5
  58. metadata +26 -20
  59. metadata.gz.sig +0 -0
  60. data/lib/rspec/core/formatters/bisect_formatter.rb +0 -69
  61. data/lib/rspec/core/source.rb +0 -86
  62. data/lib/rspec/core/source/location.rb +0 -13
  63. data/lib/rspec/core/source/node.rb +0 -93
  64. data/lib/rspec/core/source/token.rb +0 -87
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
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: 2016-10-01 00:00:00.000000000 Z
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.5.0
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.5.0
64
+ version: 3.9.0
65
65
  - !ruby/object:Gem::Dependency
66
66
  name: cucumber
67
67
  requirement: !ruby/object:Gem::Requirement
@@ -96,28 +96,28 @@ dependencies:
96
96
  requirements:
97
97
  - - "~>"
98
98
  - !ruby/object:Gem::Version
99
- version: 0.6.2
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.6.2
106
+ version: 0.14.9
107
107
  - !ruby/object:Gem::Dependency
108
108
  name: coderay
109
109
  requirement: !ruby/object:Gem::Requirement
110
110
  requirements:
111
111
  - - "~>"
112
112
  - !ruby/object:Gem::Version
113
- version: 1.0.9
113
+ version: 1.1.1
114
114
  type: :development
115
115
  prerelease: false
116
116
  version_requirements: !ruby/object:Gem::Requirement
117
117
  requirements:
118
118
  - - "~>"
119
119
  - !ruby/object:Gem::Version
120
- version: 1.0.9
120
+ version: 1.1.1
121
121
  - !ruby/object:Gem::Dependency
122
122
  name: mocha
123
123
  requirement: !ruby/object:Gem::Requirement
@@ -192,10 +192,14 @@ files:
192
192
  - lib/rspec/core/backtrace_formatter.rb
193
193
  - lib/rspec/core/bisect/coordinator.rb
194
194
  - lib/rspec/core/bisect/example_minimizer.rb
195
- - lib/rspec/core/bisect/runner.rb
195
+ - lib/rspec/core/bisect/fork_runner.rb
196
196
  - lib/rspec/core/bisect/server.rb
197
+ - lib/rspec/core/bisect/shell_command.rb
198
+ - lib/rspec/core/bisect/shell_runner.rb
199
+ - lib/rspec/core/bisect/utilities.rb
197
200
  - lib/rspec/core/configuration.rb
198
201
  - lib/rspec/core/configuration_options.rb
202
+ - lib/rspec/core/did_you_mean.rb
199
203
  - lib/rspec/core/drb.rb
200
204
  - lib/rspec/core/dsl.rb
201
205
  - lib/rspec/core/example.rb
@@ -204,14 +208,16 @@ files:
204
208
  - lib/rspec/core/filter_manager.rb
205
209
  - lib/rspec/core/flat_map.rb
206
210
  - lib/rspec/core/formatters.rb
211
+ - lib/rspec/core/formatters/base_bisect_formatter.rb
207
212
  - lib/rspec/core/formatters/base_formatter.rb
208
213
  - lib/rspec/core/formatters/base_text_formatter.rb
209
- - lib/rspec/core/formatters/bisect_formatter.rb
214
+ - lib/rspec/core/formatters/bisect_drb_formatter.rb
210
215
  - lib/rspec/core/formatters/bisect_progress_formatter.rb
211
216
  - lib/rspec/core/formatters/console_codes.rb
212
217
  - lib/rspec/core/formatters/deprecation_formatter.rb
213
218
  - lib/rspec/core/formatters/documentation_formatter.rb
214
219
  - lib/rspec/core/formatters/exception_presenter.rb
220
+ - lib/rspec/core/formatters/failure_list_formatter.rb
215
221
  - lib/rspec/core/formatters/fallback_message_formatter.rb
216
222
  - lib/rspec/core/formatters/helpers.rb
217
223
  - lib/rspec/core/formatters/html_formatter.rb
@@ -222,6 +228,7 @@ files:
222
228
  - lib/rspec/core/formatters/progress_formatter.rb
223
229
  - lib/rspec/core/formatters/protocol.rb
224
230
  - lib/rspec/core/formatters/snippet_extractor.rb
231
+ - lib/rspec/core/formatters/syntax_highlighter.rb
225
232
  - lib/rspec/core/hooks.rb
226
233
  - lib/rspec/core/invocations.rb
227
234
  - lib/rspec/core/memoized_helpers.rb
@@ -236,6 +243,7 @@ files:
236
243
  - lib/rspec/core/notifications.rb
237
244
  - lib/rspec/core/option_parser.rb
238
245
  - lib/rspec/core/ordering.rb
246
+ - lib/rspec/core/output_wrapper.rb
239
247
  - lib/rspec/core/pending.rb
240
248
  - lib/rspec/core/profiler.rb
241
249
  - lib/rspec/core/project_initializer.rb
@@ -250,11 +258,6 @@ files:
250
258
  - lib/rspec/core/shared_context.rb
251
259
  - lib/rspec/core/shared_example_group.rb
252
260
  - lib/rspec/core/shell_escape.rb
253
- - lib/rspec/core/source.rb
254
- - lib/rspec/core/source/location.rb
255
- - lib/rspec/core/source/node.rb
256
- - lib/rspec/core/source/syntax_highlighter.rb
257
- - lib/rspec/core/source/token.rb
258
261
  - lib/rspec/core/test_unit_assertions_adapter.rb
259
262
  - lib/rspec/core/version.rb
260
263
  - lib/rspec/core/warnings.rb
@@ -262,7 +265,12 @@ files:
262
265
  homepage: https://github.com/rspec/rspec-core
263
266
  licenses:
264
267
  - MIT
265
- metadata: {}
268
+ metadata:
269
+ bug_tracker_uri: https://github.com/rspec/rspec-core/issues
270
+ changelog_uri: https://github.com/rspec/rspec-core/blob/v3.9.0/Changelog.md
271
+ documentation_uri: https://rspec.info/documentation/
272
+ mailing_list_uri: https://groups.google.com/forum/#!forum/rspec
273
+ source_code_uri: https://github.com/rspec/rspec-core
266
274
  post_install_message:
267
275
  rdoc_options:
268
276
  - "--charset=UTF-8"
@@ -279,10 +287,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
279
287
  - !ruby/object:Gem::Version
280
288
  version: '0'
281
289
  requirements: []
282
- rubyforge_project:
283
- rubygems_version: 2.2.2
290
+ rubygems_version: 3.0.6
284
291
  signing_key:
285
292
  specification_version: 4
286
- summary: rspec-core-3.5.4
293
+ summary: rspec-core-3.9.0
287
294
  test_files: []
288
- has_rdoc:
metadata.gz.sig CHANGED
Binary file
@@ -1,69 +0,0 @@
1
- require 'drb/drb'
2
-
3
- module RSpec
4
- module Core
5
- module Formatters
6
- # Used by `--bisect`. When it shells out and runs a portion of the suite, it uses
7
- # this formatter as a means to have the status reported back to it, via DRb.
8
- #
9
- # Note that since DRb calls carry considerable overhead compared to normal
10
- # method calls, we try to minimize the number of DRb calls for perf reasons,
11
- # opting to communicate only at the start and the end of the run, rather than
12
- # after each example.
13
- # @private
14
- class BisectFormatter
15
- Formatters.register self, :start, :start_dump, :example_started,
16
- :example_failed, :example_passed, :example_pending
17
-
18
- def initialize(_output)
19
- port = RSpec.configuration.drb_port
20
- drb_uri = "druby://localhost:#{port}"
21
- @all_example_ids = []
22
- @failed_example_ids = []
23
- @bisect_server = DRbObject.new_with_uri(drb_uri)
24
- @remaining_failures = []
25
- RSpec.configuration.files_or_directories_to_run = @bisect_server.files_or_directories_to_run
26
- end
27
-
28
- def start(_notification)
29
- @remaining_failures = Set.new(@bisect_server.expected_failures)
30
- end
31
-
32
- def example_started(notification)
33
- @all_example_ids << notification.example.id
34
- end
35
-
36
- def example_failed(notification)
37
- @failed_example_ids << notification.example.id
38
- example_finished(notification, :failed)
39
- end
40
-
41
- def example_passed(notification)
42
- example_finished(notification, :passed)
43
- end
44
-
45
- def example_pending(notification)
46
- example_finished(notification, :pending)
47
- end
48
-
49
- def start_dump(_notification)
50
- @bisect_server.latest_run_results = RunResults.new(
51
- @all_example_ids, @failed_example_ids
52
- )
53
- end
54
-
55
- RunResults = Struct.new(:all_example_ids, :failed_example_ids)
56
-
57
- private
58
-
59
- def example_finished(notification, status)
60
- return unless @remaining_failures.include?(notification.example.id)
61
- @remaining_failures.delete(notification.example.id)
62
-
63
- return if status == :failed && !@remaining_failures.empty?
64
- RSpec.world.wants_to_quit = true
65
- end
66
- end
67
- end
68
- end
69
- end
@@ -1,86 +0,0 @@
1
- RSpec::Support.require_rspec_support "encoded_string"
2
- RSpec::Support.require_rspec_core 'source/node'
3
- RSpec::Support.require_rspec_core 'source/syntax_highlighter'
4
- RSpec::Support.require_rspec_core 'source/token'
5
-
6
- module RSpec
7
- module Core
8
- # @private
9
- # Represents a Ruby source file and provides access to AST and tokens.
10
- class Source
11
- attr_reader :source, :path
12
-
13
- def self.from_file(path)
14
- source = File.read(path)
15
- new(source, path)
16
- end
17
-
18
- if String.method_defined?(:encoding)
19
- def initialize(source_string, path=nil)
20
- @source = RSpec::Support::EncodedString.new(source_string, Encoding.default_external)
21
- @path = path ? File.expand_path(path) : '(string)'
22
- end
23
- else # for 1.8.7
24
- # :nocov:
25
- def initialize(source_string, path=nil)
26
- @source = RSpec::Support::EncodedString.new(source_string)
27
- @path = path ? File.expand_path(path) : '(string)'
28
- end
29
- # :nocov:
30
- end
31
-
32
- def lines
33
- @lines ||= source.split("\n")
34
- end
35
-
36
- def ast
37
- @ast ||= begin
38
- require 'ripper'
39
- sexp = Ripper.sexp(source)
40
- raise SyntaxError unless sexp
41
- Node.new(sexp)
42
- end
43
- end
44
-
45
- def tokens
46
- @tokens ||= begin
47
- require 'ripper'
48
- tokens = Ripper.lex(source)
49
- Token.tokens_from_ripper_tokens(tokens)
50
- end
51
- end
52
-
53
- def nodes_by_line_number
54
- @nodes_by_line_number ||= begin
55
- nodes_by_line_number = ast.select(&:location).group_by { |node| node.location.line }
56
- Hash.new { |hash, key| hash[key] = [] }.merge(nodes_by_line_number)
57
- end
58
- end
59
-
60
- def tokens_by_line_number
61
- @tokens_by_line_number ||= begin
62
- nodes_by_line_number = tokens.group_by { |token| token.location.line }
63
- Hash.new { |hash, key| hash[key] = [] }.merge(nodes_by_line_number)
64
- end
65
- end
66
-
67
- def inspect
68
- "#<#{self.class} #{path}>"
69
- end
70
-
71
- # @private
72
- class Cache
73
- attr_reader :syntax_highlighter
74
-
75
- def initialize(configuration)
76
- @sources_by_path = {}
77
- @syntax_highlighter = SyntaxHighlighter.new(configuration)
78
- end
79
-
80
- def source_from_file(path)
81
- @sources_by_path[path] ||= Source.from_file(path)
82
- end
83
- end
84
- end
85
- end
86
- end
@@ -1,13 +0,0 @@
1
- module RSpec
2
- module Core
3
- class Source
4
- # @private
5
- # Represents a source location of node or token.
6
- Location = Struct.new(:line, :column) do
7
- def self.location?(array)
8
- array.is_a?(Array) && array.size == 2 && array.all? { |e| e.is_a?(Integer) }
9
- end
10
- end
11
- end
12
- end
13
- end
@@ -1,93 +0,0 @@
1
- RSpec::Support.require_rspec_core "source/location"
2
-
3
- module RSpec
4
- module Core
5
- class Source
6
- # @private
7
- # A wrapper for Ripper AST node which is generated with `Ripper.sexp`.
8
- class Node
9
- include Enumerable
10
-
11
- attr_reader :sexp, :parent
12
-
13
- def self.sexp?(array)
14
- array.is_a?(Array) && array.first.is_a?(Symbol)
15
- end
16
-
17
- def initialize(ripper_sexp, parent=nil)
18
- @sexp = ripper_sexp.freeze
19
- @parent = parent
20
- end
21
-
22
- def type
23
- sexp[0]
24
- end
25
-
26
- def args
27
- @args ||= raw_args.map do |raw_arg|
28
- if Node.sexp?(raw_arg)
29
- Node.new(raw_arg, self)
30
- elsif Location.location?(raw_arg)
31
- Location.new(*raw_arg)
32
- elsif raw_arg.is_a?(Array)
33
- GroupNode.new(raw_arg, self)
34
- else
35
- raw_arg
36
- end
37
- end.freeze
38
- end
39
-
40
- def children
41
- @children ||= args.select { |arg| arg.is_a?(Node) }.freeze
42
- end
43
-
44
- def location
45
- @location ||= args.find { |arg| arg.is_a?(Location) }
46
- end
47
-
48
- def each(&block)
49
- return to_enum(__method__) unless block_given?
50
-
51
- yield self
52
-
53
- children.each do |child|
54
- child.each(&block)
55
- end
56
- end
57
-
58
- def each_ancestor
59
- return to_enum(__method__) unless block_given?
60
-
61
- current_node = self
62
-
63
- while (current_node = current_node.parent)
64
- yield current_node
65
- end
66
- end
67
-
68
- def inspect
69
- "#<#{self.class} #{type}>"
70
- end
71
-
72
- private
73
-
74
- def raw_args
75
- sexp[1..-1] || []
76
- end
77
- end
78
-
79
- # @private
80
- class GroupNode < Node
81
- def type
82
- :group
83
- end
84
-
85
- private
86
-
87
- def raw_args
88
- sexp
89
- end
90
- end
91
- end
92
- end
93
- end
@@ -1,87 +0,0 @@
1
- RSpec::Support.require_rspec_core "source/location"
2
-
3
- module RSpec
4
- module Core
5
- class Source
6
- # @private
7
- # A wrapper for Ripper token which is generated with `Ripper.lex`.
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
- 'def' => 'end',
18
- 'do' => 'end',
19
- }.freeze
20
-
21
- attr_reader :token
22
-
23
- def self.tokens_from_ripper_tokens(ripper_tokens)
24
- ripper_tokens.map { |ripper_token| new(ripper_token) }.freeze
25
- end
26
-
27
- def initialize(ripper_token)
28
- @token = ripper_token.freeze
29
- end
30
-
31
- def location
32
- @location ||= Location.new(*token[0])
33
- end
34
-
35
- def type
36
- token[1]
37
- end
38
-
39
- def string
40
- token[2]
41
- end
42
-
43
- def ==(other)
44
- token == other.token
45
- end
46
-
47
- alias_method :eql?, :==
48
-
49
- def inspect
50
- "#<#{self.class} #{type} #{string.inspect}>"
51
- end
52
-
53
- def keyword?
54
- type == :on_kw
55
- end
56
-
57
- def opening?
58
- opening_delimiter? || opening_keyword?
59
- end
60
-
61
- def closed_by?(other)
62
- closed_by_delimiter?(other) || closed_by_keyword?(other)
63
- end
64
-
65
- private
66
-
67
- def opening_delimiter?
68
- CLOSING_TYPES_BY_OPENING_TYPE.key?(type)
69
- end
70
-
71
- def opening_keyword?
72
- return false unless keyword?
73
- CLOSING_KEYWORDS_BY_OPENING_KEYWORD.key?(string)
74
- end
75
-
76
- def closed_by_delimiter?(other)
77
- other.type == CLOSING_TYPES_BY_OPENING_TYPE[type]
78
- end
79
-
80
- def closed_by_keyword?(other)
81
- return false unless other.keyword?
82
- other.string == CLOSING_KEYWORDS_BY_OPENING_KEYWORD[string]
83
- end
84
- end
85
- end
86
- end
87
- end