我有一些可以独立运行的测试
rails t test/controllers/briefs_controller_test.rb
Running via Spring preloader in process 24174
Run options: --seed 46330
# Running:
.................................
Finished in 9.219203s, 3.5795 runs/s, 3.9049 assertions/s.
33 runs, 36 assertions, 0 failures, 0 errors, 0 skips
但是它们在一起产生
Running via Spring preloader in process 24023
Run options: --seed 35139
# Running:
..............................................................................................E
Error:
BriefsControllerTest#test_should_get_project_brief_by_admin:
NoMethodError: undefined method `make_response!' for ProjectsController:Class
test/controllers/briefs_controller_test.rb:9:in `block in <class:BriefsControllerTest>'
bin/rails test test/controllers/briefs_controller_test.rb:7
.....E
Error:
BriefsControllerTest#test_should_get_project_brief_by_brand:
NoMethodError: undefined method `make_response!' for ProjectsController:Class
test/controllers/briefs_controller_test.rb:15:in `block in <class:BriefsControllerTest>'
我最初是在怀疑灯具,但是只有使用get
或post
和project
路线进行测试的控制器崩溃了。
require 'test_helper'
class BriefsControllerTest < ActionDispatch::IntegrationTest
include Devise::Test::IntegrationHelpers
include I18n::Alchemy
test "should get project brief by admin" do
sign_in users(:admin)
get project_brief_url(projects(:project_two).id)
assert_response :success
end
test "should get project brief by brand" do
sign_in users(:brand)
get project_brief_url(projects(:project_one).id)
assert_response :success
end
[end of test file removed for clarity ]
有什么想法吗?
仅在基于其他路由上projects
个调用的路由上发生这种情况。