Skip to content
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

Remove unused variable from infra networking controller #5317

Merged
merged 2 commits into from Mar 8, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
2 changes: 1 addition & 1 deletion app/controllers/infra_networking_controller.rb
Expand Up @@ -535,7 +535,7 @@ def rebuild_toolbars(record_showing, presenter)
end

def display_adv_searchbox
!(@infra_networking_record || @in_a_form || @nodetype == 'sw')
!(@record || @in_a_form)
end

def breadcrumb_name(_model)
Expand Down
24 changes: 21 additions & 3 deletions spec/controllers/infra_networking_controller_spec.rb
Expand Up @@ -15,9 +15,7 @@
describe 'render_views' do
render_views

before do
EvmSpecHelper.create_guid_miq_server_zone
end
before { EvmSpecHelper.create_guid_miq_server_zone }

describe '#explorer' do
before do
Expand Down Expand Up @@ -106,4 +104,24 @@
expect(response.status).to eq(200)
end
end

describe '#rebuild_toolbars' do
let(:presenter) { instance_double("ExplorerPresenter") }

before do
allow(ExplorerPresenter).to receive(:new).and_return(presenter)
allow(presenter).to receive(:hide)
allow(presenter).to receive(:reload_toolbars)
allow(presenter).to receive(:set_visibility)
allow(presenter).to receive(:[]=)
controller.instance_variable_set(:@nodetype, 'sw')
controller.instance_variable_set(:@record, switch)
controller.instance_variable_set(:@sb, {})
end

it 'does not display Search in Switch summary screen' do
expect(controller).to receive(:display_adv_searchbox).and_return(false)
controller.send(:rebuild_toolbars, true, presenter)
end
end
end