Skip to content

Commit

Permalink
Fix the VM Infra button checking EmsCloud providers
Browse files Browse the repository at this point in the history
  • Loading branch information
agrare committed Aug 16, 2024
1 parent d906b9d commit d20ebbc
Show file tree
Hide file tree
Showing 2 changed files with 23 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,6 @@ def disabled?

def provisioning_supported?
# TODO: EmsCloud.supporting(:provisioning).any?
EmsCloud.all.any? { |ems| ems.supports?(:provisioning) }
EmsInfra.all.any? { |ems| ems.supports?(:provisioning) }
end
end
22 changes: 22 additions & 0 deletions spec/helpers/application_helper/buttons/vm_miq_request_new_spec.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
describe ApplicationHelper::Button::VmMiqRequestNew do
let(:view_context) { setup_view_context_with_sandbox({}) }
let(:button) { described_class.new(view_context, {}, {}, {}) }

describe '#disabled?' do
context "with no ext_management_systems" do
it_behaves_like "a disabled button", "No Infrastructure Provider that supports VM provisioning added"
end

context "with a cloud ext_management_system" do
let!(:ems) { FactoryBot.create(:ems_cloud) }

it_behaves_like "a disabled button", "No Infrastructure Provider that supports VM provisioning added"
end

context "with an infrastructure ext_management_system" do
let!(:ems) { FactoryBot.create(:ems_infra) }

it_behaves_like "an enabled button"
end
end
end

0 comments on commit d20ebbc

Please sign in to comment.