rubyminitestruby-grapegrape-api

Testing Grape with Minitest - What class to inherit from?


My rails application is using minitest. It's unclear to me what class I should be inheriting for my test. I was thinking ActionController::TestCase but that doesn't seem right because it isn't attached to a rails controller. Any suggestions?

Edit: Can't use MiniTest::Unit::TestCase because it doesn't include anything to the test the individual api end points.


Solution

  • Instead of inheriting from a specific minitest class, I just included test helpers from Rack.

    class V0::YourAPI < ActiveSupport::TestCase
      include Rack::Test::Methods
    
      def app
        Rails.application
      end
    end