1
0
Fork 0
mirror of https://github.com/ruby/ruby.git synced 2022-11-09 12:17:21 -05:00
This commit is contained in:
Benoit Daloze 2019-07-27 12:40:09 +02:00
parent a06301b103
commit 5c276e1cc9
1247 changed files with 5316 additions and 5028 deletions

View file

@ -14,7 +14,7 @@ describe :module_class_eval, shared: true do
'foo'
end
end
lambda {42.foo}.should raise_error(NoMethodError)
-> {42.foo}.should raise_error(NoMethodError)
end
it "resolves constants in the caller scope" do
@ -59,7 +59,7 @@ describe :module_class_eval, shared: true do
it "raises a TypeError when the given filename can't be converted to string using to_str" do
(file = mock('123')).should_receive(:to_str).and_return(123)
lambda { ModuleSpecs.send(@method, "1+1", file) }.should raise_error(TypeError)
-> { ModuleSpecs.send(@method, "1+1", file) }.should raise_error(TypeError)
end
it "converts non string eval-string to string using to_str" do
@ -69,24 +69,24 @@ describe :module_class_eval, shared: true do
it "raises a TypeError when the given eval-string can't be converted to string using to_str" do
o = mock('x')
lambda { ModuleSpecs.send(@method, o) }.should raise_error(TypeError)
-> { ModuleSpecs.send(@method, o) }.should raise_error(TypeError)
(o = mock('123')).should_receive(:to_str).and_return(123)
lambda { ModuleSpecs.send(@method, o) }.should raise_error(TypeError)
-> { ModuleSpecs.send(@method, o) }.should raise_error(TypeError)
end
it "raises an ArgumentError when no arguments and no block are given" do
lambda { ModuleSpecs.send(@method) }.should raise_error(ArgumentError)
-> { ModuleSpecs.send(@method) }.should raise_error(ArgumentError)
end
it "raises an ArgumentError when more than 3 arguments are given" do
lambda {
-> {
ModuleSpecs.send(@method, "1 + 1", "some file", 0, "bogus")
}.should raise_error(ArgumentError)
end
it "raises an ArgumentError when a block and normal arguments are given" do
lambda {
-> {
ModuleSpecs.send(@method, "1 + 1") { 1 + 1 }
}.should raise_error(ArgumentError)
end

View file

@ -5,7 +5,7 @@ describe :module_class_exec, shared: true do
'foo'
end
end
lambda {42.foo}.should raise_error(NoMethodError)
-> {42.foo}.should raise_error(NoMethodError)
end
it "defines method in the receiver's scope" do
@ -19,7 +19,7 @@ describe :module_class_exec, shared: true do
end
it "raises a LocalJumpError when no block is given" do
lambda { ModuleSpecs::Subclass.send(@method) }.should raise_error(LocalJumpError)
-> { ModuleSpecs::Subclass.send(@method) }.should raise_error(LocalJumpError)
end
it "passes arguments to the block" do