Skip to content

Commit

Permalink
Add specs for Module#undefined_instance_methods
Browse files Browse the repository at this point in the history
  • Loading branch information
AI-Mozi committed May 12, 2023
1 parent 9aa1cbf commit a86f5aa
Showing 1 changed file with 26 additions and 0 deletions.
26 changes: 26 additions & 0 deletions core/module/undefined_instance_methods_spec.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
require_relative '../../spec_helper'
require_relative 'fixtures/classes'

describe "Module#undefined_instance_methods" do
ruby_version_is "3.2" do
it "returns methods undefined in the class" do
methods = ModuleSpecs::Parent.undefined_instance_methods
methods.should == [:undefed_method]
end

it "returns inherited methods undefined in the class" do
methods = ModuleSpecs::Child.undefined_instance_methods
methods.should include(:parent_method, :another_parent_method)
end

it "returns methods from an included module that are undefined in the class" do
methods = ModuleSpecs::Grandchild.undefined_instance_methods
methods.should include(:super_included_method)
end

it "does not returns ancestors undefined methods" do
methods = ModuleSpecs::Grandchild.undefined_instance_methods
methods.should_not include(:parent_method, :another_parent_method)
end
end
end

0 comments on commit a86f5aa

Please sign in to comment.