Q:

Undefined method `get' in Minitest

I'm trying to create a functional test for my RESTful API with MiniTest:
    require 'test_helper'
class AutomaticTests < ActiveSupport::TestCase
  test "test1" do
    get '/'
  end
end

The code above triggers an error:

Minitest::UnexpectedError: NoMethodError: undefined method `get' for

My test_helper.rb looks like this:
ENV['RAILS_ENV'] ||= 'test'
require File.expand_path('../../config/environment', __FILE__)
require 'rails/test_help'
require "minitest/rails"

class ActiveSupport::TestCase
  fixtures :all

  class << self
    alias :context :describe
  end
end

How can I make 'get' method work?

A:

Get comes from rack/test, so you will need to add that gem to your Gemfile:
gem 'rack-test', group: :test

And then, in your test file or your test_helper.rb, add the following line:
require "rack/test"

... and ...
class ActiveSupport::TestCase
  include Rack::Test::Methods
end

You can also use the rack-minitest gem.

