Skip to content

Commit

Permalink
just test against catalog controller rather than trying to be too cle…
Browse files Browse the repository at this point in the history
…ver. maybe after Rails 3.1 support is dropped we can do an even better job here..
  • Loading branch information
cbeer committed Apr 17, 2012
1 parent a1d8962 commit c4b7bfb
Showing 1 changed file with 5 additions and 10 deletions.
15 changes: 5 additions & 10 deletions test_support/spec/helpers/render_constraints_helper_spec.rb
Expand Up @@ -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

Expand All @@ -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

Expand Down

0 comments on commit c4b7bfb

Please sign in to comment.