Skip to content

Instantly share code, notes, and snippets.

@henrypoydar
Created January 7, 2015 19:30
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save henrypoydar/4384e8cd95fa82c4ff53 to your computer and use it in GitHub Desktop.
Save henrypoydar/4384e8cd95fa82c4ff53 to your computer and use it in GitHub Desktop.
minitest-rails "Unable to resolve controller"
class ArticlesController < ApplicationController
def index
render nothing: true
end
end
require 'test_helper'
class ArticlesControllerTest < ActionController::TestCase
describe 'GET #index' do
setup { get :index }
it "does x" do
assert true
end
it "does y" do
assert true
end
end
end
rake test TEST=test/controllers/articles_controller_test.rb
Run options: --seed 60196
# Running:
EE
Finished in 0.085434s, 23.4099 runs/s, 0.0000 assertions/s.
1) Error:
GET #index#test_0001_does x:
NameError: Unable to resolve controller for GET #index
2) Error:
GET #index#test_0002_does y:
NameError: Unable to resolve controller for GET #index
2 runs, 0 assertions, 0 failures, 2 errors, 0 skips
ENV['RAILS_ENV'] ||= 'test'
require File.expand_path('../../config/environment', __FILE__)
require 'rails/test_help'
require 'minitest/rails'
require "minitest/rails/capybara"
require 'mocha/mini_test'
class ActiveSupport::TestCase
fixtures :all
end
@blowmage
Copy link

blowmage commented Jan 7, 2015

Does the following work?

require 'test_helper'

describe ArticlesController do
  it 'GETs #index' do
    get :index
    assert true
  end
end

@zmajstor
Copy link

in my case, the problem was require "minitest/rails/capybara"

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment