title: Minitest for get request with params
body: <p>I'm having trouble with one of my tests, even though the controller is working perfectly.</p>
  
  <p>So, I have a form to change the VIP status of an user.</p>
  
  <pre><code>&lt;%= form_tag("/activate/#{@user.id}", method: :get, class: "form-inline space-bottom") do |f| %&gt;
      &lt;%= hidden_field_tag :vip, false %&gt;
      &lt;%= check_box_tag :vip, type:"checkbox" %&gt;
      &lt;%= date_field_tag(:vip_expiration_date, @user.vip_expiration_date) %&gt;
      &lt;button type="submit"&gt;
          Change
      &lt;/button&gt;
  </code></pre>
  
  <p>This form sends to this route:</p>
  
  <pre><code>get  '/activate/:id',           to: 'users#activate_vip'
  </code></pre>
  
  <p>and gets to this controller action:</p>
  
  <pre><code>def activate_vip
    @user = User.find(params[:id])
    if @user.update_attributes(activate_vip_params)
      flash[:success] = "VIP status updated"
      redirect_to @user
    else
      render show
    end
  end
  </code></pre>
  
  <p>also:</p>
  
  <pre><code>def activate_vip_params
    params.permit(:vip_expiration_date, :vip)
  end
  </code></pre>
  
  <p>And this action works just fine, no problems, so I wanted to make a test for it using minitest:</p>
  
  <pre><code>  test "Admin should be able to change vip status" do
      log_in_as(@user)
      get "/activate/#{@other_user.id}", params: {:vip =&gt; true}
      assert @other_user.vip
    end
  </code></pre>
  
  <p>I was sure this test would simply pass, but I'm getting the error "Expected false to be truthy."</p>
  
  <p>My intuition said it's related to how I pass the parameters, so I tried several variations on params: but all without success. Can someone help me on this one?</p>
  
  <p>I'm using gem 'minitest', '~> 5.10', '!= 5.10.2' and rails 5</p>
  
  <p>EDIT:</p>
  
  <p>Changed the code so I could "require" the user.</p>
  
  <pre><code>    &lt;%= form_for @user, url: "/activate/#{@user.id}", class: "form-inline" do |f| %&gt;
      &lt;%= hidden_field_tag :vip, false %&gt;
      &lt;%= f.check_box :vip, type:"checkbox" %&gt;
      &lt;%= f.date_field :vip_expiration_date %&gt;
      &lt;%= f.submit "Change" %&gt;
      &lt;% end %&gt;
  </code></pre>
  
  <p>and the controller</p>
  
  <pre><code>def activate_vip_params
    params.require(:user).permit(:vip_expiration_date, :vip)
  end
  </code></pre>
  
  <p>and the test:</p>
  
  <pre><code>test "Admin should be able to change vip status" do
    log_in_as(@user)
    patch "/activate/#{@other_user.id}", user: { vip: true } 
    assert @other_user.vip
  end
  </code></pre>
  
  <p>Still no success. The controller works but can't make the test.</p>
  
  <p>------ EDIT ------</p>
  
  <p>Nevermind. It was a stupid mistake.</p>
  
  <p>I just had to add "vip:false" in the fixture for @other_user do initialise the variable.</p>