-
Notifications
You must be signed in to change notification settings - Fork 1
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
Added specs for UberTask #on_retry and #on_report methods #4
Conversation
"Added some logs" | ||
end | ||
|
||
expect(result.call).to eq("Added some logs") |
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.
We need to update the on_report
to always return nil, the returned value was not intentional.
we need to check that the block was added to the task's handlers (you can see here that tasks are expected to have a handlers attribute).
|
||
expect(task.handlers[:retry]).to be_nil | ||
expect(task.retry_info.report).to be false | ||
expect(task.retry_info.wait).to eq(12) |
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.
We also need to update the on_retry
method to always return nil. The returned value was not intentional.
describe '.on_report' do | ||
context 'when no block is passed' do | ||
it 'returns nil' do | ||
described_class.run do |task| |
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 |task| can be removed here since it is not used in the test.
|
||
described_class.run do |task| | ||
described_class.on_retry(report: true, wait: 30) do | ||
expected_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.
You can simplify this test by returning a random number like 42 and avoiding the expected_block hash.
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.
Some minor changes.
Fixes: #5