Created
August 19, 2011 07:36
-
-
Save vladvinnikov/1156266 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Changes in syntax | |
Selectors for the content of an element | |
before: | |
response.should have_selector("title", :content => "My Title") | |
after: | |
? | |
response.body.should have_selector("head title", :text => "My Title") | |
Value of an input field | |
before: | |
? | |
response.should have_selector("input", :value => "input field value") | |
after: | |
? | |
response.body.should have_selector("input[value='input field value']") | |
Link with url and content | |
before: | |
? | |
response.should have_selector("a", :href => "/url/path", :content => "Link text" | |
after: | |
? | |
response.body.should have_link("Link text", :href => "/url/path") | |
Selectors cannot be nested | |
Instead you can use | |
? | |
within("div.container") do | |
response.body.should have_link("Link text") | |
end | |
or just combine selectors one after the other in one big string | |
? | |
response.body.should have_selector("div.container a[href='/url/path']") |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment