mirror of
https://github.com/ruby/ruby.git
synced 2022-11-09 12:17:21 -05:00
Fix specs for yield in singleton class being deprecated
* Use eval to trigger warning only when the method is called. * Suppress warnings and clarify this will be removed in 3.0. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@67031 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
parent
75334db3c6
commit
713279550a
2 changed files with 8 additions and 2 deletions
|
@ -1,9 +1,11 @@
|
||||||
module ClassSpecs
|
module ClassSpecs
|
||||||
|
|
||||||
def self.sclass_with_block
|
def self.sclass_with_block
|
||||||
|
eval <<-RUBY
|
||||||
class << self
|
class << self
|
||||||
yield
|
yield
|
||||||
end
|
end
|
||||||
|
RUBY
|
||||||
end
|
end
|
||||||
|
|
||||||
def self.sclass_with_return
|
def self.sclass_with_return
|
||||||
|
|
|
@ -285,8 +285,12 @@ describe "A class definition extending an object (sclass)" do
|
||||||
}.should raise_error(TypeError)
|
}.should raise_error(TypeError)
|
||||||
end
|
end
|
||||||
|
|
||||||
it "allows accessing the block of the original scope" do
|
ruby_version_is ""..."3.0" do
|
||||||
ClassSpecs.sclass_with_block { 123 }.should == 123
|
it "allows accessing the block of the original scope" do
|
||||||
|
suppress_warning do
|
||||||
|
ClassSpecs.sclass_with_block { 123 }.should == 123
|
||||||
|
end
|
||||||
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
it "can use return to cause the enclosing method to return" do
|
it "can use return to cause the enclosing method to return" do
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue