-
-
Notifications
You must be signed in to change notification settings - Fork 133
Mocks for put_object and public_url #375
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
Conversation
break if chunk.empty? | ||
dgst.update chunk | ||
end | ||
elsif data.is_a?(String) |
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.
Prefer Object#kind_of? over Object#is_a?.
dgst = Digest::MD5.new | ||
if block_given? | ||
while true do | ||
chunk = block.call |
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.
Use yield instead of block.call.
def put_object(container, object, data, options = {}, &block) | ||
dgst = Digest::MD5.new | ||
if block_given? | ||
while true 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.
Use Kernel#loop for infinite loops.
Literal true appeared as a condition.
Do not use do with multi-line while.
class Mock | ||
require 'digest' | ||
|
||
def put_object(container, object, data, options = {}, &block) |
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.
Unused method argument - container. If it's necessary, use _ or _container as an argument name to indicate that it won't be used.
Unused method argument - object. If it's necessary, use _ or _object as an argument name to indicate that it won't be used.
Unused method argument - options. If it's necessary, use _ or _options as an argument name to indicate that it won't be used.
fff44e3
to
e1e0306
Compare
class Mock | ||
require 'digest' | ||
|
||
def put_object(_container, _object, data, _options = {}, &block) |
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.
Unused method argument - block. If it's necessary, use _ or _block as an argument name to indicate that it won't be used.
Now that put_object mock is implemented, we can enable some of the tests that rely on it.
e1e0306
to
40e150a
Compare
I squashed two related commits and added a small fix-up for the |
I could follow the discussion from a distance and was glad to see the discussion and communication expanded to achieve the best level of open source possible. Thanks for this and keep up the good work! |
Fixing up a prior PR (#341) that added these mocks.