1
0
mirror of https://github.com/onkelbeh/cheatsheets.git synced 2025-06-15 14:47:53 +02:00

Remove bad negative example from capybara sheet (#1798)

Removes the bad negative example and adds a new one
that still has bad performance. It use to be that `not_to` would wait
in a non-performant way:
https://www.cloudbees.com/blog/faster-rails-tests 
but now it it no longer waits: 
https://github.com/rubocop/rubocop-rspec/issues/378#issuecomment-463250177
This commit is contained in:
Allison Browne 2023-03-13 23:09:31 -04:00 committed by GitHub
parent ea5f9100f2
commit db559f8898
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -122,11 +122,11 @@ In RSpec, you can use `page.should` assertions.
expect(page).to have_no_button('Save') # OK
```
```ruby
expect(page).not_to have_button('Save') # Bad
expect(page).not_to have_button('Save') # OK
```
```ruby
!expect(page).to have_button('Save') # Bad
```
Use `should have_no_*` versions with RSpec matchers because
`should_not have_*` doesn't wait for a timeout from the driver.
## RSpec