summaryrefslogtreecommitdiff
path: root/spec/ruby/core/unboundmethod
diff options
context:
space:
mode:
Diffstat (limited to 'spec/ruby/core/unboundmethod')
-rw-r--r--spec/ruby/core/unboundmethod/eql_spec.rb4
-rw-r--r--spec/ruby/core/unboundmethod/inspect_spec.rb8
-rw-r--r--spec/ruby/core/unboundmethod/shared/to_s.rb33
-rw-r--r--spec/ruby/core/unboundmethod/to_s_spec.rb31
4 files changed, 35 insertions, 41 deletions
diff --git a/spec/ruby/core/unboundmethod/eql_spec.rb b/spec/ruby/core/unboundmethod/eql_spec.rb
index cf2c6b5aae..3b299d047a 100644
--- a/spec/ruby/core/unboundmethod/eql_spec.rb
+++ b/spec/ruby/core/unboundmethod/eql_spec.rb
@@ -1,5 +1,7 @@
require_relative '../../spec_helper'
describe "UnboundMethod#eql?" do
- it "needs to be reviewed for spec completeness"
+ it "is an alias of UnboundMethod#==" do
+ UnboundMethod.instance_method(:eql?).should == UnboundMethod.instance_method(:==)
+ end
end
diff --git a/spec/ruby/core/unboundmethod/inspect_spec.rb b/spec/ruby/core/unboundmethod/inspect_spec.rb
index 3abed94f7f..b0fcfd00ea 100644
--- a/spec/ruby/core/unboundmethod/inspect_spec.rb
+++ b/spec/ruby/core/unboundmethod/inspect_spec.rb
@@ -1,9 +1,7 @@
require_relative '../../spec_helper'
-require_relative 'fixtures/classes'
-require_relative 'shared/to_s'
-require_relative '../method/shared/aliased_inspect'
describe "UnboundMethod#inspect" do
- it_behaves_like :unboundmethod_to_s, :inspect
- it_behaves_like :method_to_s_aliased, :inspect, -> meth { meth.unbind }
+ it "is an alias of UnboundMethod#to_s" do
+ UnboundMethod.instance_method(:inspect).should == UnboundMethod.instance_method(:to_s)
+ end
end
diff --git a/spec/ruby/core/unboundmethod/shared/to_s.rb b/spec/ruby/core/unboundmethod/shared/to_s.rb
deleted file mode 100644
index 848c1eba2e..0000000000
--- a/spec/ruby/core/unboundmethod/shared/to_s.rb
+++ /dev/null
@@ -1,33 +0,0 @@
-require_relative '../../../spec_helper'
-require_relative '../fixtures/classes'
-
-describe :unboundmethod_to_s, shared: true do
- before :each do
- @from_module = UnboundMethodSpecs::Methods.instance_method(:from_mod)
- @from_method = UnboundMethodSpecs::Methods.new.method(:from_mod).unbind
- end
-
- it "returns a String" do
- @from_module.send(@method).should.is_a?(String)
- @from_method.send(@method).should.is_a?(String)
- end
-
- it "the String reflects that this is an UnboundMethod object" do
- @from_module.send(@method).should =~ /\bUnboundMethod\b/
- @from_method.send(@method).should =~ /\bUnboundMethod\b/
- end
-
- it "the String shows the method name, Module defined in and Module extracted from" do
- @from_module.send(@method).should =~ /\bfrom_mod\b/
- @from_module.send(@method).should =~ /\bUnboundMethodSpecs::Mod\b/
- end
-
- it "returns a String including all details" do
- @from_module.send(@method).should.start_with? "#<UnboundMethod: UnboundMethodSpecs::Mod#from_mod"
- @from_method.send(@method).should.start_with? "#<UnboundMethod: UnboundMethodSpecs::Mod#from_mod"
- end
-
- it "does not show the defining module if it is the same as the origin" do
- UnboundMethodSpecs::A.instance_method(:baz).send(@method).should.start_with? "#<UnboundMethod: UnboundMethodSpecs::A#baz"
- end
-end
diff --git a/spec/ruby/core/unboundmethod/to_s_spec.rb b/spec/ruby/core/unboundmethod/to_s_spec.rb
index 615d88675b..b90f315c3a 100644
--- a/spec/ruby/core/unboundmethod/to_s_spec.rb
+++ b/spec/ruby/core/unboundmethod/to_s_spec.rb
@@ -1,9 +1,36 @@
require_relative '../../spec_helper'
require_relative 'fixtures/classes'
-require_relative 'shared/to_s'
require_relative '../method/shared/aliased_inspect'
describe "UnboundMethod#to_s" do
- it_behaves_like :unboundmethod_to_s, :to_s
it_behaves_like :method_to_s_aliased, :to_s, -> meth { meth.unbind }
+
+ before :each do
+ @from_module = UnboundMethodSpecs::Methods.instance_method(:from_mod)
+ @from_method = UnboundMethodSpecs::Methods.new.method(:from_mod).unbind
+ end
+
+ it "returns a String" do
+ @from_module.to_s.should.is_a?(String)
+ @from_method.to_s.should.is_a?(String)
+ end
+
+ it "the String reflects that this is an UnboundMethod object" do
+ @from_module.to_s.should =~ /\bUnboundMethod\b/
+ @from_method.to_s.should =~ /\bUnboundMethod\b/
+ end
+
+ it "the String shows the method name, Module defined in and Module extracted from" do
+ @from_module.to_s.should =~ /\bfrom_mod\b/
+ @from_module.to_s.should =~ /\bUnboundMethodSpecs::Mod\b/
+ end
+
+ it "returns a String including all details" do
+ @from_module.to_s.should.start_with? "#<UnboundMethod: UnboundMethodSpecs::Mod#from_mod"
+ @from_method.to_s.should.start_with? "#<UnboundMethod: UnboundMethodSpecs::Mod#from_mod"
+ end
+
+ it "does not show the defining module if it is the same as the origin" do
+ UnboundMethodSpecs::A.instance_method(:baz).to_s.should.start_with? "#<UnboundMethod: UnboundMethodSpecs::A#baz"
+ end
end