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 2021-03-27 13:02:41 +01:00
parent 44736a6b7a
commit 95d9fe9538
26 changed files with 501 additions and 84 deletions

View file

@ -246,12 +246,30 @@ describe "CApiModule" do
cls.new.test_method.should == :test_method
end
it "returns the correct arity of the method in class" do
it "returns the correct arity when argc of the method in class is 0" do
cls = Class.new
@m.rb_define_method(cls, "test_method")
cls.new.method(:test_method).arity.should == 0
end
it "returns the correct arity when argc of the method in class is -1" do
cls = Class.new
@m.rb_define_method_c_array(cls, "test_method_c_array")
cls.new.method(:test_method_c_array).arity.should == -1
end
it "returns the correct arity when argc of the method in class is -2" do
cls = Class.new
@m.rb_define_method_ruby_array(cls, "test_method_ruby_array")
cls.new.method(:test_method_ruby_array).arity.should == -1
end
it "returns the correct arity when argc of the method in class is 2" do
cls = Class.new
@m.rb_define_method_2required(cls, "test_method_2required")
cls.new.method(:test_method_2required).arity.should == 2
end
it "defines a method on a module" do
mod = Module.new
@m.rb_define_method(mod, "test_method")