簡體   English   中英

Michael Hartel的Ruby on Rails教程7.7中的CSS貶值警告

[英]Depretieation Warning for CSS in Michael Hartel's Ruby on Rails tutorial 7.7

我在7.7節中不斷收到有關CSS的錯誤:

DEPRECATION WARNING: The assertion was not run because of an invalid css 
unexpected '#' after '[#<Nokogiri::CSS::Node:0x000000076e23f8 @type=:ELEMENT_NAME, 
@value=["div"]>]' (called from block in <class:UsersSignupTest> at   
/home/ubuntu/workspace/sample-app/test/integration/users_signup_test.rb:14)

DEPRECATION WARNING: The assertion was not run because of an invalid css selector.
unexpected '<' after '.' (called from block in <class:UsersSignupTest> at 
/home/ubuntu/workspace/sample-app/test/integration/users_signup_test.rb:15)

下面是users_signup_test.rb測試,其中assert_selects(在我的代碼中的第14和15行)的Deprecation Warning中提到了特定問題:

 test "invalid signup information" do
get signup_path
assert_no_difference 'User.count' do
post users_path, user: { name: "",
                        email: "user@invalid",
                        password: "foo",
                        password_confirmation: "bar" }
  end
  assert_template 'users/new'
  assert_select 'div#<CSS id for error explanation>'
  assert_select 'div.<CSS class for field with error>'
end

我已經對照本書檢查了這段代碼,這似乎是他所擁有的,它困擾着我,因為在我運行的每個測試中都會顯示錯誤。

您應該將<錯誤解釋的CSS ID>替換為您要在其中顯示錯誤解釋的框的ID,與該類相同。 您復制的是建議的模板,而不是可運行的代碼

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM