0

Using a Grape API and add the tests in the Rakefile. Its a Rack application mounted on the main rails app.

namespace :test do
  Rake::TestTask.new(:api) do |t|
    t.pattern = 'test/api/**/*_test.rb'
  end
end

Rake::Task[:test].enhance [ 'test:api' ]

However if I try to test it there aren't any of the controller methods.

describe API do
  # get, post, patch etc all raise
end

Error below.

NoMethodError: undefined method `get' for #<#<Class:0x007fd63cdfc0e0>:0x007fd63cdc7a70>

How can I test rack apps with minitest-rails bdd?

AJcodez
  • 31,780
  • 20
  • 84
  • 118

1 Answers1

0

Figured it out.

class MiniTest::Spec
  include FactoryGirl::Syntax::Methods
  include Rack::Test::Methods

  def app
    API
  end
end
AJcodez
  • 31,780
  • 20
  • 84
  • 118