From b2f39920d2a568376a6ac32eeca8e0ca6b99a1a5 Mon Sep 17 00:00:00 2001 From: jonatack Date: Wed, 14 Jan 2015 18:27:52 +0100 Subject: [PATCH] Add test for #search_form_for with array of routes. Follow-up to previous commit 83ce93b to address issue #494. --- spec/ransack/helpers/form_helper_spec.rb | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/spec/ransack/helpers/form_helper_spec.rb b/spec/ransack/helpers/form_helper_spec.rb index 612c818..ec43654 100644 --- a/spec/ransack/helpers/form_helper_spec.rb +++ b/spec/ransack/helpers/form_helper_spec.rb @@ -6,8 +6,10 @@ module Ransack router = ActionDispatch::Routing::RouteSet.new router.draw do - resources :people - resources :notes + resources :people, :notes + namespace :admin do + resources :comments + end get ':controller(/:action(/:id(.:format)))' end @@ -372,6 +374,13 @@ module Ransack it { should match /action="\/people.json"/ } end + describe '#search_form_for with an array of routes' do + subject { + @controller.view_context.search_form_for([:admin, Comment.search]) {} + } + it { should match /action="\/admin\/comments"/ } + end + describe '#search_form_for with custom default search key' do before do Ransack.configure { |c| c.search_key = :example }