Skip to content
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 Kernel#Pathname spec #810

Merged
merged 3 commits into from
Nov 24, 2020
Merged

Conversation

HeroProtagonist
Copy link
Contributor

relates to #745

[ ] Kernel#Pathname when called with a Pathname argument now returns
the argument instead of creating a new Pathname. This is more
similar to other Kernel methods, but can break code that modifies
the return value and expects the argument not to be modified.

new_path = Pathname(path)

(path.object_id == new_path.object_id).should be_true
end
Copy link
Member

@andrykonchin andrykonchin Oct 25, 2020

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

done! thanks

@@ -0,0 +1,26 @@
require_relative '../../spec_helper'
require 'pathname'
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

pathname is a standard library, could you move the spec to library/pathname/Pathname_spec.rb?
The reason is no standard libraries should be require-d when running core/ specs.


describe "Kernel#Pathname" do
it "is a public method" do
Kernel.public_methods.should include(:Pathname)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This should be Kernel.should have_private_instance_method(:Pathname) since the spec is about Kernel#Pathname.

There is also Kernel.Pathname, which we could test in a separate it with Kernel.should have_method(:Pathname).

@eregon
Copy link
Member

eregon commented Nov 22, 2020

@HeroProtagonist Could you address the 2 things I mentioned above?

@HeroProtagonist
Copy link
Contributor Author

@eregon 👋
I moved the specs and added another it for public pathname.

Copy link
Member

@eregon eregon left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks!

@eregon eregon merged commit 0fecd85 into ruby:master Nov 24, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

Successfully merging this pull request may close these issues.

3 participants