1) Posts when the user has authenticated when there are posts can be deleted from link on posts page
Failure/Error: click_link 'Destroy'
Capybara::ElementNotFound:
Unable to find link "Destroy"
# ./posts_spec.rb:71:in `block (5 levels) in <top (required)>'
# ./posts_spec.rb:69:in `block (4 levels) in <top (required)>'
I tried modifying the way the Capybara test selects the 'Destroy' link. Instead of:
within 'tr:last-child' do
page.driver.accept_js_confirms!
click_link 'Destroy'
end
I tried:
within 'tr:last' do
page.driver.accept_js_confirms!
click_link 'Destroy'
end
That delivered a new kind of error:
Failure/Error: within 'tr:last' do
Capybara::Webkit::InvalidResponseError:
SYNTAX_ERR: DOM Exception 12
# ./posts_spec.rb:69:in `block (4 levels) in <top (required)>'
So, that didn't work. There are two other places in the spec where the tutorial I'm using said to use "tr:last" instead of "tr:last-child" because of a Capybara bug. I see now why the tutorial didn't have us change the middle describe block.
So I went back and took a shot in the dark and tried giving an id of "destroy-link" to the <td> containing the 'Destroy' link. Capybara didn't like that:
Failure/Error: within '#destroy_link' do
Capybara::ElementNotFound:
Unable to find css "#destroy_link"
# ./posts_spec.rb:69:in `block (4 levels) in <top (required)>'
The 'Destroy' link is actually in a child of the td, so in hindsight I'm not too surprised that it didn't work. Looking at the code a second (fourth? fifth?) time, though, I had an idea. Can I select the td>tr ?
Apparently not.
Failure/Error: within 'tr>td' do
Capybara::ElementNotFound:
Unable to find css "tr>td"
# ./posts_spec.rb:69:in `block (4 levels) in <top (required)>'
I tried it with and without the spaces on either side of the child '>'. No dice. Time for more digging through StackOverflow ;). 'Night, all!
No comments:
Post a Comment
Comments? Questions? Complaints? Coladas?