rspec-core 3.5.0.beta4 → 3.5.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.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 869c418b1e6c72f2af99494959561aad32116de1
4
- data.tar.gz: 112822b696a2ad0b8679a0a59d5fd411d528acaf
3
+ metadata.gz: 48b30f78fc81b772c3546f4bf60a8c375396a642
4
+ data.tar.gz: 614a957ebe046aad31a3f79be0a15eb475a57b55
5
5
  SHA512:
6
- metadata.gz: 1fbe6dc5949d8a192d76ee6f27ad90f1166e557c70a2d3ac9c898e4b700f60778234cd672a2de14bdb0304a11c5918527bd21935a315ba94c84916bb2b418445
7
- data.tar.gz: 4354f81e094d54d517a46c738001c5f7f77f8d55e1e4f2a2d229a5f260aece474720f6f9a07fdc1015f57fbd89ca93e0ceef2d5d88e34d7d86afc33a94b2f1cf
6
+ metadata.gz: f5548e10c144396ab4922516d43e109c8280085153bebe01963745f543714b2568203aae83eb8ba8c627e37d0d5364469761915eb51572bbc185ae759273f8b4
7
+ data.tar.gz: f6ee8389462ab8ad0fa78d87ef230c7f0f4ebb21f77a6d23dbfc1daa3e6ad348c1e43d02a7041ecb88ec44cf1f2afae27909a2ab76a8d583eb21f5dd3a17c4ab
Binary file
data.tar.gz.sig CHANGED
Binary file
@@ -1,5 +1,15 @@
1
- ### 3.5 Development
2
- [Full Changelog](http://github.com/rspec/rspec-core/compare/v3.5.0.beta4...master)
1
+ ### 3.5.0 / 2016-07-01
2
+ [Full Changelog](http://github.com/rspec/rspec-core/compare/v3.5.0.beta4...v3.5.0)
3
+
4
+ Enhancements:
5
+
6
+ * Include any `SPEC_OPTS` in reproduction command printed at the end of
7
+ a bisect run. (Simon Coffey, #2274)
8
+
9
+ Bug Fixes:
10
+
11
+ * Handle `--bisect` in `SPEC_OPTS` environment variable correctly so as
12
+ to avoid infinite recursion. (Simon Coffey, #2271)
3
13
 
4
14
  ### 3.5.0.beta4 / 2016-06-05
5
15
  [Full Changelog](http://github.com/rspec/rspec-core/compare/v3.5.0.beta3...v3.5.0.beta4)
@@ -31,6 +31,7 @@ RSpec::Support.define_optimized_require_for_rspec(:core) { |f| require_relative
31
31
  option_parser
32
32
  configuration_options
33
33
  runner
34
+ invocations
34
35
  example
35
36
  shared_example_group
36
37
  example_group
@@ -1,5 +1,6 @@
1
1
  RSpec::Support.require_rspec_core "shell_escape"
2
2
  require 'open3'
3
+ require 'shellwords'
3
4
 
4
5
  module RSpec
5
6
  module Core
@@ -37,6 +38,7 @@ module RSpec
37
38
  def repro_command_from(locations)
38
39
  parts = []
39
40
 
41
+ parts.concat environment_repro_parts
40
42
  parts << "rspec"
41
43
  parts.concat Formatters::Helpers.organize_ids(locations)
42
44
  parts.concat original_cli_args_without_locations
@@ -71,13 +73,16 @@ module RSpec
71
73
  # https://github.com/jruby/jruby/issues/2766
72
74
  if Open3.respond_to?(:capture2e) && !RSpec::Support::Ruby.jruby?
73
75
  def run_command(cmd)
74
- Open3.capture2e(cmd).first
76
+ Open3.capture2e(bisect_environment_hash, cmd).first
75
77
  end
76
78
  else # for 1.8.7
77
79
  # :nocov:
78
80
  def run_command(cmd)
79
81
  out = err = nil
80
82
 
83
+ original_spec_opts = ENV['SPEC_OPTS']
84
+ ENV['SPEC_OPTS'] = spec_opts_without_bisect
85
+
81
86
  Open3.popen3(cmd) do |_, stdout, stderr|
82
87
  # Reading the streams blocks until the process is complete
83
88
  out = stdout.read
@@ -85,10 +90,34 @@ module RSpec
85
90
  end
86
91
 
87
92
  "Stdout:\n#{out}\n\nStderr:\n#{err}"
93
+ ensure
94
+ ENV['SPEC_OPTS'] = original_spec_opts
88
95
  end
89
96
  # :nocov:
90
97
  end
91
98
 
99
+ def bisect_environment_hash
100
+ if ENV.key?('SPEC_OPTS')
101
+ { 'SPEC_OPTS' => spec_opts_without_bisect }
102
+ else
103
+ {}
104
+ end
105
+ end
106
+
107
+ def environment_repro_parts
108
+ bisect_environment_hash.map do |k, v|
109
+ %Q(#{k}="#{v}")
110
+ end
111
+ end
112
+
113
+ def spec_opts_without_bisect
114
+ Shellwords.join(
115
+ Shellwords.split(ENV.fetch('SPEC_OPTS', '')).reject do |arg|
116
+ arg =~ /^--bisect/
117
+ end
118
+ )
119
+ end
120
+
92
121
  def reusable_cli_options
93
122
  @reusable_cli_options ||= begin
94
123
  opts = original_cli_args_without_locations
@@ -35,6 +35,9 @@ module RSpec
35
35
  # @return [Hash] the final merged options, drawn from all external sources
36
36
  attr_reader :options
37
37
 
38
+ # @return [Array<String>] the original command-line arguments
39
+ attr_reader :args
40
+
38
41
  private
39
42
 
40
43
  def organize_options
@@ -0,0 +1,67 @@
1
+ module RSpec
2
+ module Core
3
+ # @private
4
+ module Invocations
5
+ # @private
6
+ class InitializeProject
7
+ def call(*_args)
8
+ RSpec::Support.require_rspec_core "project_initializer"
9
+ ProjectInitializer.new.run
10
+ 0
11
+ end
12
+ end
13
+
14
+ # @private
15
+ class DRbWithFallback
16
+ def call(options, err, out)
17
+ require 'rspec/core/drb'
18
+ begin
19
+ return DRbRunner.new(options).run(err, out)
20
+ rescue DRb::DRbConnError
21
+ err.puts "No DRb server is running. Running in local process instead ..."
22
+ end
23
+ RSpec::Core::Runner.new(options).run(err, out)
24
+ end
25
+ end
26
+
27
+ # @private
28
+ class Bisect
29
+ def call(options, _err, _out)
30
+ RSpec::Support.require_rspec_core "bisect/coordinator"
31
+
32
+ success = RSpec::Core::Bisect::Coordinator.bisect_with(
33
+ options.args,
34
+ RSpec.configuration,
35
+ bisect_formatter_for(options.options[:bisect])
36
+ )
37
+
38
+ success ? 0 : 1
39
+ end
40
+
41
+ private
42
+
43
+ def bisect_formatter_for(argument)
44
+ return Formatters::BisectDebugFormatter if argument == "verbose"
45
+ Formatters::BisectProgressFormatter
46
+ end
47
+ end
48
+
49
+ # @private
50
+ class PrintVersion
51
+ def call(_options, _err, out)
52
+ out.puts RSpec::Core::Version::STRING
53
+ 0
54
+ end
55
+ end
56
+
57
+ # @private
58
+ PrintHelp = Struct.new(:parser, :invalid_options) do
59
+ def call(_options, _err, out)
60
+ # Removing the blank invalid options from the output.
61
+ out.puts parser.to_s.gsub(/^\s+(#{invalid_options.join('|')})\s*$\n/, '')
62
+ 0
63
+ end
64
+ end
65
+ end
66
+ end
67
+ end
@@ -36,6 +36,7 @@ module RSpec::Core
36
36
  # rubocop:disable MethodLength
37
37
  # rubocop:disable Metrics/AbcSize
38
38
  # rubocop:disable CyclomaticComplexity
39
+ # rubocop:disable PerceivedComplexity
39
40
  def parser(options)
40
41
  OptionParser.new do |parser|
41
42
  parser.banner = "Usage: rspec [options] [files or directories]\n\n"
@@ -68,7 +69,8 @@ module RSpec::Core
68
69
 
69
70
  parser.on('--bisect[=verbose]', 'Repeatedly runs the suite in order to isolate the failures to the ',
70
71
  ' smallest reproducible case.') do |argument|
71
- bisect_and_exit(argument)
72
+ options[:bisect] = argument || true
73
+ options[:runner] = RSpec::Core::Invocations::Bisect.new
72
74
  end
73
75
 
74
76
  parser.on('--[no-]fail-fast[=COUNT]', 'Abort the run after a certain number of failures (1 by default).') do |argument|
@@ -96,8 +98,9 @@ module RSpec::Core
96
98
  options[:dry_run] = true
97
99
  end
98
100
 
99
- parser.on('-X', '--[no-]drb', 'Run examples via DRb.') do |o|
100
- options[:drb] = o
101
+ parser.on('-X', '--[no-]drb', 'Run examples via DRb.') do |use_drb|
102
+ options[:drb] = use_drb
103
+ options[:runner] = RSpec::Core::Invocations::DRbWithFallback.new if use_drb
101
104
  end
102
105
 
103
106
  parser.on('--drb-port PORT', 'Port to connect to the DRb server.') do |o|
@@ -105,7 +108,7 @@ module RSpec::Core
105
108
  end
106
109
 
107
110
  parser.on('--init', 'Initialize your project with RSpec.') do |_cmd|
108
- initialize_project_and_exit
111
+ options[:runner] = RSpec::Core::Invocations::InitializeProject.new
109
112
  end
110
113
 
111
114
  parser.separator("\n **** Output ****\n\n")
@@ -242,7 +245,7 @@ FILTERING
242
245
  parser.separator("\n **** Utility ****\n\n")
243
246
 
244
247
  parser.on('-v', '--version', 'Display the version.') do
245
- print_version_and_exit
248
+ options[:runner] = RSpec::Core::Invocations::PrintVersion.new
246
249
  end
247
250
 
248
251
  # These options would otherwise be confusing to users, so we forcibly
@@ -254,7 +257,7 @@ FILTERING
254
257
  invalid_options = %w[-d --I]
255
258
 
256
259
  parser.on_tail('-h', '--help', "You're looking at it.") do
257
- print_help_and_exit(parser, invalid_options)
260
+ options[:runner] = RSpec::Core::Invocations::PrintHelp.new(parser, invalid_options)
258
261
  end
259
262
 
260
263
  # This prevents usage of the invalid_options.
@@ -268,6 +271,7 @@ FILTERING
268
271
  # rubocop:enable Metrics/AbcSize
269
272
  # rubocop:enable MethodLength
270
273
  # rubocop:enable CyclomaticComplexity
274
+ # rubocop:enable PerceivedComplexity
271
275
 
272
276
  def add_tag_filter(options, filter_type, tag_name, value=true)
273
277
  (options[filter_type] ||= {})[tag_name] = value
@@ -281,39 +285,5 @@ FILTERING
281
285
  options[:only_failures] = true
282
286
  add_tag_filter(options, :inclusion_filter, :last_run_status, 'failed')
283
287
  end
284
-
285
- def initialize_project_and_exit
286
- RSpec::Support.require_rspec_core "project_initializer"
287
- ProjectInitializer.new.run
288
- exit
289
- end
290
-
291
- def bisect_and_exit(argument)
292
- RSpec::Support.require_rspec_core "bisect/coordinator"
293
-
294
- success = Bisect::Coordinator.bisect_with(
295
- original_args,
296
- RSpec.configuration,
297
- bisect_formatter_for(argument)
298
- )
299
-
300
- exit(success ? 0 : 1)
301
- end
302
-
303
- def bisect_formatter_for(argument)
304
- return Formatters::BisectDebugFormatter if argument == "verbose"
305
- Formatters::BisectProgressFormatter
306
- end
307
-
308
- def print_version_and_exit
309
- puts RSpec::Core::Version::STRING
310
- exit
311
- end
312
-
313
- def print_help_and_exit(parser, invalid_options)
314
- # Removing the blank invalid options from the output.
315
- puts parser.to_s.gsub(/^\s+(#{invalid_options.join('|')})\s*$\n/, '')
316
- exit
317
- end
318
288
  end
319
289
  end
@@ -65,17 +65,11 @@ module RSpec
65
65
  trap_interrupt
66
66
  options = ConfigurationOptions.new(args)
67
67
 
68
- if options.options[:drb]
69
- require 'rspec/core/drb'
70
- begin
71
- DRbRunner.new(options).run(err, out)
72
- return
73
- rescue DRb::DRbConnError
74
- err.puts "No DRb server is running. Running in local process instead ..."
75
- end
68
+ if options.options[:runner]
69
+ options.options[:runner].call(options, err, out)
70
+ else
71
+ new(options).run(err, out)
76
72
  end
77
-
78
- new(options).run(err, out)
79
73
  end
80
74
 
81
75
  def initialize(options, configuration=RSpec.configuration, world=RSpec.world)
@@ -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.5.0.beta4'
6
+ STRING = '3.5.0'
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.5.0.beta4
4
+ version: 3.5.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Steven Baker
@@ -46,22 +46,22 @@ cert_chain:
46
46
  ZsVDj6a7lH3cNqtWXZxrb2wO38qV5AkYj8SQK7Hj3/Yui9myUX3crr+PdetazSqQ
47
47
  F3MdtaDehhjC
48
48
  -----END CERTIFICATE-----
49
- date: 2016-06-05 00:00:00.000000000 Z
49
+ date: 2016-07-01 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.5.0.beta4
57
+ version: 3.5.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.beta4
64
+ version: 3.5.0
65
65
  - !ruby/object:Gem::Dependency
66
66
  name: cucumber
67
67
  requirement: !ruby/object:Gem::Requirement
@@ -223,6 +223,7 @@ files:
223
223
  - lib/rspec/core/formatters/protocol.rb
224
224
  - lib/rspec/core/formatters/snippet_extractor.rb
225
225
  - lib/rspec/core/hooks.rb
226
+ - lib/rspec/core/invocations.rb
226
227
  - lib/rspec/core/memoized_helpers.rb
227
228
  - lib/rspec/core/metadata.rb
228
229
  - lib/rspec/core/metadata_filter.rb
@@ -274,14 +275,14 @@ required_ruby_version: !ruby/object:Gem::Requirement
274
275
  version: 1.8.7
275
276
  required_rubygems_version: !ruby/object:Gem::Requirement
276
277
  requirements:
277
- - - ">"
278
+ - - ">="
278
279
  - !ruby/object:Gem::Version
279
- version: 1.3.1
280
+ version: '0'
280
281
  requirements: []
281
282
  rubyforge_project:
282
283
  rubygems_version: 2.5.1
283
284
  signing_key:
284
285
  specification_version: 4
285
- summary: rspec-core-3.5.0.beta4
286
+ summary: rspec-core-3.5.0
286
287
  test_files: []
287
288
  has_rdoc:
metadata.gz.sig CHANGED
Binary file