Skip to content

Commit

Permalink
Merge pull request #801 from moofkit/yield_in_singleton_class
Browse files Browse the repository at this point in the history
adds spec for yield in singleton class
  • Loading branch information
andrykonchin authored Oct 18, 2020
2 parents c8bc53a + 84e7aac commit 01d0d99
Showing 1 changed file with 17 additions and 0 deletions.
17 changes: 17 additions & 0 deletions language/singleton_class_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -157,6 +157,23 @@ class << @object
end
end

describe "Defining yield in singleton class" do
ruby_version_is "2.7"..."3.0" do
it 'emits a deprecation warning' do
code = <<~RUBY
def m
class << Object.new
yield
end
end
m { :ok }
RUBY

-> { eval(code) }.should complain(/warning: `yield' in class syntax will not be supported from Ruby 3.0/)
end
end
end

describe "Defining instance methods on a singleton class" do
before :each do
@k = ClassSpecs::K.new
Expand Down

0 comments on commit 01d0d99

Please sign in to comment.