-
Notifications
You must be signed in to change notification settings - Fork 120
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
Refactoring service retirement start_retirement method. #538
Refactoring service retirement start_retirement method. #538
Conversation
Pull Request Test Coverage Report for Build 3260
💛 - Coveralls |
MiqAeMethodService::MiqAeServiceServiceRetireRequest.find(request.id) | ||
end | ||
|
||
it "#start_retirement is nil and service is retiring" 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.
please make this more descriptive.
expect(service.retired?).to be_truthy | ||
end | ||
|
||
it "starts retirement" 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.
What does this test?
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 does not test anything.
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.
I'm trying to test the good condition. Retirement_state is nil and then I start retirement and the retirement_state is equal to retiring.
def service | ||
@service ||= @handle.root["service"].tap do |service| | ||
if service.nil? | ||
@handle.log(:error, 'Service Object not found') |
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.
Seems perfect places to use ManageIQ::Automate::System::CommonMethods::Utils::LogObject.log_and_raise
.
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.
I want to do this in a followup PR
Refactoring Service/Retirement/StateMachines/Methods.class/methods/start_retirement.rb method with spec. This PR is based on the issue below. ManageIQ#8 @miq-bot add_label refactoring Made labels more descriptive and removed some useless tests as requested
fa47176
to
5559748
Compare
Checked commits billfitzgerald0120/manageiq-content@5559748~...b5c57e5 with ruby 2.4.6, rubocop 0.69.0, haml-lint 0.20.0, and yamllint 1.10.0 |
end | ||
|
||
it "starts retirement" do | ||
allow(ae_service).to receive(:create_notification) |
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.
If this is a test, then it should be expect
instead of allow
. Otherwise this is not testing anything.
Closing this PR, github.com//pull/601 replaces this PR. |
Refactoring Service/Retirement/StateMachines/Methods.class/methods/start_retirement.rb method with spec. This PR is based on the issue below.
#8
@miq-bot add_label refactoring