One of my tests looks like this…
require ‘test_helper’
class ResortsControllerTest < ActionController::TestCase
other tests
def test_destroy_works_when_admin
UserSession.create(users(:admin)) # logs a user in
resort = Resort.first
delete :destroy, :id => resort
assert_redirected_to resorts_url
assert !Resort.exists?(resort.id)
end
end
It works fine and passes when I do this
rake test:functionals TEST=test/functional/resorts_controller_test.rb
But when I do this (run it with my other tests)
rake
It fails, like this
- Failure:
test_destroy_works_when_admin(ResortsControllerTest)
[/test/functional/resorts_controller_test.rb:104]:
Expected response to be a redirect to http://test.host/resorts but was
a redirect to http://test.host/user_sessions/new.
Here’s my test_helper
ENV[“RAILS_ENV”] = “test”
require File.expand_path(File.dirname(FILE) +
“/…/config/environment”)
require ‘test_help’
require “authlogic/test_case” # include at the top of test_helper.rb
class ActiveSupport::TestCase
self.use_transactional_fixtures = true
self.use_instantiated_fixtures = false
fixtures :all
end