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

Added specs for UberTask #on_retry and #on_report methods #4

Closed
wants to merge 1 commit into from

Conversation

alkesh26
Copy link
Contributor

@alkesh26 alkesh26 commented Dec 21, 2023

Fixes: #5

@alkesh26 alkesh26 added the specs This label is for adding specs label Dec 21, 2023
@alkesh26 alkesh26 self-assigned this Dec 21, 2023
@alkesh26 alkesh26 requested a review from borela December 21, 2023 08:33
"Added some logs"
end

expect(result.call).to eq("Added some logs")
Copy link
Member

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)
Copy link
Member

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|
Copy link
Member

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
Copy link
Member

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.

Copy link
Member

@borela borela left a comment

Choose a reason for hiding this comment

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

Some minor changes.

@borela
Copy link
Member

borela commented Jul 15, 2024

closed in favor of #9 #8 #7

@borela borela closed this Jul 15, 2024
@borela borela deleted the add-specs-for-on_report-and-on_retry branch July 15, 2024 12:50
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
specs This label is for adding specs
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Add specs for UberTask on_report and on_retry methods
2 participants