简体   繁体   English

在Rails中Rspec给出了无效的css错误,但应用程序运行正常。 如何解决这个问题?

[英]In Rails Rspec gives an invalid css error but the app works fine. How to fix this?

When I run rspec, it gives me an erro like this 当我运行rspec时,它给了我这样的错误

  1) AuthenticationPages sign in page 
     Failure/Error: before { visit dash_signin_path }
     ActionView::Template::Error:
       Invalid CSS after "...weight: normal ": expected ";", was "!!important;"
         (in /home/pubudu/Projects/sumaga-asapuwa/app/assets/stylesheets/application.css)
     # (sass):1453
     # ./app/views/layouts/_head.html.erb:7:in `_app_views_layouts__head_html_erb___1666364908545837178_48771360'
     # ./app/views/layouts/sessions.html.erb:4:in `_app_views_layouts_sessions_html_erb___2365426594570869078_49324500'
     # ./spec/requests/authentication_pages_spec.rb:7:in `block (3 levels) in <top (required)>'

The problem is, I haven't used font-weight: normal in my css! 问题是,我没有在我的CSS中使用font-weight: normal How can I pin point the exact problem? 我怎样才能指出确切的问题? I removed all the custom css I added but still the problem is there. 我删除了我添加的所有自定义CSS,但问题仍然存在。 Is it zurb foundation? 这是zurb基金会吗?

A jquery plugin I used had a css issue! 我使用的jquery插件有一个css问题! It used !!important . 它用!!important

Well, I don't find in the W3C CSS specifications that !!important is allowed (see http://www.w3.org/TR/css-cascade/#importance ). 好吧,我没有在W3C CSS规范中找到!!important是允许的(参见http://www.w3.org/TR/css-cascade/#importance )。

I'm not a sass expert, but to me it seems that !!important is the error that rspec is pointing out. 我不是sass专家,但对我来说似乎!!important是rspec指出的错误。

By the way, the file in which you have an error is a normal css file (css extension instead of scss). 顺便说一句,你有错误的文件是一个普通的css文件(css扩展而不是scss)。

Try using !important instead! 请尝试使用!important

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 在Rails中渲染局部。 为资源指定部分内容会出错,但不指定部分内容会很好。 是什么赋予了? - Rendering a partial in rails. Specifying the partial for a resource gives an error, but not specifying a partial works fine. What gives? Rails应用程序在本地运行良好,但heroku给出“应用程序错误” - Rails app works fine locally but heroku gives “application error” Capybara 测试不起作用,而实际应用程序运行良好。 Rails 5 中的 React 前端 - Capybara tests don't work, while actual app works fine. React front-end in Rails 5 Rails 6 + Bootstrap - Link_to 注销会引发错误,但 button_to 工作正常。 为什么会这样? - Rails 6 + Bootstrap - Link_to logout throws an error but button_to works fine. Why is it so? 如何修复 Rails 应用程序中的“无效查询参数”错误? - How to fix an "Invalid query parameters" error in a Rails app? rails3和rspec2:没有路由匹配错误(在应用程序中有效) - rails3 and rspec2: no route matches error (while it works in the app) Rake无法在Docker / Rails / Postgres设置中运行Rspec规范(但Web应用程序正常) - Rake cannot run Rspec specs in Docker/Rails/Postgres setup (but web app works fine) 未初始化的常量名称运行rspec时出错,但在Rails控制台中工作正常 - Uninitialized constant Name Error when run rspec, but works fine in rails console Rails应用程序在本地计算机上工作正常,但在Heroku上发生500错误 - Rails app works fine on local machine but 500 error occurs on heroku rails生成rspec:install没有错误,但是手册页 - rails generate rspec:install gives no error, but manpage
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM