# in fixtures/autoload_define_method.rb
#===================================
module ModuleSpecs
def test_define(name)
(class << self; self; end).send(:define_method, name) do |*args|
puts "test"
end
end
end
# in define_method_spec
#===================================
describe "Module#define_method when given a metaclass" do
it "correctly defines a new method" do
include ModuleSpecs
def test1
puts "LOL"
end
test_define(:test1)
test1()
end
end
=begin
and the error:
Module#define_method when given a metaclass correctly defines a new method ERROR
NoMethodError: undefined method `test_define' for ModuleSpecs:Module
./spec/frozen/1.8/core/module/define_method_spec.rb:92