36 lines
1.1 KiB
Diff
36 lines
1.1 KiB
Diff
From fd9aad1ccc736d0ceaa36dfe1732390427354788 Mon Sep 17 00:00:00 2001
|
|
From: =?UTF-8?q?V=C3=ADt=20Ondruch?= <vondruch@redhat.com>
|
|
Date: Mon, 8 Jan 2018 13:23:43 +0100
|
|
Subject: [PATCH] Mock Kernel.warn in Ruby 2.5 compatible way.
|
|
|
|
Ruby changed the way Kernel#warn reports the error [1], but mocking the
|
|
method on the class, which is calling it, should be universal [2].
|
|
|
|
[1] https://bugs.ruby-lang.org/issues/12944
|
|
[2] https://www.reddit.com/r/ruby/comments/2nki9q/rspec_how_do_you_mock_or_stub_kernel_methods_like/
|
|
---
|
|
spec/runner_spec.rb | 6 +++---
|
|
1 file changed, 3 insertions(+), 3 deletions(-)
|
|
|
|
diff --git a/spec/runner_spec.rb b/spec/runner_spec.rb
|
|
index 825783d..cee6b91 100644
|
|
--- a/spec/runner_spec.rb
|
|
+++ b/spec/runner_spec.rb
|
|
@@ -65,10 +65,10 @@ describe Runner do
|
|
end
|
|
|
|
it "should warn when require a rack config file" do
|
|
- STDERR.stub!(:write)
|
|
- STDERR.should_receive(:write).with(/WARNING:/)
|
|
-
|
|
runner = Runner.new(%w(start -r config.ru))
|
|
+
|
|
+ runner.should_receive(:warn).with(/WARNING:/)
|
|
+
|
|
runner.run! rescue nil
|
|
|
|
runner.options[:rackup].should == 'config.ru'
|
|
--
|
|
2.15.1
|
|
|