通过 yarn 添加 bootstrap 主题后系统测试失败
System test fails after adding bootstrap theme via yarn
我有一个最初通过的简单系统测试:
require 'application_system_test_case'
class UserVisitHomePageTest < ApplicationSystemTestCase
test 'User should see home page' do
visit root_path
assert_css 'h1', text: 'Home'
end
end
然后,我通过 yarn 安装 material-dashboard,并在 app/javascript/stylesheets/application.scss
中添加了这一行
@import '~material-dashboard/assets/scss/material-dashboard';
我根据 material-仪表板 documentation.
调整我的 app/views/layouts/application.html.erb
一切正常,主题已应用,但我的系统测试现在失败:
UserVisitHomePageTest#test_User_should_see_home_page:
ActionController::RoutingError: No route matches [GET] "/assets/css/material-dashboard.css"
- 为什么测试要搜索那条路线
/assets/css/material-dashboard.css
?
- 我怎样才能让它通过?
我能够通过更新我的 app/views/layouts/application.html.erb
、删除(不包括)那些引用资产文件的 CSS link 标签和 JS 脚本标签来使系统测试通过material 仪表板。
我有一个最初通过的简单系统测试:
require 'application_system_test_case'
class UserVisitHomePageTest < ApplicationSystemTestCase
test 'User should see home page' do
visit root_path
assert_css 'h1', text: 'Home'
end
end
然后,我通过 yarn 安装 material-dashboard,并在 app/javascript/stylesheets/application.scss
@import '~material-dashboard/assets/scss/material-dashboard';
我根据 material-仪表板 documentation.
调整我的app/views/layouts/application.html.erb
一切正常,主题已应用,但我的系统测试现在失败:
UserVisitHomePageTest#test_User_should_see_home_page:
ActionController::RoutingError: No route matches [GET] "/assets/css/material-dashboard.css"
- 为什么测试要搜索那条路线
/assets/css/material-dashboard.css
? - 我怎样才能让它通过?
我能够通过更新我的 app/views/layouts/application.html.erb
、删除(不包括)那些引用资产文件的 CSS link 标签和 JS 脚本标签来使系统测试通过material 仪表板。