Skip to content
This repository

Explain difference between Capybara's negative matchers and should_not #26

Merged
merged 1 commit into from over 2 years ago

2 participants

Evgeni Dzhelyov Bozhidar Batsov
Evgeni Dzhelyov

I have added an explanation why you should use Capybara's matchers in the acceptance tests.

But why you should prefer to use the capybara matchers in the view tests ?

They wait for a given timeout before returning false and this make ajax/javascript actions possible to test, but I think in the view test you don't need that.
I was going to change the "prefer" to "always", but I don't see why you should do it, maybe only for consistency with the acceptance ones.

Don't you have duplication in the acceptance and view tests ? The view is simple template and you will test the behavior in the acceptance test anyway, everything else that need unit testing will be in helpers and modules, so I don't see the value in testing the views.

Bozhidar Batsov bbatsov merged commit 659d31a into from
Fotos Georgiadis fotos referenced this pull request from a commit
Commit has since been removed from the repository and is no longer available.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
This page is out of date. Refresh to see the latest.

Showing 1 changed file with 3 additions and 0 deletions. Show diff stats Hide diff stats

  1. +3 0  README.md
3  README.md
Source Rendered
@@ -677,6 +677,9 @@ can be one steps file for all features for a particular object
677 677 }
678 678 end
679 679 ```
  680 +* Always use the Capybara negative matchers instead of should_not with positive,
  681 +they will retry the match for given timeout allowing you to test ajax actions.
  682 +[See Capybara's README for more explanation](https://github.com/jnicklas/capybara)
680 683
681 684 <a name="rspec"/>
682 685 ## RSpec

Tip: You can add notes to lines in a file. Hover to the left of a line to make a note

Something went wrong with that request. Please try again.