Skip to content

Commit

Permalink
Fixed broken spec tests.
Browse files Browse the repository at this point in the history
- Adjusted spec tests to point to new controllers.
- Removed redundant commented lines from application_helper
  • Loading branch information
h-kataria committed Mar 25, 2020
1 parent 2829ac0 commit 5ce1063
Show file tree
Hide file tree
Showing 13 changed files with 56 additions and 772 deletions.
3 changes: 0 additions & 3 deletions app/helpers/application_helper.rb
Original file line number Diff line number Diff line change
Expand Up @@ -238,9 +238,6 @@ def view_to_url(view, parent = nil)
if controller == "ems_cloud" && action == "show"
return ems_clouds_path
end
# if controller == "ems_configuration" && action == "show"
# return configuration_managers_path
# end
if controller == "ems_infra" && action == "show"
return ems_infras_path
end
Expand Down
26 changes: 14 additions & 12 deletions spec/controllers/application_controller/advanced_search_spec.rb
Original file line number Diff line number Diff line change
@@ -1,18 +1,20 @@
describe ProviderForemanController, "::AdvancedSearch" do
before do
stub_user(:features => :all)
controller.instance_variable_set(:@sb, {})
end
describe ConfigurationManagerController, "::AdvancedSearch" do
let(:expr) { ApplicationController::Filter::Expression.new("=" => exp, :token => 1) }
let(:exp) { {:field => "Some_field", :value => "123"} }

describe "#adv_search_redraw_left_div" do
before { controller.instance_variable_set(:@sb, :active_tree => :configuration_manager_cs_filter_tree) }
describe '#adv_search_button_saveid' do
before do
stub_user(:features => :all)
controller.instance_variable_set(:@edit, :new => {:expression => {"=" => exp}}, :new_search_name => 'filter', :expression => expr)
controller.instance_variable_set(:@expkey, :expression)
end

it "calls build_accordions_and_trees method in Config Mgmt Configured Systems when saving a filter" do
allow(controller).to receive(:adv_search_redraw_listnav_and_main)
subject { controller.instance_variable_get(:@edit)[:expression] }

expect(controller).to receive(:build_accordions_and_trees).and_call_original.once
expect(TreeBuilderConfigurationManagerConfiguredSystems).to receive(:new).and_call_original
controller.send(:adv_search_redraw_left_div)
it 'sets only @edit[@expkey][:exp_last_loaded]' do
controller.send(:adv_search_button_saveid)
expect(subject[:selected]).to be_nil
expect(subject[:exp_last_loaded]).to include(:name => "user_#{session[:userid]}_filter", :description => 'filter', :typ => 'user')
end
end
end
Expand Down
18 changes: 0 additions & 18 deletions spec/controllers/application_controller/explorer_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -79,21 +79,3 @@
end
end
end

describe ProviderForemanController do
describe '#replace_search_box' do
let(:presenter) { ExplorerPresenter.new(:active_tree => :configuration_manager_providers_tree) }

it 'replaces advsearchModal' do
expect(presenter).to receive(:replace).with(:adv_searchbox_div, '')
expect(presenter).not_to receive(:replace).with(:advsearchModal, '')
controller.send(:replace_search_box, presenter, :nameonly => true)
end

it 'does not replace advsearchModal' do
expect(presenter).to receive(:replace).with(:adv_searchbox_div, '')
expect(presenter).to receive(:replace).with(:advsearchModal, '')
controller.send(:replace_search_box, presenter)
end
end
end
2 changes: 1 addition & 1 deletion spec/controllers/mixins/manager_controller_mixin_spec.rb
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
describe Mixins::ManagerControllerMixin do
describe '#replace_right_cell' do
let(:controller) { ProviderForemanController.new }
let(:controller) { AutomationManagerController.new }

before do
allow(controller).to receive(:leaf_record)
Expand Down
8 changes: 4 additions & 4 deletions spec/controllers/ops_controller/settings/rbac_roles_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
before do
EvmSpecHelper.seed_specific_product_features(
%w(vm vm_compare vm_delete instance instance_delete image image_delete miq_template
miq_template_delete provider_foreman_explorer provider_foreman_view)
miq_template_delete configuration_manager_show_list)
)
end

Expand Down Expand Up @@ -41,10 +41,10 @@
end
end
context '"_tab_conf" feature node' do
it 'yields features including "provider_foreman_view"' do
it 'yields features including "configuration_manager_show_list"' do
expect do |b|
controller.send(:recurse_sections_and_features, '_tab_conf', &b)
end.to yield_successive_args(["provider_foreman_explorer", include("provider_foreman_view")])
controller.send(:recurse_sections_and_features, 'configuration_manager', &b)
end.to yield_successive_args(["configuration_manager", include("configuration_manager_show_list")])
end
end
context '"vm" feature node' do
Expand Down
Loading

0 comments on commit 5ce1063

Please sign in to comment.