rspec-core 3.6.0.beta1 → 3.6.0.beta2

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: 9750d19aad7f7ef5eb954f4f6a9bc4730d7a09c7
4
- data.tar.gz: 64fe3413f9233665ca9e9ed11f08c0053b3024c9
3
+ metadata.gz: cedf9914463a5f8470ddb33bef491f31615a7b63
4
+ data.tar.gz: 8eecab50a480c797c96f53932f955643f23db6eb
5
5
  SHA512:
6
- metadata.gz: 4565a663755384105496c948d14b93fa0bc8fb752ac3e2f2c201f42c5c463ac19cccbf3cddc8cdf025b337d46f361e8fc9a385fd5ffb5be3eaa02804a937c132
7
- data.tar.gz: eb1bb367afa8fd11bfb7e838df3fe933edff6a4bdfaa0b649ccbc9ce24b294ac1a94e37bd51c01b8522c816ba8ad0ea3a99bd0aaeebd99c49c6b96928c6093d9
6
+ metadata.gz: a162b44414bcbd3ac23ee749f456976c10858bc84b8703a4ef63f370fcf8a691b7366ef8a9d0d2e15f7cecea6f38ce78379da1a25be1f75bf09ea9e913aa4939
7
+ data.tar.gz: f9a9b8815b6a42d5da60f033443dbf145b025058a6ec327c8a16fde556c83a753b1ed2bfd54ae85e02772fa54e8d7169c7323e034622b52ffbd9e3eab0826841
Binary file
data.tar.gz.sig CHANGED
Binary file
@@ -1,3 +1,14 @@
1
+ ### 3.6.0.beta2 / 2016-12-12
2
+ [Full Changelog](http://github.com/rspec/rspec-core/compare/v3.6.0.beta1...v3.6.0.beta2)
3
+
4
+ Enhancements:
5
+
6
+ * Include count of errors occurring outside examples in default summaries.
7
+ (#2351, Jon Rowe)
8
+ * Warn when including shared example groups recursively. (#2356, Jon Rowe)
9
+ * Improve failure snippet syntax highlighting with CodeRay to highlight
10
+ RSpec "keywords" like `expect`. (#2358, Myron Marston)
11
+
1
12
  ### 3.6.0.beta1 / 2016-10-09
2
13
  [Full Changelog](http://github.com/rspec/rspec-core/compare/v3.5.4...v3.6.0.beta1)
3
14
 
@@ -850,19 +850,22 @@ module RSpec
850
850
  end
851
851
 
852
852
  # @overload add_formatter(formatter)
853
- #
854
- # Adds a formatter to the formatters collection. `formatter` can be a
855
- # string representing any of the built-in formatters (see
856
- # `built_in_formatter`), or a custom formatter class.
857
- #
858
- # ### Note
859
- #
860
- # For internal purposes, `add_formatter` also accepts the name of a class
861
- # and paths to use for output streams, but you should consider that a
862
- # private api that may change at any time without notice.
863
- def add_formatter(formatter_to_use, *paths)
864
- paths << output_stream if paths.empty?
865
- formatter_loader.add formatter_to_use, *paths
853
+ # @overload add_formatter(formatter, output)
854
+ #
855
+ # @param formatter [Class, String] formatter to use. Can be any of the
856
+ # string values supported from the CLI (`p`/`progress`,
857
+ # `d`/`doc`/`documentation`, `h`/`html`, or `j`/`json`) or any
858
+ # class that implements the formatter protocol and has registered
859
+ # itself with RSpec as a formatter.
860
+ # @param output [String, IO] where the formatter will write its output.
861
+ # Can be an IO object or a string path to a file. If not provided,
862
+ # the configured `output_stream` (`$stdout`, by default) will be used.
863
+ #
864
+ # Adds a formatter to the set RSpec will use for this run.
865
+ #
866
+ # @see RSpec::Core::Formatters::Protocol
867
+ def add_formatter(formatter, output=output_stream)
868
+ formatter_loader.add(formatter, output)
866
869
  end
867
870
  alias_method :formatter=, :add_formatter
868
871
 
@@ -793,8 +793,12 @@ module RSpec
793
793
  # @private
794
794
  def self.with_frame(name, location)
795
795
  current_stack = shared_example_group_inclusions
796
- current_stack << new(name, location)
797
- yield
796
+ if current_stack.any? { |frame| frame.shared_group_name == name }
797
+ raise ArgumentError, "can't include shared examples recursively"
798
+ else
799
+ current_stack << new(name, location)
800
+ yield
801
+ end
798
802
  ensure
799
803
  current_stack.pop
800
804
  end
@@ -346,7 +346,10 @@ module RSpec
346
346
 
347
347
  failure = common_backtrace_truncater.with_truncated_backtrace(failure)
348
348
  presenter = ExceptionPresenter.new(failure, @example, options)
349
- presenter.fully_formatted_lines("#{failure_number}.#{index + 1}", colorizer)
349
+ presenter.fully_formatted_lines(
350
+ "#{failure_number ? "#{failure_number}." : ''}#{index + 1}",
351
+ colorizer
352
+ )
350
353
  end
351
354
  end
352
355
  end
@@ -69,10 +69,12 @@ module RSpec
69
69
  example = failure.example
70
70
 
71
71
  exception = failure.exception
72
+ message_lines = failure.fully_formatted_lines(nil, RSpec::Core::Notifications::NullColorizer)
72
73
  exception_details = if exception
73
74
  {
74
- :message => failure.message_lines.join("\n"),
75
- :backtrace => failure.formatted_backtrace.join("\n")
75
+ # drop 2 removes the description (regardless of newlines) and leading blank line
76
+ :message => message_lines.drop(2).join("\n"),
77
+ :backtrace => failure.formatted_backtrace.join("\n"),
76
78
  }
77
79
  end
78
80
  extra = extra_failure_content(failure)
@@ -24,6 +24,8 @@ module RSpec
24
24
  @@converter = NullConverter
25
25
  begin
26
26
  require 'coderay'
27
+ RSpec::Support.require_rspec_core 'source/syntax_highlighter'
28
+ RSpec::Core::Source::SyntaxHighlighter.attempt_to_add_rspec_terms_to_coderay_keywords
27
29
  @@converter = CoderayConverter
28
30
  # rubocop:disable Lint/HandleExceptions
29
31
  rescue LoadError
@@ -33,7 +33,7 @@ module RSpec
33
33
  # This will only be invoked once, and the next one to be invoked
34
34
  # is {#example_group_started}.
35
35
  #
36
- # @param notification [StartNotification]
36
+ # @param notification [Notifications::StartNotification]
37
37
 
38
38
  # @method example_group_started
39
39
  # @api public
@@ -45,8 +45,8 @@ module RSpec
45
45
  # The next method to be invoked after this is {#example_passed},
46
46
  # {#example_pending}, or {#example_group_finished}.
47
47
  #
48
- # @param notification [GroupNotification] containing example_group
49
- # subclass of `RSpec::Core::ExampleGroup`
48
+ # @param notification [Notifications::GroupNotification] containing example_group
49
+ # subclass of {ExampleGroup}
50
50
 
51
51
  # @method example_group_finished
52
52
  # @api public
@@ -54,8 +54,8 @@ module RSpec
54
54
  #
55
55
  # Invoked at the end of the execution of each example group.
56
56
  #
57
- # @param notification [GroupNotification] containing example_group
58
- # subclass of `RSpec::Core::ExampleGroup`
57
+ # @param notification [Notifications::GroupNotification] containing example_group
58
+ # subclass of {ExampleGroup}
59
59
 
60
60
  # @method example_started
61
61
  # @api public
@@ -63,8 +63,8 @@ module RSpec
63
63
  #
64
64
  # Invoked at the beginning of the execution of each example.
65
65
  #
66
- # @param notification [ExampleNotification] containing example subclass
67
- # of `RSpec::Core::Example`
66
+ # @param notification [Notifications::ExampleNotification] containing example subclass
67
+ # of {Example}
68
68
 
69
69
  # @method example_finished
70
70
  # @api public
@@ -72,8 +72,8 @@ module RSpec
72
72
  #
73
73
  # Invoked at the end of the execution of each example.
74
74
  #
75
- # @param notification [ExampleNotification] containing example subclass
76
- # of `RSpec::Core::Example`
75
+ # @param notification [Notifications::ExampleNotification] containing example subclass
76
+ # of {Example}
77
77
 
78
78
  # @method example_passed
79
79
  # @api public
@@ -81,8 +81,8 @@ module RSpec
81
81
  #
82
82
  # Invoked when an example passes.
83
83
  #
84
- # @param notification [ExampleNotification] containing example subclass
85
- # of `RSpec::Core::Example`
84
+ # @param notification [Notifications::ExampleNotification] containing example subclass
85
+ # of {Example}
86
86
 
87
87
  # @method example_pending
88
88
  # @api public
@@ -90,8 +90,8 @@ module RSpec
90
90
  #
91
91
  # Invoked when an example is pending.
92
92
  #
93
- # @param notification [ExampleNotification] containing example subclass
94
- # of `RSpec::Core::Example`
93
+ # @param notification [Notifications::ExampleNotification] containing example subclass
94
+ # of {Example}
95
95
 
96
96
  # @method example_failed
97
97
  # @api public
@@ -99,8 +99,8 @@ module RSpec
99
99
  #
100
100
  # Invoked when an example fails.
101
101
  #
102
- # @param notification [ExampleNotification] containing example subclass
103
- # of `RSpec::Core::Example`
102
+ # @param notification [Notifications::ExampleNotification] containing example subclass
103
+ # of {Example}
104
104
 
105
105
  # @method message
106
106
  # @api public
@@ -108,7 +108,7 @@ module RSpec
108
108
  #
109
109
  # Used by the reporter to send messages to the output stream.
110
110
  #
111
- # @param notification [MessageNotification] containing message
111
+ # @param notification [Notifications::MessageNotification] containing message
112
112
 
113
113
  # @method stop
114
114
  # @api public
@@ -117,7 +117,7 @@ module RSpec
117
117
  # Invoked after all examples have executed, before dumping post-run
118
118
  # reports.
119
119
  #
120
- # @param notification [NullNotification]
120
+ # @param notification [Notifications::NullNotification]
121
121
 
122
122
  # @method start_dump
123
123
  # @api public
@@ -128,7 +128,7 @@ module RSpec
128
128
  # (BaseTextFormatter then calls {#dump_failures} once for each failed
129
129
  # example).
130
130
  #
131
- # @param notification [NullNotification]
131
+ # @param notification [Notifications::NullNotification]
132
132
 
133
133
  # @method dump_failures
134
134
  # @api public
@@ -136,7 +136,7 @@ module RSpec
136
136
  #
137
137
  # Dumps detailed information about each example failure.
138
138
  #
139
- # @param notification [NullNotification]
139
+ # @param notification [Notifications::NullNotification]
140
140
 
141
141
  # @method dump_summary
142
142
  # @api public
@@ -145,7 +145,7 @@ module RSpec
145
145
  # This method is invoked after the dumping of examples and failures.
146
146
  # Each parameter is assigned to a corresponding attribute.
147
147
  #
148
- # @param summary [SummaryNotification] containing duration,
148
+ # @param summary [Notifications::SummaryNotification] containing duration,
149
149
  # example_count, failure_count and pending_count
150
150
 
151
151
  # @method dump_profile
@@ -155,7 +155,7 @@ module RSpec
155
155
  # This method is invoked after the dumping the summary if profiling is
156
156
  # enabled.
157
157
  #
158
- # @param profile [ProfileNotification] containing duration,
158
+ # @param profile [Notifications::ProfileNotification] containing duration,
159
159
  # slowest_examples and slowest_example_groups
160
160
 
161
161
  # @method dump_pending
@@ -165,7 +165,7 @@ module RSpec
165
165
  # Outputs a report of pending examples. This gets invoked
166
166
  # after the summary if option is set to do so.
167
167
  #
168
- # @param notification [NullNotification]
168
+ # @param notification [Notifications::NullNotification]
169
169
 
170
170
  # @method close
171
171
  # @api public
@@ -174,7 +174,7 @@ module RSpec
174
174
  # Invoked at the very end, `close` allows the formatter to clean
175
175
  # up resources, e.g. open streams, etc.
176
176
  #
177
- # @param notification [NullNotification]
177
+ # @param notification [Notifications::NullNotification]
178
178
  end
179
179
  end
180
180
  end
@@ -200,6 +200,12 @@ module RSpec::Core
200
200
  @exception_presenter.fully_formatted(failure_number, colorizer)
201
201
  end
202
202
 
203
+ # @return [Array<string>] The failure information fully formatted in the way that
204
+ # RSpec's built-in formatters emit, split by line.
205
+ def fully_formatted_lines(failure_number, colorizer=::RSpec::Core::Formatters::ConsoleCodes)
206
+ @exception_presenter.fully_formatted_lines(failure_number, colorizer)
207
+ end
208
+
203
209
  private
204
210
 
205
211
  def initialize(example, exception_presenter=Formatters::ExceptionPresenter::Factory.new(example).build)
@@ -281,8 +287,12 @@ module RSpec::Core
281
287
  # @attr pending_examples [Array<RSpec::Core::Example>] the pending examples
282
288
  # @attr load_time [Float] the number of seconds taken to boot RSpec
283
289
  # and load the spec files
290
+ # @attr errors_outside_of_examples_count [Integer] the number of errors that
291
+ # have occurred processing
292
+ # the spec suite
284
293
  SummaryNotification = Struct.new(:duration, :examples, :failed_examples,
285
- :pending_examples, :load_time)
294
+ :pending_examples, :load_time,
295
+ :errors_outside_of_examples_count)
286
296
  class SummaryNotification
287
297
  # @api
288
298
  # @return [Fixnum] the number of examples run
@@ -308,6 +318,11 @@ module RSpec::Core
308
318
  summary = Formatters::Helpers.pluralize(example_count, "example")
309
319
  summary << ", " << Formatters::Helpers.pluralize(failure_count, "failure")
310
320
  summary << ", #{pending_count} pending" if pending_count > 0
321
+ if errors_outside_of_examples_count > 0
322
+ summary << ", "
323
+ summary << Formatters::Helpers.pluralize(errors_outside_of_examples_count, "error")
324
+ summary << " occurred outside of examples"
325
+ end
311
326
  summary
312
327
  end
313
328
 
@@ -18,6 +18,7 @@ module RSpec::Core
18
18
  @failed_examples = []
19
19
  @pending_examples = []
20
20
  @duration = @start = @load_time = nil
21
+ @non_example_exception_count = 0
21
22
  end
22
23
 
23
24
  # @private
@@ -157,6 +158,7 @@ module RSpec::Core
157
158
  # Exceptions will be formatted the same way they normally are.
158
159
  def notify_non_example_exception(exception, context_description)
159
160
  @configuration.world.non_example_failure = true
161
+ @non_example_exception_count += 1
160
162
 
161
163
  example = Example.new(AnonymousExampleGroup, context_description, {})
162
164
  presenter = Formatters::ExceptionPresenter.new(exception, example, :indentation => 0)
@@ -177,7 +179,8 @@ module RSpec::Core
177
179
  @profiler.example_groups)
178
180
  end
179
181
  notify :dump_summary, Notifications::SummaryNotification.new(@duration, @examples, @failed_examples,
180
- @pending_examples, @load_time)
182
+ @pending_examples, @load_time,
183
+ @non_example_exception_count)
181
184
  notify :seed, Notifications::SeedNotification.new(@configuration.seed, seed_used?)
182
185
  end
183
186
  end
@@ -153,6 +153,12 @@ module RSpec
153
153
  # @private
154
154
  class Registry
155
155
  def add(context, name, *metadata_args, &block)
156
+ unless block
157
+ RSpec.warning "Shared example group #{name} was defined without a "\
158
+ "block and will have no effect. Please define a "\
159
+ "block or remove the definition."
160
+ end
161
+
156
162
  if RSpec.configuration.shared_context_metadata_behavior == :trigger_inclusion
157
163
  return legacy_add(context, name, *metadata_args, &block)
158
164
  end
@@ -31,12 +31,32 @@ module RSpec
31
31
  def color_enabled_implementation
32
32
  @color_enabled_implementation ||= begin
33
33
  require 'coderay'
34
+ self.class.attempt_to_add_rspec_terms_to_coderay_keywords
34
35
  CodeRayImplementation
35
36
  rescue LoadError
36
37
  NoSyntaxHighlightingImplementation
37
38
  end
38
39
  end
39
40
 
41
+ # rubocop:disable Lint/RescueException
42
+ # rubocop:disable Lint/HandleExceptions
43
+ def self.attempt_to_add_rspec_terms_to_coderay_keywords
44
+ CodeRay::Scanners::Ruby::Patterns::IDENT_KIND.add(%w[
45
+ describe context
46
+ it specify
47
+ before after around
48
+ let subject
49
+ expect allow
50
+ ], :keyword)
51
+ rescue Exception
52
+ # Mutating CodeRay's contants like this is not a public API
53
+ # and might not always work. If we cannot add our keywords
54
+ # to CodeRay it is not a big deal and not worth raising an
55
+ # error over, so we ignore it.
56
+ end
57
+ # rubocop:enable Lint/HandleExceptions
58
+ # rubocop:enable Lint/RescueException
59
+
40
60
  # @private
41
61
  module CodeRayImplementation
42
62
  RESET_CODE = "\e[0m"
@@ -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.6.0.beta1'
6
+ STRING = '3.6.0.beta2'
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.6.0.beta1
4
+ version: 3.6.0.beta2
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-10 00:00:00.000000000 Z
49
+ date: 2016-12-12 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.6.0.beta1
57
+ version: 3.6.0.beta2
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.6.0.beta1
64
+ version: 3.6.0.beta2
65
65
  - !ruby/object:Gem::Dependency
66
66
  name: cucumber
67
67
  requirement: !ruby/object:Gem::Requirement
@@ -280,9 +280,9 @@ required_rubygems_version: !ruby/object:Gem::Requirement
280
280
  version: 1.3.1
281
281
  requirements: []
282
282
  rubyforge_project:
283
- rubygems_version: 2.2.2
283
+ rubygems_version: 2.5.1
284
284
  signing_key:
285
285
  specification_version: 4
286
- summary: rspec-core-3.6.0.beta1
286
+ summary: rspec-core-3.6.0.beta2
287
287
  test_files: []
288
288
  has_rdoc:
metadata.gz.sig CHANGED
Binary file