-
Notifications
You must be signed in to change notification settings - Fork 898
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
allow MiqDialog to be seeded from plugins... #14653
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
describe MiqDialog do | ||
context '.seed' do | ||
it 'seeds from the core with correct metadata' do | ||
root = Rails.root.join('product', 'dialogs', 'miq_dialogs') | ||
allow(described_class).to receive(:find_by) | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I think There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. right, when I was trying that, rspec complained about the other calls - now it works 🤷♂️ There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. here it is still, I need to stub
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I see 👍 |
||
|
||
expect(described_class).to receive(:sync_from_file).at_least(:once).with(/^#{root}/, root).and_call_original | ||
expect(described_class).to receive(:find_by).once.with( | ||
:name => "miq_host_provision_dialogs", :filename => "miq_host_provision_dialogs.yaml" | ||
) | ||
|
||
described_class.seed | ||
end | ||
|
||
it 'seed from plugins' do | ||
mock_engine = double(:root => Pathname.new('/some/root')) | ||
allow(described_class).to receive(:sync_from_dir) | ||
|
||
expect(Vmdb::Plugins.instance).to receive(:registered_provider_plugins).and_return([mock_engine]) | ||
expect(described_class).to receive(:sync_from_dir).once.with( | ||
mock_engine.root.join('content', 'miq_dialogs') | ||
) | ||
|
||
described_class.seed | ||
end | ||
end | ||
end |
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 refactoring seeding of
dialog.rb
as well and noticed this loads .yaml and .yml files. So should we do here tooThere 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.
👍