I want to have the ability to test the correct swapping of a stylesheet in my test suite. With this post about testing the page title using Capybara, I thought I would be able to test any link
tags in the head
section of the page. But it seems I am mistaken.
With a step like this:
save_and_open_page
page.should have_xpath("//link") # just something as simple as this, first.
save_and_open_page
generates a HTML like this (with some stuff removed for brevity):
<head>
...
<link href="/home/ramon/source/unstilted/public/system_test/stylesheets/fancake/css/2.css?1323572998" type="text/css" class="jquery-styler" rel="stylesheet">
...
</head>
But I get this failure:
expected xpath "//link" to return something (RSpec::Expectations::ExpectationNotMetError)
Given all that, how do I test a stylesheet?
Thanks!