1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48
|
Description: modify specs for ruby2.5
https://github.com/rspec/rspec-mocks/commit/783923d6879a2f9df9fee8ef24cecca6ac21136e
https://github.com/rspec/rspec-mocks/commit/871eb31e3bfe50705ca57e754771aa1e0164f12d
Ruby 2.5 has removed the ability to access top-level constants
via a confusing nested form (e.g. `MyClass::Hash`), so we no
longer need this spec there.
On Ruby 2.5, this spec failed, apparently due to the fact that
Method equality has changed on 2.5 slightly. The method instances
have always been different but 2.4 and before considered them
equivalent. Instead, we can show that the two method objects
_behave_ the same, which is what we really care about.
From: Myron Marston <myron.marston@gmail.com>
Bug: https://github.com/rspec/rspec-mocks/issues/1192
Applied-Upstream: yes
Date: 2017-12-30
--- a/rspec-mocks/spec/rspec/mocks/mutate_const_spec.rb
+++ b/rspec-mocks/spec/rspec/mocks/mutate_const_spec.rb
@@ -170,7 +170,7 @@
expect(::Hash).to equal(top_level_hash)
end
- it 'does not affect the ability to access the top-level constant from nested contexts', :silence_warnings do
+ it 'does not affect the ability to access the top-level constant from nested contexts', :silence_warnings, :if => ENV["RUBY_TEST_VERSION"] < "ruby2.5" do
top_level_hash = ::Hash
hide_const("TestClass::Hash")
--- a/rspec-mocks/spec/rspec/mocks/and_wrap_original_spec.rb
+++ b/rspec-mocks/spec/rspec/mocks/and_wrap_original_spec.rb
@@ -26,12 +26,13 @@
}.to raise_error NameError
end
- it "passes in the original method" do
- value = nil
+ it "passes along the original method" do
+ passed_method = nil
original_method = instance.method(:results)
- allow_it.to receive(:results).and_wrap_original { |m| value = m }
+ allow_it.to receive(:results).and_wrap_original { |m| passed_method = m }
instance.results
- expect(value).to eq original_method
+
+ expect(passed_method.call).to eq(original_method.call)
end
it "passes along the message arguments" do
|