summaryrefslogtreecommitdiff
path: root/spec/ruby/core/module/remove_const_spec.rb
diff options
context:
space:
mode:
Diffstat (limited to 'spec/ruby/core/module/remove_const_spec.rb')
-rw-r--r--spec/ruby/core/module/remove_const_spec.rb26
1 files changed, 13 insertions, 13 deletions
diff --git a/spec/ruby/core/module/remove_const_spec.rb b/spec/ruby/core/module/remove_const_spec.rb
index 073e2c1501..20eb2dc3ed 100644
--- a/spec/ruby/core/module/remove_const_spec.rb
+++ b/spec/ruby/core/module/remove_const_spec.rb
@@ -7,13 +7,13 @@ describe "Module#remove_const" do
ConstantSpecs::ModuleM::CS_CONST252.should == :const252
ConstantSpecs::ModuleM.send :remove_const, :CS_CONST252
- lambda { ConstantSpecs::ModuleM::CS_CONST252 }.should raise_error(NameError)
+ -> { ConstantSpecs::ModuleM::CS_CONST252 }.should raise_error(NameError)
ConstantSpecs::ModuleM::CS_CONST253 = :const253
ConstantSpecs::ModuleM::CS_CONST253.should == :const253
ConstantSpecs::ModuleM.send :remove_const, "CS_CONST253"
- lambda { ConstantSpecs::ModuleM::CS_CONST253 }.should raise_error(NameError)
+ -> { ConstantSpecs::ModuleM::CS_CONST253 }.should raise_error(NameError)
end
it "returns the value of the removed constant" do
@@ -23,7 +23,7 @@ describe "Module#remove_const" do
it "raises a NameError and does not call #const_missing if the constant is not defined" do
ConstantSpecs.should_not_receive(:const_missing)
- lambda { ConstantSpecs.send(:remove_const, :Nonexistent) }.should raise_error(NameError)
+ -> { ConstantSpecs.send(:remove_const, :Nonexistent) }.should raise_error(NameError)
end
it "raises a NameError and does not call #const_missing if the constant is not defined directly in the module" do
@@ -32,7 +32,7 @@ describe "Module#remove_const" do
ConstantSpecs::ContainerA::CS_CONST255.should == :const255
ConstantSpecs::ContainerA.should_not_receive(:const_missing)
- lambda do
+ -> do
ConstantSpecs::ContainerA.send :remove_const, :CS_CONST255
end.should raise_error(NameError)
ensure
@@ -41,21 +41,21 @@ describe "Module#remove_const" do
end
it "raises a NameError if the name does not start with a capital letter" do
- lambda { ConstantSpecs.send :remove_const, "name" }.should raise_error(NameError)
+ -> { ConstantSpecs.send :remove_const, "name" }.should raise_error(NameError)
end
it "raises a NameError if the name starts with a non-alphabetic character" do
- lambda { ConstantSpecs.send :remove_const, "__CONSTX__" }.should raise_error(NameError)
- lambda { ConstantSpecs.send :remove_const, "@Name" }.should raise_error(NameError)
- lambda { ConstantSpecs.send :remove_const, "!Name" }.should raise_error(NameError)
- lambda { ConstantSpecs.send :remove_const, "::Name" }.should raise_error(NameError)
+ -> { ConstantSpecs.send :remove_const, "__CONSTX__" }.should raise_error(NameError)
+ -> { ConstantSpecs.send :remove_const, "@Name" }.should raise_error(NameError)
+ -> { ConstantSpecs.send :remove_const, "!Name" }.should raise_error(NameError)
+ -> { ConstantSpecs.send :remove_const, "::Name" }.should raise_error(NameError)
end
it "raises a NameError if the name contains non-alphabetic characters except '_'" do
ConstantSpecs::ModuleM::CS_CONST256 = :const256
ConstantSpecs::ModuleM.send :remove_const, "CS_CONST256"
- lambda { ConstantSpecs.send :remove_const, "Name=" }.should raise_error(NameError)
- lambda { ConstantSpecs.send :remove_const, "Name?" }.should raise_error(NameError)
+ -> { ConstantSpecs.send :remove_const, "Name=" }.should raise_error(NameError)
+ -> { ConstantSpecs.send :remove_const, "Name?" }.should raise_error(NameError)
end
it "calls #to_str to convert the given name to a String" do
@@ -67,10 +67,10 @@ describe "Module#remove_const" do
it "raises a TypeError if conversion to a String by calling #to_str fails" do
name = mock('123')
- lambda { ConstantSpecs.send :remove_const, name }.should raise_error(TypeError)
+ -> { ConstantSpecs.send :remove_const, name }.should raise_error(TypeError)
name.should_receive(:to_str).and_return(123)
- lambda { ConstantSpecs.send :remove_const, name }.should raise_error(TypeError)
+ -> { ConstantSpecs.send :remove_const, name }.should raise_error(TypeError)
end
it "is a private method" do