summaryrefslogtreecommitdiff
path: root/spec/ruby/core/true/singleton_method_spec.rb
blob: c06793850fa87a9103d6bbe4cc0393f31fa5cfcc (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
require_relative '../../spec_helper'

describe "TrueClass#singleton_method" do
  ruby_version_is '3.3' do
    it "raises regardless of whether TrueClass defines the method" do
      -> { true.singleton_method(:foo) }.should raise_error(NameError)
      begin
        def (true).foo; end
        -> { true.singleton_method(:foo) }.should raise_error(NameError)
      ensure
        TrueClass.send(:remove_method, :foo)
      end
    end
  end
end