title: TypeError: can't cast ActionController::Parameters to integer Error code when testing controller in Rails 4.1.10
body: <p>I'm trying to learn how to test Rails controllers right now and I'm stuck.  Whenever I try to test my test/controllers/articles_controller_test.rb file I get this error message.</p>
  
  <pre><code>  ArticlesControllerTest#test_should_update_article:
    TypeError: can't cast ActionController::Parameters to integer
      app/controllers/articles_controller.rb:67:in `update'
      test/controllers/articles_controller_test.rb:50:in `block in &lt;class:ArticlesControllerTest&gt;'
  </code></pre>
  
  <p>The articles_controller_test.rb file is this:</p>
  
  <pre><code>require 'test_helper'
  
  class ArticlesControllerTest &lt; ActionController::TestCase
    setup do
      @article = articles(:welcome_to_rails)
    end
  
    test "should get index" do
      get :index
      assert_response :success
      assert_template 'index'
      assert_not_nil assigns(:articles)
    end
  
    test "should get new" do
      login_as(:eugene)
      get :new
      assert_response :success
    end
  
    test "should create article" do
      login_as(:eugene)
      assert_difference('Article.count') do
        post :create, :article =&gt; { :title =&gt; 'Post title',
                                    :body =&gt; 'Lorem ipsum..' }
      end
  
      assert_response :redirect
      assert_redirected_to article_path(assigns(:article))
    end
  
    test "should show article" do
      get :show, :id =&gt; @article.to_param
  
      assert_response :success
      assert_template 'show'
  
      assert_not_nil assigns(:article)
      assert assigns(:article).valid?
    end
  
    test "should get edit" do
      login_as(:eugene)
      get :edit, :id =&gt; @article.to_param
      assert_response :success
    end
  
    test "should update article" do
      login_as(:eugene)
      **put :update, :id =&gt; @article.to_param, :article =&gt; { :title =&gt; 'New Title' }**
      assert_redirected_to article_path(assigns(:article))
  end
  
    test "should destroy article" do
      login_as(:eugene)
      assert_nothing_raised { Article.find(@article.to_param)}
  
      assert_difference('Article.count', -1) do
        delete :destroy, :id =&gt; @article.to_param
      end
      assert_response :redirect
      assert_redirected_to articles_path
  
      assert_raise(ActiveRecord::RecordNotFound)  { Article.find(@article.to_param) }
    end
  end
  </code></pre>
  
  <p>I'm running Rails 4.1.10, and I'm pretty sure that my error has something to do with the Strong Params gem that Rails uses now.  If someone could show me the problem with my code and explain why it's wrong that would be greatly appreciated.</p>
  
  <p>This is the actual article_controller file, line 50 and line 67 are respectively outlined in stars:</p>
  
  <pre><code>class ArticlesController &lt; ApplicationController   
    before_filter :authenticate, :except =&gt; [:index, :show]
  
    def index
      @articles = Article.all
  
      respond_to do |format|
        format.html
        format.xml  { render :xml =&gt; @articles }
      end   end
       def show
      @article = Article.find(params[:id])
  
      respond_to do |format|
        format.html 
        format.xml  { render :xml =&gt; @article }
      end
    end
  
    def new
      @article = Article.new
  
      respond_to do |format|
        format.html 
        format.xml  { render :xml =&gt; @article }
      end
    end
  
    def edit
      @article = current_user.articles.find(params[:id])
    end
  
    def create
      @article = current_user.articles.new(article_params)
  
      respond_to do |format|
        if @article.save
          format.html { redirect_to(@article, :notice =&gt; 'Article was successfully created.') }
          **format.xml  { render :xml =&gt; @article, :status =&gt; :created, :location =&gt; @article }**
        else
          format.html { render :action =&gt; "new" }
          format.xml  { render :xml =&gt; @article.errors, :status =&gt; :unprocessable_entity }
        end
      end
    end
  
    def notify_friend
      @article = Article.find(params[:id])
      Notifier.email_friend(@article, params[:name], params[:email]).deliver
      redirect_to @article, :notice =&gt; "The message has been sent to your friend" 
    end
  
    def update
      **@article = current_user.articles.find(article_params)**
  
      respond_to do |format|
        if @article.update_attributes(params[:article])
          format.html { redirect_to(@article, :notice =&gt; 'Article was successfully updated.') }
          format.xml  { head :ok }
        else
          format.html { render :action =&gt; "edit" }
          format.xml  { render :xml =&gt; @article.errors, :status =&gt; :unprocessable_entity }
        end
      end   
    end
  
    def destroy
      @article = current_user.articles.find(params[:id])
      @article.destroy
  
      respond_to do |format|
        format.html { redirect_to(articles_url) }
        format.xml  { head :ok }
      end   
    end 
  
  end
  
  def article_params
    params.require(:article).permit(:title, :location, :categories, :excerpt, :body, :published_at)
  end
  </code></pre>