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