|
1 | 1 | describe EmsInfraController do
|
2 | 2 | let!(:server) { EvmSpecHelper.local_miq_server(:zone => zone) }
|
3 | 3 | let(:zone) { FactoryBot.build(:zone) }
|
4 |
| - context "#button" do |
| 4 | + |
| 5 | + describe "#button" do |
5 | 6 | before do
|
6 | 7 | stub_user(:features => :all)
|
7 | 8 | EvmSpecHelper.create_guid_miq_server_zone
|
|
90 | 91 | post :button, :params => {:pressed => "vm_transform_mass", :id => ems_infra.id, :format => :js}
|
91 | 92 | expect(controller.send(:flash_errors?)).not_to be_truthy
|
92 | 93 | end
|
| 94 | + |
| 95 | + context 'operations on Clusters, Orchestration Stacks, Datastores of selected Provider' do |
| 96 | + before do |
| 97 | + controller.params = {:pressed => pressed} |
| 98 | + controller.instance_variable_set(:@display, display) |
| 99 | + end |
| 100 | + |
| 101 | + context 'SSA on selected Clusters from a nested list' do |
| 102 | + let(:pressed) { 'ems_cluster_scan' } |
| 103 | + let(:display) { 'ems_clusters' } |
| 104 | + |
| 105 | + it 'returns proper record class' do |
| 106 | + expect(controller.send(:record_class)).to eq(EmsCluster) |
| 107 | + end |
| 108 | + end |
| 109 | + |
| 110 | + context 'retirement for Orchestration Stacks displayed in a nested list' do |
| 111 | + let(:pressed) { 'orchestration_stack_retire_now' } |
| 112 | + let(:display) { 'orchestration_stacks' } |
| 113 | + |
| 114 | + it 'returns proper record class' do |
| 115 | + expect(controller.send(:record_class)).to eq(OrchestrationStack) |
| 116 | + end |
| 117 | + end |
| 118 | + |
| 119 | + context 'SSA on selected Datastores from a nested list' do |
| 120 | + let(:pressed) { 'storage_scan' } |
| 121 | + let(:display) { 'storages' } |
| 122 | + |
| 123 | + it 'returns proper record class' do |
| 124 | + expect(controller.send(:record_class)).to eq(Storage) |
| 125 | + end |
| 126 | + end |
| 127 | + end |
93 | 128 | end
|
94 | 129 |
|
95 | 130 | describe "#create" do
|
|
404 | 439 | it { expect(response.status).to eq(200) }
|
405 | 440 | end
|
406 | 441 |
|
407 |
| - describe "breadcrumbs path on a 'show' page of an Infrastructure Provider accessed from Dashboard maintab" do |
| 442 | + context "breadcrumbs path on a 'show' page of an Infrastructure Provider accessed from Dashboard maintab" do |
408 | 443 | before do
|
409 | 444 | stub_user(:features => :all)
|
410 | 445 | EvmSpecHelper.create_guid_miq_server_zone
|
411 | 446 | end
|
| 447 | + |
412 | 448 | context "when previous breadcrumbs path contained 'Cloud Providers'" do
|
413 | 449 | it "shows 'Infrastructure Providers -> (Summary)' breadcrumb path" do
|
414 | 450 | ems = FactoryBot.create(:ems_vmware)
|
|
421 | 457 | end
|
422 | 458 |
|
423 | 459 | describe "#build_credentials" do
|
424 |
| - before do |
425 |
| - @ems = FactoryBot.create(:ems_openstack_infra) |
426 |
| - end |
| 460 | + before { @ems = FactoryBot.create(:ems_openstack_infra) } |
| 461 | + |
427 | 462 | context "#build_credentials only contains credentials that it supports and has a username for in params" do
|
428 | 463 | let(:default_creds) { {:userid => "default_userid", :password => "default_password"} }
|
429 | 464 | let(:amqp_creds) { {:userid => "amqp_userid", :password => "amqp_password"} }
|
|
463 | 498 | end
|
464 | 499 | end
|
465 | 500 |
|
466 |
| - describe "SCVMM - create, update, validate, cancel" do |
467 |
| - before do |
468 |
| - login_as FactoryBot.create(:user, :features => %w(ems_infra_new ems_infra_edit)) |
469 |
| - end |
| 501 | + context "SCVMM - create, update, validate, cancel" do |
| 502 | + before { login_as FactoryBot.create(:user, :features => %w[ems_infra_new ems_infra_edit]) } |
470 | 503 |
|
471 | 504 | render_views
|
472 | 505 |
|
|
553 | 586 | end
|
554 | 587 | end
|
555 | 588 |
|
556 |
| - describe "Openstack - create, update" do |
557 |
| - before do |
558 |
| - login_as FactoryBot.create(:user, :features => %w(ems_infra_new ems_infra_edit)) |
559 |
| - end |
| 589 | + context "Openstack - create, update" do |
| 590 | + before { login_as FactoryBot.create(:user, :features => %w[ems_infra_new ems_infra_edit]) } |
560 | 591 |
|
561 | 592 | render_views
|
562 | 593 |
|
|
634 | 665 | end
|
635 | 666 | end
|
636 | 667 |
|
637 |
| - describe "Redhat - create, update" do |
| 668 | + context "Redhat - create, update" do |
638 | 669 | before do
|
639 | 670 | login_as FactoryBot.create(:user, :features => %w(ems_infra_new ems_infra_edit))
|
640 | 671 | allow_any_instance_of(ManageIQ::Providers::Redhat::InfraManager)
|
|
737 | 768 | end
|
738 | 769 | end
|
739 | 770 |
|
740 |
| - describe "Kubevirt - update" do |
741 |
| - before do |
742 |
| - login_as FactoryBot.create(:user, :features => %w(ems_infra_new ems_infra_edit)) |
743 |
| - end |
| 771 | + context "Kubevirt - update" do |
| 772 | + before { login_as FactoryBot.create(:user, :features => %w[ems_infra_new ems_infra_edit]) } |
744 | 773 |
|
745 | 774 | render_views
|
746 | 775 |
|
|
812 | 841 | end
|
813 | 842 | end
|
814 | 843 |
|
815 |
| - describe "VMWare - create, update" do |
816 |
| - before do |
817 |
| - login_as FactoryBot.create(:user, :features => %w(ems_infra_new ems_infra_edit)) |
818 |
| - end |
| 844 | + context "VMWare - create, update" do |
| 845 | + before { login_as FactoryBot.create(:user, :features => %w[ems_infra_new ems_infra_edit]) } |
819 | 846 |
|
820 | 847 | render_views
|
821 | 848 |
|
|
0 commit comments