rspec-core 2.14.0 → 2.14.1

Sign up to get free protection for your applications and to get access to all the features.
@@ -1,3 +1,11 @@
1
+ ### 2.14.1 / 2013-07-08
2
+ [full changelog](http://github.com/rspec/rspec-core/compare/v2.14.0...v2.14.1)
3
+
4
+ Bug fixes
5
+
6
+ * Implement `#start` on the Deprecation Formatter to prevent collision with
7
+ `ruby-debug` on JRuby (Alex Portnov, Jon Rowe)
8
+
1
9
  ### 2.14.0 / 2013-07-06
2
10
  [full changelog](http://github.com/rspec/rspec-core/compare/v2.14.0.rc1...v2.14.0)
3
11
 
@@ -6,7 +14,7 @@ Enhancements
6
14
  * Apply focus to examples defined with `fit` (equivalent of
7
15
  `it "description", focus: true`) (Michael de Silva)
8
16
 
9
- Bug fix
17
+ Bug fixes
10
18
 
11
19
  * Ensure methods defined by `let` take precedence over others
12
20
  when there is a name collision (e.g. from an included module).
@@ -2,6 +2,7 @@ Feature: run with warnings enabled
2
2
 
3
3
  You can use the `--warnings` option to run specs with warnings enabled
4
4
 
5
+ @unsupported-on-rbx
5
6
  Scenario:
6
7
  Given a file named "example_spec.rb" with:
7
8
  """ruby
@@ -14,6 +15,7 @@ Feature: run with warnings enabled
14
15
  When I run `rspec --warnings example_spec.rb`
15
16
  Then the output should contain "warning"
16
17
 
18
+ @unsupported-on-rbx
17
19
  Scenario:
18
20
  Given a file named "example_spec.rb" with:
19
21
  """ruby
@@ -0,0 +1,6 @@
1
+ # Required until https://github.com/rubinius/rubinius/issues/2430 is resolved
2
+ ENV['RBXOPT'] = "#{ENV["RBXOPT"]} -Xcompiler.no_rbc"
3
+
4
+ Around "@unsupported-on-rbx" do |scenario, block|
5
+ block.call unless defined?(Rubinius)
6
+ end
@@ -21,7 +21,7 @@ module RSpec::Core
21
21
  # events to all registered listeners
22
22
  def register_listener(listener, *notifications)
23
23
  notifications.each do |notification|
24
- @listeners[notification.to_sym] << listener if listener.respond_to?(notification)
24
+ @listeners[notification.to_sym] << listener if understands(listener, notification)
25
25
  end
26
26
  true
27
27
  end
@@ -127,5 +127,19 @@ module RSpec::Core
127
127
  formatter.send(event, *args, &block)
128
128
  end
129
129
  end
130
+
131
+ private
132
+ if Method.method_defined?(:owner) # 1.8.6 lacks Method#owner
133
+ def understands(listener, notification)
134
+ listener.respond_to?(notification) && listener.method(notification).owner != ::Kernel
135
+ end
136
+ else
137
+ def understands(listener, notification)
138
+ # Hack for 1.8.6
139
+ # {}.method(:=~).to_s # => "#<Method: Hash(Kernel)#=~>"
140
+ listener.respond_to?(notification) && !listener.method(notification).to_s.include('(Kernel)')
141
+ end
142
+ end
143
+
130
144
  end
131
145
  end
@@ -27,10 +27,11 @@ module RSpec
27
27
 
28
28
  def warn_deprecation_and_fetch_anyway(key)
29
29
  if (example = fetch_anyway key)
30
+ backtrace_line = caller.find { |line| !line.include?('lib/rspec/core') }
30
31
  RSpec.warn_deprecation <<-WARNING.gsub(/^ /, '')
31
32
  Accessing shared_examples defined across contexts is deprecated.
32
33
  Please declare shared_examples within a shared context, or at the top level.
33
- This message was generated at: #{caller(0)[8]}
34
+ This message was generated at: #{backtrace_line}
34
35
  WARNING
35
36
  example
36
37
  end
@@ -1,7 +1,7 @@
1
1
  module RSpec
2
2
  module Core
3
3
  module Version
4
- STRING = '2.14.0'
4
+ STRING = '2.14.1'
5
5
  end
6
6
  end
7
7
  end
@@ -4,6 +4,7 @@ require 'tempfile'
4
4
 
5
5
  module RSpec::Core::Formatters
6
6
  describe DeprecationFormatter do
7
+
7
8
  describe "#deprecation" do
8
9
  let(:deprecation_stream) { StringIO.new }
9
10
  let(:summary_stream) { StringIO.new }
@@ -9,7 +9,7 @@ module RSpec::Core
9
9
 
10
10
  %w[start_dump dump_pending dump_failures dump_summary close].each do |message|
11
11
  it "sends #{message} to the formatter(s) that respond to message" do
12
- formatter.as_null_object.should_receive(message)
12
+ formatter.should_receive(message)
13
13
  reporter.abort(nil)
14
14
  end
15
15
 
@@ -34,7 +34,7 @@ module RSpec::Core
34
34
  it "passes example_group_started and example_group_finished messages to that formatter in that order" do
35
35
  order = []
36
36
 
37
- formatter = double("formatter").as_null_object
37
+ formatter = double("formatter")
38
38
  formatter.stub(:example_group_started) { |group| order << "Started: #{group.description}" }
39
39
  formatter.stub(:example_group_finished) { |group| order << "Finished: #{group.description}" }
40
40
 
@@ -61,7 +61,7 @@ module RSpec::Core
61
61
 
62
62
  context "given an example group with no examples" do
63
63
  it "does not pass example_group_started or example_group_finished to formatter" do
64
- formatter = double("formatter").as_null_object
64
+ formatter = double("formatter")
65
65
  formatter.should_not_receive(:example_group_started)
66
66
  formatter.should_not_receive(:example_group_finished)
67
67
 
@@ -120,18 +120,41 @@ module RSpec::Core
120
120
  end
121
121
  end
122
122
 
123
+ describe 'when message implemented on kernel' do
124
+ def with_message_defined_on_kernel
125
+ return yield if ::Kernel.method_defined?(:start)
126
+
127
+ begin
128
+ ::Kernel.module_eval { def start(*); raise "boom"; end }
129
+ yield
130
+ ensure
131
+ ::Kernel.module_eval { undef start }
132
+ end
133
+ end
134
+
135
+ let(:formatter) { double("formatter") }
136
+
137
+ it 'does not blow up when `Kernel` defines message instead of a formatter' do
138
+ with_message_defined_on_kernel do
139
+ reporter = ::RSpec::Core::Reporter.new(formatter)
140
+ reporter.start(3)
141
+ end
142
+ end
143
+ end
144
+
123
145
  describe "timing" do
124
146
  it "uses RSpec::Core::Time as to not be affected by changes to time in examples" do
125
- formatter = double(:formatter).as_null_object
126
- reporter = Reporter.new formatter
127
- reporter.start 1
128
- Time.stub(:now => ::Time.utc(2012, 10, 1))
129
-
147
+ formatter = double(:formatter)
130
148
  duration = nil
131
149
  formatter.stub(:dump_summary) do |dur, _, _, _|
132
150
  duration = dur
133
151
  end
134
152
 
153
+ reporter = Reporter.new formatter
154
+ reporter.start 1
155
+ Time.stub(:now => ::Time.utc(2012, 10, 1))
156
+
157
+
135
158
  reporter.finish 1234
136
159
  expect(duration).to be < 0.2
137
160
  end
metadata CHANGED
@@ -2,7 +2,7 @@
2
2
  name: rspec-core
3
3
  version: !ruby/object:Gem::Version
4
4
  prerelease:
5
- version: 2.14.0
5
+ version: 2.14.1
6
6
  platform: ruby
7
7
  authors:
8
8
  - Steven Baker
@@ -11,7 +11,7 @@ authors:
11
11
  autorequire:
12
12
  bindir: exe
13
13
  cert_chain: []
14
- date: 2013-07-06 00:00:00.000000000 Z
14
+ date: 2013-07-09 00:00:00.000000000 Z
15
15
  dependencies:
16
16
  - !ruby/object:Gem::Dependency
17
17
  version_requirements: !ruby/object:Gem::Requirement
@@ -288,6 +288,7 @@ files:
288
288
  - features/subject/implicit_receiver.feature
289
289
  - features/subject/implicit_subject.feature
290
290
  - features/support/env.rb
291
+ - features/support/rubinius.rb
291
292
  - spec/autotest/discover_spec.rb
292
293
  - spec/autotest/failed_results_re_spec.rb
293
294
  - spec/autotest/rspec_spec.rb
@@ -382,7 +383,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
382
383
  version: '0'
383
384
  segments:
384
385
  - 0
385
- hash: -1933471996242347119
386
+ hash: 3036495542605689821
386
387
  none: false
387
388
  required_rubygems_version: !ruby/object:Gem::Requirement
388
389
  requirements:
@@ -391,14 +392,14 @@ required_rubygems_version: !ruby/object:Gem::Requirement
391
392
  version: '0'
392
393
  segments:
393
394
  - 0
394
- hash: -1933471996242347119
395
+ hash: 3036495542605689821
395
396
  none: false
396
397
  requirements: []
397
398
  rubyforge_project: rspec
398
399
  rubygems_version: 1.8.24
399
400
  signing_key:
400
401
  specification_version: 3
401
- summary: rspec-core-2.14.0
402
+ summary: rspec-core-2.14.1
402
403
  test_files:
403
404
  - features/Autotest.md
404
405
  - features/README.md
@@ -465,6 +466,7 @@ test_files:
465
466
  - features/subject/implicit_receiver.feature
466
467
  - features/subject/implicit_subject.feature
467
468
  - features/support/env.rb
469
+ - features/support/rubinius.rb
468
470
  - spec/autotest/discover_spec.rb
469
471
  - spec/autotest/failed_results_re_spec.rb
470
472
  - spec/autotest/rspec_spec.rb