-
Notifications
You must be signed in to change notification settings - Fork 900
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 available_images method for miq_ae_orchestrations #12214
Refactoring available_images method for miq_ae_orchestrations #12214
Conversation
@miq-bot add_labels automate, enhancement |
@miq-bot add_label refactoring |
@pkomanek |
@miq-bot add_label wip |
@miq-bot remove_label wip |
let(:default_desc) { "<select>" } | ||
let(:default_desc_blank) { "<none>" } | ||
let(:ems) do | ||
@hw1 = FactoryGirl.create(:hardware, :guest_os => 'windows') |
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.
@pkomanek
can we convert all of these instance variables to lets
it "provides only default value to the image list" do | ||
described_class.new(ae_service).main | ||
|
||
expect(ae_service["values"]).to eq(nil => default_desc_blank) |
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.
@pkomanek
Since this is a new spec file we could also reduce the checks by using a shared example
https://github.com/ManageIQ/manageiq/blob/master/spec/lib/miq_automation_engine/models/miq_ae_git_import_spec.rb#L68
And then calling it within a context as
https://github.com/ManageIQ/manageiq/blob/master/spec/lib/miq_automation_engine/models/miq_ae_git_import_spec.rb#L79
what ever needs to change for the individual test you define in the context and then call it_behvaes_like
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.
@mkanoor thanks for a great tip about shared_examples.
Checked commits pkomanek/manageiq@e02d90e~...2aefd7e with ruby 2.2.5, rubocop 0.37.2, and haml-lint 0.16.1 |
Purpose or Intent
Refactoring the available_images method for the miq_ae_orchestration based on the issue bellow.
Links [Optional]
#12038