From c4b7bfbe66da8fb04db5f0ec1495a089bd2d32ef Mon Sep 17 00:00:00 2001 From: Chris Beer Date: Tue, 17 Apr 2012 09:54:37 -0700 Subject: [PATCH] just test against catalog controller rather than trying to be too clever. maybe after Rails 3.1 support is dropped we can do an even better job here.. --- .../helpers/render_constraints_helper_spec.rb | 15 +++++---------- 1 file changed, 5 insertions(+), 10 deletions(-) diff --git a/test_support/spec/helpers/render_constraints_helper_spec.rb b/test_support/spec/helpers/render_constraints_helper_spec.rb index f8d3f613a7..0e12349f44 100644 --- a/test_support/spec/helpers/render_constraints_helper_spec.rb +++ b/test_support/spec/helpers/render_constraints_helper_spec.rb @@ -3,18 +3,13 @@ describe RenderConstraintsHelper do before do - - # Set up another catalog-like controller to test that the helpers are controller-independent. - class DummyAlternateCatalogController < CatalogController; end - TestApp::Application.routes.draw do - match 'advanced_search', :to => 'dummy_alternate_catalog_controller#index' - end - - controller.request.path_parameters["controller"] = 'dummy_alternate_catalog_controller' + # the helper methods below infer paths from the current route + controller.request.path_parameters["controller"] = 'catalog' end + describe '#render_constraints_query' do it "should have a link relative to the current url" do - helper.render_constraints_query(:q=>'foobar', :f=>{:type=>'journal'}).should have_selector "a[href='/advanced_search?f%5Btype%5D=journal']" + helper.render_constraints_query(:q=>'foobar', :f=>{:type=>'journal'}).should have_selector "a[href='/catalog?f%5Btype%5D=journal']" end end @@ -29,7 +24,7 @@ class DummyAlternateCatalogController < CatalogController; end result = helper.render_filter_element('type', ['journal'], {:q=>'biz'}) result.size.should == 1 # I'm not certain how the ampersand gets in there. It's not important. - result.first.should have_selector "a[href='/advanced_search?&q=biz']" + result.first.should have_selector "a[href='/catalog?&q=biz']" end end