I am using the code below to test my controller.
If run like this, it produces the error listed below.
If, however, I uncomment the test_index method, everything works just fine.
I am using ruby-...@rails4.0.0
...............................................................................................
require "test_helper"
class StudentsControllerTest < ActionController::TestCase
include Devise::TestHelpers
before do
@student = FactoryGirl.create(:student)
end
#def test_index
#end
describe "stranger" do
test "can access index" do
get :index
assert_response :success
assert_not_nil assigns(:students)
end
end
describe "user" do
end
end
................................................................
test_can_access_index
Unable to resolve controller for user
Exception `NameError' at:
/home/stanley/.rvm/gems/ruby-2.0.0-p247@rails40/gems/actionpack-4.0.0/lib/action_controller/test_case.rb:438:in
`controller_class'
/home/stanley/.rvm/gems/ruby-2.0.0-p247@rails40/gems/actionpack-4.0.0/lib/action_controller/test_case.rb:589:in
`setup_controller_request_and_response'
/home/stanley/.rvm/gems/ruby-2.0.0-p247@rails40/gems/activesupport-4.0.0/lib/active_support/callbacks.rb:387:in
`_run__3961909968890346606__setup__callbacks'
/home/stanley/.rvm/gems/ruby-2.0.0-p247@rails40/gems/activesupport-4.0.0/lib/active_support/callbacks.rb:80:in
`run_callbacks'
/home/stanley/.rvm/gems/ruby-2.0.0-p247@rails40/gems/activesupport-4.0.0/lib/active_support/testing/setup_and_teardown.rb:26:in
`before_setup'
/home/stanley/.rvm/gems/ruby-2.0.0-p247@rails40/gems/activerecord-4.0.0/lib/active_record/fixtures.rb:713:in
`before_setup'
................................................................
Gemfile:
group :development, :test do
gem 'minitest-rails'
end
group :development do
gem 'guard'
gem 'guard-minitest'
end
group :test do
gem 'spring'
gem 'minitest-rails-capybara'
end
gem 'factory_girl'
gem 'turn'
gem 'devise'