summaryrefslogtreecommitdiff
path: root/spec/ruby/shared/basicobject
diff options
context:
space:
mode:
Diffstat (limited to 'spec/ruby/shared/basicobject')
-rw-r--r--spec/ruby/shared/basicobject/method_missing.rb18
-rw-r--r--spec/ruby/shared/basicobject/send.rb7
2 files changed, 10 insertions, 15 deletions
diff --git a/spec/ruby/shared/basicobject/method_missing.rb b/spec/ruby/shared/basicobject/method_missing.rb
index 0759dd9606..97ece14c03 100644
--- a/spec/ruby/shared/basicobject/method_missing.rb
+++ b/spec/ruby/shared/basicobject/method_missing.rb
@@ -1,5 +1,5 @@
-require_relative '../../spec_helper'
-require_relative '../../fixtures/basicobject/method_missing'
+require File.expand_path('../../../spec_helper', __FILE__)
+require File.expand_path('../../../fixtures/basicobject/method_missing', __FILE__)
describe :method_missing_defined_module, shared: true do
describe "for a Module with #method_missing defined" do
@@ -111,13 +111,15 @@ describe :method_missing_instance, shared: true do
lambda { @object.new.method_private }.should raise_error(NoMethodError)
end
- it 'sets the receiver of the raised NoMethodError' do
- obj = @object.new
+ ruby_version_is "2.3" do
+ it 'sets the receiver of the raised NoMethodError' do
+ obj = @object.new
- begin
- obj.method_private
- rescue NoMethodError => error
- (error.receiver == obj).should == true
+ begin
+ obj.method_private
+ rescue NoMethodError => error
+ (error.receiver == obj).should == true
+ end
end
end
end
diff --git a/spec/ruby/shared/basicobject/send.rb b/spec/ruby/shared/basicobject/send.rb
index 2b79ab4c2c..f8c63c5522 100644
--- a/spec/ruby/shared/basicobject/send.rb
+++ b/spec/ruby/shared/basicobject/send.rb
@@ -29,13 +29,6 @@ describe :basicobject_send, shared: true do
SendSpecs::Foo.send(@method, :bar).should == 'done'
end
- it "raises a TypeError if the method name is not a string or symbol" do
- -> { SendSpecs.send(@method, nil) }.should raise_error(TypeError, /not a symbol nor a string/)
- -> { SendSpecs.send(@method, 42) }.should raise_error(TypeError, /not a symbol nor a string/)
- -> { SendSpecs.send(@method, 3.14) }.should raise_error(TypeError, /not a symbol nor a string/)
- -> { SendSpecs.send(@method, true) }.should raise_error(TypeError, /not a symbol nor a string/)
- end
-
it "raises a NameError if the corresponding method can't be found" do
class SendSpecs::Foo
def bar