title: How to pass Ransack parameters to the path for test a page on Rails Rspec
body: <p>I have a view <code>article/index</code> well covered with tests. After improving the application, we added a separate search form and now you can get to the index page only if you pass it parameters from the search form. All tests for the index have failed because of this new <code>search_index</code> form.</p>
  <p>Is there an easy way to pass parameters to <code>ArticlePage.new</code> at the very beginning to make the tests work again?</p>
  <p>We use Ransack to find records. That is, to get to the index page, I need to pass at least one search parameter.Example of parameters:</p>
  <p><code>http://localhost:3000/articles?utf8=%E2%9C%93&amp;q%5Bperson_id%5D=&amp;q%5Bboard_id%5D=</code></p>
  <p>Controller:</p>
  <pre class="lang-rb prettyprint-override"><code>class ArticlesController &lt; ApplicationController
     def index
        redirect_to search_index_articles_path if current_user.admin? &amp;&amp; params[:q].nil?
        @articles = search_results
     end
  end
  </code></pre>
  <p>RSpec file:</p>
  <pre class="lang-rb prettyprint-override"><code># spec/features/tests/articles/article_spec.rb
  
  RSpec.feature 'Articles navigation', type: :system, js: true do
    let(:user) { create(:user) }
    let(:article_page) { Articles::ArticlePage.new }
  
    before do
      sign_in(user, scope: :user)
      article_page.visit_page
    end
  
    scenario 'title input is correct' do
      expect(find_field('Title').value).to eq ''
    end
  end
  </code></pre>
  <pre class="lang-rb prettyprint-override"><code># spec/fearures/pages/articles/article_page.rb
  require 'features/pages/application_page'
  
  module Articles
    class ArticlePage &lt; ApplicationPage
      def visit_page
        visit articles_path( q: {person_id: 'John Doe' } )
      end
    end
  end
  </code></pre>
  <p>I try to pass Ransack parameters to the <code>articles_path</code> but it is not correct and in the result on the page no one items found.</p>