title: Rails 4 Strong Parameters test logging of Unpermitted parameters
body: <p>Does anyone know how to test the logging of Unpermitted parameters using Rspec. </p>
  
  <p>I have tried using Rails.logger.should_receive() with :warn, :info, :error but I can't seem to capture the log message.</p>
  
  <p>Here is the controller test:</p>
  
  <pre><code>describe Api::V2::ItemsController do
  
    before do
      @item = FactoryGirl.create(:item)
      @user_id = @item.user_id
      @invalid_user_id = @user_id + 1
    end
  
    it 'should not assign user_id' do
      put :update, id: @item.id, item: { user_id: @invalid_user_id }
      assigns(:item).user_id.should == @user_id
    end
  
    it 'should write "Unpermitted parameters: user_id" to log' do
      Rails.logger.should_receive(:warn).with("Unpermitted parameters: user_id")
      put :update, id: @item.id, item: { user_id: @invalid_user_id }
    end
  
  end
  </code></pre>