rspec-core 2.14.5 → 2.14.6

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml ADDED
@@ -0,0 +1,15 @@
1
+ ---
2
+ !binary "U0hBMQ==":
3
+ metadata.gz: !binary |-
4
+ MGY4NjE0Y2VlYmNhNGIwMGQ1NmFhMTgyODY5MTg4MWUzZDYzODNkOA==
5
+ data.tar.gz: !binary |-
6
+ NzA5NDYzZmM4MzE5NjZkZTcwNTVkZmY2ZDY1NzZlYWI3MTU5NzJkOA==
7
+ !binary "U0hBNTEy":
8
+ metadata.gz: !binary |-
9
+ N2IyZWNhMzBmNWZkYzcxZTI2MGQ2MmZiNDA1ODE3ODE4MGExYmYwY2E2MWMx
10
+ MjYzNmI1NmYxNzhiNmEyN2NkNzY5NmRlOTFhOWExN2Y0MmQ4ODEzZTY1ZDll
11
+ ZTkxYTlkN2JjMWJmNzE3ZmZlY2E1NzU1NDYwYWJkOWNmMzA0ZjA=
12
+ data.tar.gz: !binary |-
13
+ MGM2OTRiZDI5YzdhOTk3NmIwZTJlN2M4OTJmZTRjODEwMGQzOWJmOWQ0MTEy
14
+ ZjVkYzJmMTBhMmZlYmI2NWQxYjgzODdlMDI3YWE5ODNkOTY1MTBkMDdhZmYz
15
+ YWNkNGRkODI4MDMxYzUxMjhjNDM2NDE5MTBkODdmYzU0NDJjNjY=
data/Changelog.md CHANGED
@@ -1,3 +1,12 @@
1
+ ### 2.14.6 / 2013-10-15
2
+ [full changelog](http://github.com/rspec/rspec-core/compare/v2.14.5...v2.14.6)
3
+
4
+ Bug fixes:
5
+
6
+ * Format stringified numbers correctly when mathn library is loaded.
7
+ (Jay Hayes)
8
+ * Fix an issue that prevented the use of frozen error objects. (Lars Gierth)
9
+
1
10
  ### 2.14.5 / 2013-08-13
2
11
  [full changelog](http://github.com/rspec/rspec-core/compare/v2.14.4...v2.14.5)
3
12
 
@@ -264,14 +264,8 @@ An error occurred #{context}
264
264
  record :started_at => RSpec::Core::Time.now
265
265
  end
266
266
 
267
- # @private
268
- module NotPendingExampleFixed
269
- def pending_fixed?; false; end
270
- end
271
-
272
267
  def finish(reporter)
273
268
  if @exception
274
- @exception.extend(NotPendingExampleFixed) unless @exception.respond_to?(:pending_fixed?)
275
269
  record_finished 'failed', :exception => @exception
276
270
  reporter.example_failed self
277
271
  false
@@ -285,7 +285,7 @@ module RSpec
285
285
  end
286
286
 
287
287
  def pending_fixed?(example)
288
- example.execution_result[:exception].pending_fixed?
288
+ example.execution_result[:pending_fixed]
289
289
  end
290
290
 
291
291
  def dump_failure(example, index)
@@ -51,7 +51,7 @@ module RSpec
51
51
  end
52
52
 
53
53
  if duration > 60
54
- minutes = duration.to_i / 60
54
+ minutes = (duration.to_i / 60).to_i
55
55
  seconds = duration - minutes * 60
56
56
 
57
57
  "#{pluralize(minutes, 'minute')} #{pluralize(format_seconds(seconds, precision), 'second')}"
@@ -94,7 +94,7 @@ module RSpec
94
94
  extra = extra_failure_content(exception)
95
95
 
96
96
  @printer.print_example_failed(
97
- exception.pending_fixed?,
97
+ example.execution_result[:pending_fixed],
98
98
  example.description,
99
99
  example.execution_result[:run_time],
100
100
  @failed_examples.size,
@@ -128,7 +128,7 @@ module RSpec
128
128
  def percent_done
129
129
  result = 100.0
130
130
  if @example_count > 0
131
- result = ((example_number).to_f / @example_count.to_f * 1000).to_i / 10.0
131
+ result = (((example_number).to_f / @example_count.to_f * 1000).to_i / 10.0).to_f
132
132
  end
133
133
  result
134
134
  end
@@ -11,10 +11,6 @@ module RSpec
11
11
  class PendingExampleFixedError < StandardError; end
12
12
  end
13
13
 
14
- class PendingExampleFixedError
15
- def pending_fixed?; true; end
16
- end
17
-
18
14
  NO_REASON_GIVEN = 'No reason given'
19
15
  NOT_YET_IMPLEMENTED = 'Not yet implemented'
20
16
 
@@ -87,6 +83,7 @@ module RSpec
87
83
 
88
84
  example.metadata[:pending] = true
89
85
  example.metadata[:execution_result][:pending_message] = message
86
+ example.execution_result[:pending_fixed] = false
90
87
  if block_given?
91
88
  begin
92
89
  result = begin
@@ -100,7 +97,10 @@ module RSpec
100
97
  ensure
101
98
  teardown_mocks_for_rspec
102
99
  end
103
- raise PendingExampleFixedError.new if result
100
+ if result
101
+ example.execution_result[:pending_fixed] = true
102
+ raise PendingExampleFixedError.new
103
+ end
104
104
  end
105
105
  raise PendingDeclaredInExample.new(message)
106
106
  end
@@ -1,7 +1,7 @@
1
1
  module RSpec
2
2
  module Core
3
3
  module Version
4
- STRING = '2.14.5'
4
+ STRING = '2.14.6'
5
5
  end
6
6
  end
7
7
  end
@@ -45,20 +45,6 @@ describe RSpec::Core::Example, :parent_metadata => 'sample' do
45
45
  example_group.run
46
46
  expect(example.exception).to be_nil
47
47
  end
48
-
49
- it "returns false for pending_fixed? if not pending fixed" do
50
- example = example_group.example { fail }
51
- example_group.run
52
- expect(example.exception).not_to be_pending_fixed
53
- end
54
-
55
- it "returns true for pending_fixed? if pending fixed" do
56
- example = example_group.example do
57
- pending("fixed") {}
58
- end
59
- example_group.run
60
- expect(example.exception).to be_pending_fixed
61
- end
62
48
  end
63
49
 
64
50
  describe "when there is an explicit description" do
@@ -345,6 +331,22 @@ describe RSpec::Core::Example, :parent_metadata => 'sample' do
345
331
  message = run_and_capture_reported_message(group)
346
332
  expect(message).to be_nil
347
333
  end
334
+
335
+ it "leaves a raised exception unmodified (GH-1103)" do
336
+ # set the backtrace, otherwise MRI will build a whole new object,
337
+ # and thus mess with our expectations. Rubinius and JRuby are not
338
+ # affected.
339
+ exception = StandardError.new
340
+ exception.set_backtrace([])
341
+
342
+ group = RSpec::Core::ExampleGroup.describe do
343
+ example { raise exception.freeze }
344
+ end
345
+ group.run
346
+
347
+ actual = group.examples.first.metadata[:execution_result][:exception]
348
+ expect(actual.__id__).to eq(exception.__id__)
349
+ end
348
350
  end
349
351
  end
350
352
 
@@ -370,6 +372,30 @@ describe RSpec::Core::Example, :parent_metadata => 'sample' do
370
372
  group.run
371
373
  expect(blah).to be(:success)
372
374
  end
375
+
376
+ context "with a block" do
377
+ it "sets the example to pending if block fails" do
378
+ group = RSpec::Core::ExampleGroup.describe do
379
+ example do
380
+ pending { expect(1).to eq(2) }
381
+ end
382
+ end
383
+ group.run
384
+ expect(group.examples.first.metadata[:execution_result][:status]).to eq('pending')
385
+ expect(group.examples.first.metadata[:execution_result][:pending_fixed]).to eq(false)
386
+ end
387
+
388
+ it "fails if block is fixed, i.e. does not raise" do
389
+ group = RSpec::Core::ExampleGroup.describe do
390
+ example do
391
+ pending {}
392
+ end
393
+ end
394
+ group.run
395
+ expect(group.examples.first.metadata[:execution_result][:status]).to eq('failed')
396
+ expect(group.examples.first.metadata[:execution_result][:pending_fixed]).to eq(true)
397
+ end
398
+ end
373
399
  end
374
400
 
375
401
  context "in before(:each)" do
@@ -46,6 +46,16 @@ describe RSpec::Core::Formatters::Helpers do
46
46
  expect(helper.format_duration(1)).to eq("1 second")
47
47
  end
48
48
  end
49
+
50
+ context 'with mathn loaded' do
51
+ include MathnIntegrationSupport
52
+
53
+ it "returns 'x minutes xx.x seconds' formatted string" do
54
+ with_mathn_loaded do
55
+ expect(helper.format_duration(133.7)).to eq("2 minutes 13.7 seconds")
56
+ end
57
+ end
58
+ end
49
59
  end
50
60
 
51
61
  describe "format seconds" do
@@ -68,24 +68,39 @@ module RSpec
68
68
  select {|e| e =~ /formatter_specs\.rb/}
69
69
  end
70
70
 
71
- it "produces HTML identical to the one we designed manually" do
72
- Dir.chdir(root) do
73
- actual_doc = Nokogiri::HTML(generated_html)
74
- actual_backtraces = extract_backtrace_from(actual_doc)
75
- actual_doc.css("div.backtrace").remove
76
-
77
- expected_doc = Nokogiri::HTML(expected_html)
78
- expected_backtraces = extract_backtrace_from(expected_doc)
79
- expected_doc.search("div.backtrace").remove
80
-
81
- expect(actual_doc.inner_html).to eq(expected_doc.inner_html)
82
-
83
- expected_backtraces.each_with_index do |expected_line, i|
84
- expected_path, expected_line_number, expected_suffix = expected_line.split(':')
85
- actual_path, actual_line_number, actual_suffix = actual_backtraces[i].split(':')
86
- expect(File.expand_path(actual_path)).to eq(File.expand_path(expected_path))
87
- expect(actual_line_number).to eq(expected_line_number)
88
- expect(actual_suffix).to eq(expected_suffix)
71
+ describe 'produced HTML' do
72
+ def build_and_verify_formatter_output
73
+ Dir.chdir(root) do
74
+ actual_doc = Nokogiri::HTML(generated_html)
75
+ actual_backtraces = extract_backtrace_from(actual_doc)
76
+ actual_doc.css("div.backtrace").remove
77
+
78
+ expected_doc = Nokogiri::HTML(expected_html)
79
+ expected_backtraces = extract_backtrace_from(expected_doc)
80
+ expected_doc.search("div.backtrace").remove
81
+
82
+ expect(actual_doc.inner_html).to eq(expected_doc.inner_html)
83
+
84
+ expected_backtraces.each_with_index do |expected_line, i|
85
+ expected_path, expected_line_number, expected_suffix = expected_line.split(':')
86
+ actual_path, actual_line_number, actual_suffix = actual_backtraces[i].split(':')
87
+
88
+ expect(File.expand_path(actual_path)).to eq(File.expand_path(expected_path))
89
+ expect(actual_line_number).to eq(expected_line_number)
90
+ expect(actual_suffix).to eq(expected_suffix)
91
+ end
92
+ end
93
+ end
94
+
95
+ it "produces HTML identical to the one we designed manually" do
96
+ build_and_verify_formatter_output
97
+ end
98
+
99
+ context 'with mathn loaded' do
100
+ include MathnIntegrationSupport
101
+
102
+ it "produces HTML identical to the one we designed manually" do
103
+ with_mathn_loaded{ build_and_verify_formatter_output }
89
104
  end
90
105
  end
91
106
  end
@@ -0,0 +1,37 @@
1
+ module InSubProcess
2
+ if RUBY_PLATFORM == 'java'
3
+ def in_sub_process
4
+ pending "This spec requires forking to work properly, " +
5
+ "and JRuby does not support forking"
6
+ end
7
+ else
8
+ # Useful as a way to isolate a global change to a subprocess.
9
+ def in_sub_process
10
+ readme, writeme = IO.pipe
11
+
12
+ pid = Process.fork do
13
+ exception = nil
14
+ begin
15
+ yield
16
+ rescue Exception => e
17
+ exception = e
18
+ end
19
+
20
+ writeme.write Marshal.dump(exception)
21
+
22
+ readme.close
23
+ writeme.close
24
+ exit! # prevent at_exit hooks from running (e.g. minitest)
25
+ end
26
+
27
+ writeme.close
28
+ Process.waitpid(pid)
29
+
30
+ exception = Marshal.load(readme.read)
31
+ readme.close
32
+
33
+ raise exception if exception
34
+ end
35
+ end
36
+ end
37
+
@@ -0,0 +1,12 @@
1
+ require 'support/in_sub_process'
2
+
3
+ module MathnIntegrationSupport
4
+ include InSubProcess
5
+
6
+ def with_mathn_loaded
7
+ in_sub_process do
8
+ require 'mathn'
9
+ yield
10
+ end
11
+ end
12
+ end
metadata CHANGED
@@ -1,8 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: rspec-core
3
3
  version: !ruby/object:Gem::Version
4
- prerelease:
5
- version: 2.14.5
4
+ version: 2.14.6
6
5
  platform: ruby
7
6
  authors:
8
7
  - Steven Baker
@@ -11,152 +10,134 @@ authors:
11
10
  autorequire:
12
11
  bindir: exe
13
12
  cert_chain: []
14
- date: 2013-08-14 00:00:00.000000000 Z
13
+ date: 2013-10-16 00:00:00.000000000 Z
15
14
  dependencies:
16
15
  - !ruby/object:Gem::Dependency
17
- version_requirements: !ruby/object:Gem::Requirement
18
- requirements:
19
- - - ~>
20
- - !ruby/object:Gem::Version
21
- version: 10.0.0
22
- none: false
23
- prerelease: false
24
16
  name: rake
25
17
  requirement: !ruby/object:Gem::Requirement
26
18
  requirements:
27
19
  - - ~>
28
20
  - !ruby/object:Gem::Version
29
21
  version: 10.0.0
30
- none: false
31
22
  type: :development
32
- - !ruby/object:Gem::Dependency
23
+ prerelease: false
33
24
  version_requirements: !ruby/object:Gem::Requirement
34
25
  requirements:
35
26
  - - ~>
36
27
  - !ruby/object:Gem::Version
37
- version: 1.1.9
38
- none: false
39
- prerelease: false
28
+ version: 10.0.0
29
+ - !ruby/object:Gem::Dependency
40
30
  name: cucumber
41
31
  requirement: !ruby/object:Gem::Requirement
42
32
  requirements:
43
33
  - - ~>
44
34
  - !ruby/object:Gem::Version
45
35
  version: 1.1.9
46
- none: false
47
36
  type: :development
48
- - !ruby/object:Gem::Dependency
37
+ prerelease: false
49
38
  version_requirements: !ruby/object:Gem::Requirement
50
39
  requirements:
51
40
  - - ~>
52
41
  - !ruby/object:Gem::Version
53
- version: '0.5'
54
- none: false
55
- prerelease: false
42
+ version: 1.1.9
43
+ - !ruby/object:Gem::Dependency
56
44
  name: aruba
57
45
  requirement: !ruby/object:Gem::Requirement
58
46
  requirements:
59
47
  - - ~>
60
48
  - !ruby/object:Gem::Version
61
49
  version: '0.5'
62
- none: false
63
50
  type: :development
64
- - !ruby/object:Gem::Dependency
51
+ prerelease: false
65
52
  version_requirements: !ruby/object:Gem::Requirement
66
53
  requirements:
67
54
  - - ~>
68
55
  - !ruby/object:Gem::Version
69
- version: '4.6'
70
- none: false
71
- prerelease: false
56
+ version: '0.5'
57
+ - !ruby/object:Gem::Dependency
72
58
  name: ZenTest
73
59
  requirement: !ruby/object:Gem::Requirement
74
60
  requirements:
75
61
  - - ~>
76
62
  - !ruby/object:Gem::Version
77
63
  version: '4.6'
78
- none: false
79
64
  type: :development
80
- - !ruby/object:Gem::Dependency
65
+ prerelease: false
81
66
  version_requirements: !ruby/object:Gem::Requirement
82
67
  requirements:
83
- - - '='
68
+ - - ~>
84
69
  - !ruby/object:Gem::Version
85
- version: 1.5.2
86
- none: false
87
- prerelease: false
70
+ version: '4.6'
71
+ - !ruby/object:Gem::Dependency
88
72
  name: nokogiri
89
73
  requirement: !ruby/object:Gem::Requirement
90
74
  requirements:
91
75
  - - '='
92
76
  - !ruby/object:Gem::Version
93
77
  version: 1.5.2
94
- none: false
95
78
  type: :development
96
- - !ruby/object:Gem::Dependency
79
+ prerelease: false
97
80
  version_requirements: !ruby/object:Gem::Requirement
98
81
  requirements:
99
82
  - - '='
100
83
  - !ruby/object:Gem::Version
101
- version: 1.0.0
102
- none: false
103
- prerelease: false
84
+ version: 1.5.2
85
+ - !ruby/object:Gem::Dependency
104
86
  name: syntax
105
87
  requirement: !ruby/object:Gem::Requirement
106
88
  requirements:
107
89
  - - '='
108
90
  - !ruby/object:Gem::Version
109
91
  version: 1.0.0
110
- none: false
111
92
  type: :development
112
- - !ruby/object:Gem::Dependency
93
+ prerelease: false
113
94
  version_requirements: !ruby/object:Gem::Requirement
114
95
  requirements:
115
- - - ~>
96
+ - - '='
116
97
  - !ruby/object:Gem::Version
117
- version: 0.13.0
118
- none: false
119
- prerelease: false
98
+ version: 1.0.0
99
+ - !ruby/object:Gem::Dependency
120
100
  name: mocha
121
101
  requirement: !ruby/object:Gem::Requirement
122
102
  requirements:
123
103
  - - ~>
124
104
  - !ruby/object:Gem::Version
125
105
  version: 0.13.0
126
- none: false
127
106
  type: :development
128
- - !ruby/object:Gem::Dependency
107
+ prerelease: false
129
108
  version_requirements: !ruby/object:Gem::Requirement
130
109
  requirements:
131
110
  - - ~>
132
111
  - !ruby/object:Gem::Version
133
- version: 1.0.4
134
- none: false
135
- prerelease: false
112
+ version: 0.13.0
113
+ - !ruby/object:Gem::Dependency
136
114
  name: rr
137
115
  requirement: !ruby/object:Gem::Requirement
138
116
  requirements:
139
117
  - - ~>
140
118
  - !ruby/object:Gem::Version
141
119
  version: 1.0.4
142
- none: false
143
120
  type: :development
144
- - !ruby/object:Gem::Dependency
121
+ prerelease: false
145
122
  version_requirements: !ruby/object:Gem::Requirement
146
123
  requirements:
147
124
  - - ~>
148
125
  - !ruby/object:Gem::Version
149
- version: 0.9.0
150
- none: false
151
- prerelease: false
126
+ version: 1.0.4
127
+ - !ruby/object:Gem::Dependency
152
128
  name: flexmock
153
129
  requirement: !ruby/object:Gem::Requirement
154
130
  requirements:
155
131
  - - ~>
156
132
  - !ruby/object:Gem::Version
157
133
  version: 0.9.0
158
- none: false
159
134
  type: :development
135
+ prerelease: false
136
+ version_requirements: !ruby/object:Gem::Requirement
137
+ requirements:
138
+ - - ~>
139
+ - !ruby/object:Gem::Version
140
+ version: 0.9.0
160
141
  description: BDD for Ruby. RSpec runner and example groups.
161
142
  email: rspec-users@rubyforge.org
162
143
  executables:
@@ -359,10 +340,12 @@ files:
359
340
  - spec/spec_helper.rb
360
341
  - spec/support/config_options_helper.rb
361
342
  - spec/support/helper_methods.rb
343
+ - spec/support/in_sub_process.rb
362
344
  - spec/support/isolate_load_path_mutation.rb
363
345
  - spec/support/isolated_directory.rb
364
346
  - spec/support/isolated_home_directory.rb
365
347
  - spec/support/matchers.rb
348
+ - spec/support/mathn_integration_support.rb
366
349
  - spec/support/sandboxed_mock_space.rb
367
350
  - spec/support/shared_example_groups.rb
368
351
  - spec/support/spec_files.rb
@@ -371,6 +354,7 @@ files:
371
354
  homepage: http://github.com/rspec/rspec-core
372
355
  licenses:
373
356
  - MIT
357
+ metadata: {}
374
358
  post_install_message:
375
359
  rdoc_options:
376
360
  - --charset=UTF-8
@@ -381,25 +365,17 @@ required_ruby_version: !ruby/object:Gem::Requirement
381
365
  - - ! '>='
382
366
  - !ruby/object:Gem::Version
383
367
  version: '0'
384
- segments:
385
- - 0
386
- hash: 2492327081030983877
387
- none: false
388
368
  required_rubygems_version: !ruby/object:Gem::Requirement
389
369
  requirements:
390
370
  - - ! '>='
391
371
  - !ruby/object:Gem::Version
392
372
  version: '0'
393
- segments:
394
- - 0
395
- hash: 2492327081030983877
396
- none: false
397
373
  requirements: []
398
374
  rubyforge_project: rspec
399
- rubygems_version: 1.8.24
375
+ rubygems_version: 2.0.7
400
376
  signing_key:
401
- specification_version: 3
402
- summary: rspec-core-2.14.5
377
+ specification_version: 4
378
+ summary: rspec-core-2.14.6
403
379
  test_files:
404
380
  - features/Autotest.md
405
381
  - features/README.md
@@ -537,10 +513,12 @@ test_files:
537
513
  - spec/spec_helper.rb
538
514
  - spec/support/config_options_helper.rb
539
515
  - spec/support/helper_methods.rb
516
+ - spec/support/in_sub_process.rb
540
517
  - spec/support/isolate_load_path_mutation.rb
541
518
  - spec/support/isolated_directory.rb
542
519
  - spec/support/isolated_home_directory.rb
543
520
  - spec/support/matchers.rb
521
+ - spec/support/mathn_integration_support.rb
544
522
  - spec/support/sandboxed_mock_space.rb
545
523
  - spec/support/shared_example_groups.rb
546
524
  - spec/support/spec_files.rb