2016-01-16 86 views
0

我不斷收到此錯誤有關CSS第7.7節:Depretieation警告在邁克爾·哈特爾的Ruby CSS on Rails的教程7.7

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在我的代碼):

test "invalid signup information" do 
get signup_path 
assert_no_difference 'User.count' do 
post users_path, user: { name: "", 
         email: "[email protected]", 
         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 

我已經覈對過這書上的代碼,它似乎是他有什麼,它只是困擾我,因爲錯誤顯示出來的我運行的每一個測試。

回答

2

你應該用錯誤解釋>的< CSS id替換你正在顯示錯誤解釋的框的id--與類相同。你所複製的是一個建議的模板,而不是可運行的代碼

+0

我們會感到愚蠢的哈哈。謝謝。 – tfantina

相關問題