title: Rails, minitest: How to test the output of a controller
body: <p>My controller looks like this:</p>
  
  <pre><code>class CalculatorController &lt; ApplicationController
  
    def calculate
      money = params[:money].to_f
     @worktime =  divide(money, 25)
    end
  
    private
  
    def divide(money, worktime)
      output = money/worktime
    end
  end
  </code></pre>
  
  <p>I wrote a Test like this:</p>
  
  <pre><code>require 'test_helper'
  
  class CalculatorControllerTest &lt; ActionDispatch::IntegrationTest
    test "response" do
      get calculate_path
      assert_equal 200, response.status
    end
  end
  </code></pre>
  
  <p>This test passes. Now, I want to write a test, to check, whether the output is correct. I tried this:</p>
  
  <pre><code>require 'test_helper'
  
  class CalculatorControllerTest &lt; ActionDispatch::IntegrationTest
    test "response" do
      get calculate_path(money: 25)
      assert_equal 200, response.status
      assert_equal 1, @response.worktime
    end
  end
  </code></pre>
  
  <p>But this error occurs: <code>NoMethodError: undefined method</code>worktime'` </p>
  
  <p>How do I test the output of the controller? ( In my case @worktime)</p>