6

I have a controller like follows:

namespace :admin do
  resources :posts
end


# app/controllers/admin_posts_controller.rb
module Admin
  class PostsController < ApplicationController
  end
end

The problem is I don't know where Admin::PostsControllerTest goes.

I was expecting something like following works:

# test/functional/admin/posts_controller_test.rb
module Admin
  class PostsControllerTest < ActionController::TestCase
  end
end

But if I do that I get the following error when I run rake test:functionals :

RuntimeError: @controller is nil: make sure you set it in your test's setup method.

1 Answer 1

10

You've got the right location. Try this:

class Admin::PostsControllerTest < ActionController::TestCase
  #put your tests here
end
0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.