title: rails are functions defined in tests available in controllers
body: <p>could someone explain the following method/function and explain if it is located in test/test_helper.rb how other non test classes/controllers  get access to it?</p>
  
  <pre><code># Logs in a test user.
    def log_in_as(user, options = {})
      password = options[:password] || 'password'
      remember_me = options[:remember_me] || '1'
      if integration_test?
        post login_path, session: { email: user.email,
                                    password: password,
                                    remember_me: remember_me }
      else
        session[:user_id] = user.id
      end
    end
  </code></pre>