-
-
Notifications
You must be signed in to change notification settings - Fork 388
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add specs to cover the bug 9573 #879
Closed
Closed
Changes from all commits
Commits
Show all changes
2 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -99,3 +99,57 @@ module ModuleSpecs::Modules::Klass; end | |
d.name.should == "ModuleSpecs_CS2::D" | ||
end | ||
end | ||
|
||
ruby_version_is "3.0" do | ||
describe "Include" do | ||
context "when the include in the module is done after the include in the class" do | ||
it "includes the M1 and M2 module" do | ||
class A; end | ||
module B1; end | ||
module C2; end | ||
|
||
A.include B1 | ||
B1.include C2 | ||
A.ancestors.should == [A, B1, C2, Object, ModuleSpecs::IncludedInObject, PP::ObjectMixin, Kernel, BasicObject] | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. We need to only check the first 4 ancestors here, since there can be various modules included in |
||
end | ||
end | ||
|
||
context "when the include in the module is done before the include in the class" do | ||
it "includes the M1 and M2 module" do | ||
class D; end | ||
module E1; end | ||
module F2; end | ||
|
||
E1.include F2 | ||
D.include E1 | ||
D.ancestors.should == [D, E1, F2, Object, ModuleSpecs::IncludedInObject, PP::ObjectMixin, Kernel, BasicObject] | ||
end | ||
end | ||
end | ||
|
||
describe "Prepend" do | ||
context "when the prepend in the module is done after the prepend in the class" do | ||
it "prepends the M1 and M2 module" do | ||
class G; end | ||
module H1; end | ||
module I2; end | ||
|
||
G.prepend H1 | ||
H1.prepend I2 | ||
G.ancestors.should == [I2, H1, G, Object, ModuleSpecs::IncludedInObject, PP::ObjectMixin, Kernel, BasicObject] | ||
end | ||
end | ||
|
||
context "when the prepend in the module is done before the prepend in the class" do | ||
it "prepends the M1 and M2 module" do | ||
class J; end | ||
module K1; end | ||
module L2; end | ||
|
||
K1.prepend L2 | ||
J.prepend K1 | ||
J.ancestors.should == [L2, K1, J, Object, ModuleSpecs::IncludedInObject, PP::ObjectMixin, Kernel, BasicObject] | ||
end | ||
end | ||
end | ||
end |
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Could you move these specs to
core/module/include_spec.rb
andcore/module/prepend_spec.rb
?language/
is for syntax, and include/prepend are just regular Ruby methods should should be tested incore/
.