简体   繁体   中英

Michael Hartl's Railstutorial : Listing 7.32: A template for tests of the error messages

The example code:

assert_select 'div#<CSS id for error explanation>'
assert_select 'div.<CSS class for field with error>'

This generates: DEPRECATION WARNING: The assertion was not run because of an invalid css selector. ] 16% Time: 00:00:01, ETA: 00:00:06 unexpected '#' after '[#]' (called from block in at /home/ubuntu/workspace/sample_app/test/integration/users_signup_test.rb:25) DEPRECATION WARNING: The assertion was not run because of an invalid css selector. unexpected '<' after '.' (called from block in at /home/ubuntu/workspace/sample_app/test/integration/users_signup_test.rb:26)

I read somewhere that versions 4.2+ need an other way to do assert_select. Is that true? And what should be used? [ I have to say; I am still an absolute beginner ]

<CSS class...>下的your-class<CSS id ...>下的your-id替换

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM