From 4a8d5fd23f1d1d51839fb4b939afa911dd91c35e Mon Sep 17 00:00:00 2001 From: Zahi Akiva Date: Tue, 21 Mar 2017 18:26:23 +0200 Subject: [PATCH] Fix Container Provider link to Capacity & Utilization --- .../layouts/listnav/_ems_container.html.haml | 2 +- .../listnav/_ems_container.html.haml_spec.rb | 18 ++++++++++++++++++ 2 files changed, 19 insertions(+), 1 deletion(-) create mode 100644 spec/views/layouts/listnav/_ems_container.html.haml_spec.rb diff --git a/app/views/layouts/listnav/_ems_container.html.haml b/app/views/layouts/listnav/_ems_container.html.haml index 62eaacf9568..d3d10877b84 100644 --- a/app/views/layouts/listnav/_ems_container.html.haml +++ b/app/views/layouts/listnav/_ems_container.html.haml @@ -11,7 +11,7 @@ - if @record.has_perf_data? %li = link_to(_('Capacity & Utilization'), - {:action => 'show', :id => @record, :display => 'performance'}, + polymorphic_path(@record, :display => "performance"), :title => _("Show Capacity & Utilization")) - else %li.disabled diff --git a/spec/views/layouts/listnav/_ems_container.html.haml_spec.rb b/spec/views/layouts/listnav/_ems_container.html.haml_spec.rb new file mode 100644 index 00000000000..6c80597827c --- /dev/null +++ b/spec/views/layouts/listnav/_ems_container.html.haml_spec.rb @@ -0,0 +1,18 @@ +describe "layouts/listnav/_ems_container.html.haml" do + helper(QuadiconHelper) + + before :each do + set_controller_for_view("ems_container") + assign(:panels, "ems_prop" => true, "ems_rel" => true) + allow(view).to receive(:truncate_length).and_return(10) + allow(view).to receive(:role_allows?).and_return(true) + end + + it "link to Capacity & Utilization uses restful path" do + @record = FactoryGirl.create(:ems_openshift) + allow(@record).to receive(:has_perf_data?).and_return(true) + render + expect(response) + .to include("Show Capacity & Utilization\" href=\"/ems_container/#{@record.id}?display=performance\">") + end +end