Skip to content

Commit a2e33ba

Browse files
committed
Move spec under Module#undef_method since there is no Class#undef_method
1 parent 896db5a commit a2e33ba

File tree

2 files changed

+9
-15
lines changed

2 files changed

+9
-15
lines changed

spec/ruby/core/class/undef_method_spec.rb

Lines changed: 0 additions & 14 deletions
This file was deleted.

spec/ruby/core/module/undef_method_spec.rb

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -56,13 +56,21 @@ def another_method_to_undef() 1 end
5656
@module.send(:undef_method, :method_to_undef).should equal(@module)
5757
end
5858

59-
it "raises a NameError when passed a missing name" do
59+
it "raises a NameError when passed a missing name for a module" do
6060
-> { @module.send :undef_method, :not_exist }.should raise_error(NameError, /undefined method `not_exist' for module/) { |e|
6161
# a NameError and not a NoMethodError
6262
e.class.should == NameError
6363
}
6464
end
6565

66+
it "raises a NameError when passed a missing name for a class" do
67+
klass = Class.new
68+
-> { klass.send :undef_method, :not_exist }.should raise_error(NameError, /undefined method `not_exist' for class/) { |e|
69+
# a NameError and not a NoMethodError
70+
e.class.should == NameError
71+
}
72+
end
73+
6674
describe "on frozen instance" do
6775
before :each do
6876
@frozen = @module.dup.freeze

0 commit comments

Comments
 (0)