-
Notifications
You must be signed in to change notification settings - Fork 86
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
Extend failure messages (issue 97) #114
Open
tonatiuh
wants to merge
1
commit into
leshill:master
Choose a base branch
from
tonatiuh:feature/add-functionality-for-issue-97
base: master
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
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
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.
Not happy with the spacing here, leave it up to the caller.
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.
Thanks, I'll attend this today.
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 issues I see if I don't add the blank space are that:
1 - There would be some inconsistency in the
failure_message
method for thehave_scheduled
matcher, given that only this method uses the format of["expected that #{actual} would not have [#{expected_args.join(', ')}] scheduled", @time_info].join(' ')
, all the others follow the"expected that #{actual} would be queued with [#{expected_args.join(', ')}]#{@times_info}"
format.2 - The last line of the
failure_message
will have to be updated to["expected that #{actual} would not have [#{expected_args.join(', ')}] scheduled", "#{@time_info},", actual_queue_message].join(' ')
so that there is a comma before showing the existent enqueued job in the failure message, and given that there may be times when the @time_info is empty then an extra blank space would appear in those cases.What do you think?
(Please let me know if I didn't communicate well any of those points.)
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.
As an example, addressing point 2:
Line 117 could be:
"but got #{actual} with [#{actual_queue_args_str}]#{@times_info} instead"
Line 248 could be:
`["expected that #{actual} would not have [#{expected_args.join(', ')}] scheduled", "#{@time_info}", actual_queue_message].join(', ')
The ", " is inserted by the caller as needed. Each part of the message is just a building block and not specifying how it is joined to the rest of the message.
Does that make sense?
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.
Thanks. I think I see what you say, however, since a comma is added by each element in the array then the resulting failure text goes like the following:
(Please check that there is an extra comma after "scheduled").
I don't really like having an extra comma there and I think point 1 is valid. but you tell me, I can leave it with the extra comma if that works for you.
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.
LOL, yea I did not completely rewrite it, so that will need to be addressed too.
Go ahead with my latest suggestion (extra comma) and I will fix that when I merge the PR. Thanks for the doing the PR.
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.
Thanks.
I just realized that when there is no
@time_info
two commas will appear as in:This goes for scenario in https://github.com/leshill/resque_spec/blob/master/spec/resque_spec/matchers_spec.rb#L357 for instance. I think you can 1) merge this as it is (since it's working and is consistent, in my opinion) or 2) I leave it is and you do the small modifications you see are needed when merging (having an extra blank space works better for me than having one extra comma).
What do you think?
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.
Let me know in case you need anything else from my side : )