Skip to content

Commit

Permalink
Remove a case that is not negative examples in the capybara sheet (#2122
Browse files Browse the repository at this point in the history
)

The above case is a new Bad case added by #1798 . It is designated as Bad due to performance issues, but it is not actually a Negative example. In practice, the following would be the same test:

```ruby
expect(page).to have_button('Save')
!expect(page).to have_button('Save')
```

This is not an example that will appear on the capybara cheat sheet, because it is a problem with how RSpec is written. I think it should be removed because it creates confusion.
  • Loading branch information
ydah authored Mar 21, 2024
1 parent e8bfec3 commit dc91d7f
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions capybara.md
Original file line number Diff line number Diff line change
Expand Up @@ -119,15 +119,15 @@ In RSpec, you can use `page.should` assertions.
### About negatives

```ruby
expect(page).to have_no_button('Save') # OK
```
```ruby
expect(page).not_to have_button('Save') # OK
expect(page).to have_no_button('Save')
```

```ruby
!expect(page).to have_button('Save') # Bad
expect(page).not_to have_button('Save')
```

The two above statements are functionally equivalent.

## RSpec

### Matchers
Expand Down

0 comments on commit dc91d7f

Please sign in to comment.