title: How to set a value in the params hash when testing a Rails helper method with RSpec?
body: <h3>In Ruby on Rails 4, with RSpec 3.1, how do I set the values of the <code>params</code> hash when testing a Rails helper method?</h3>
  
  <p>I want to set <code>params[:search] = 'my keyword search'</code> for use in my helper method and then call it from within the <code>it</code> example block.</p>
  
  <h3>spec/helpers/books_helper_spec.rb:</h3>
  
  <pre><code>require 'rails_helper'
  
  describe BooksHelper do
    describe "#page_title_helper" do
      let(:params) { {search: 'my keyword search'} }
  
      it "should read the params hash" do
        expect(helper.params[:search]).to eq "my keyword search"
      end
    end
  end
  </code></pre>
  
  <h3>app/helpers/books_helper.rb:</h3>
  
  <pre><code>BooksHelper
    def title_helper
      if params[:search]
        "Books related to #{params[:search]}"
      else
        "All Books"
      end
    end
  end
  </code></pre>