-
-
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 for ENV#clone
and #dup
#1025
Conversation
ENV#clone
and #dupENV#clone
and #dup
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 please use capitalised commit messages?
9c45917
to
161c43e
Compare
Thank you for the specs! |
}.should raise_error(TypeError, /Cannot clone ENV, use ENV.to_h to get a copy of ENV as a hash/) | ||
end | ||
end | ||
end |
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.
The existing specs for ENV#clone
could be improved in bit.
The previous behaviour was to return self
:
# Ruby 3.1.3
ENV.equal? ENV.clone # => => true
ENV.object_id == ENV.clone.object_id # => true
So such a case could be added as well (with version guard ruby_version_is ""..."3.2"
)
-> { | ||
ENV.clone | ||
}.should raise_error(TypeError, /Cannot clone ENV, use ENV.to_h to get a copy of ENV as a hash/) | ||
end |
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.
This case could also be improved to check that all the allowed arguments (freeze: nil
, freeze: true
, freeze: false
) lead to the TypeError
exception.
}.should raise_error(ArgumentError) | ||
end | ||
|
||
it "raises ArgumentError when keyword argument is not 'freeze'" do |
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.
suggestion:
it "raises ArgumentError when passed keyword argument other than 'freeze'" do
#1016
[Bug #17767]