Using RSpec to test meta descriptions

A little code snippet to show you how to test meta descriptions in RSpec

How I went about testing the meta description on a view:

within('head', visible: false) do
  expect(page).to have_css("meta[name=description][content='The meta description for my webpage.']")

Something which helped me out a lot was using puts page.source in my test, this puts the HTML of the page out in my terminal so I could see exactly what was being put out.

Recent posts View all


5 Simple Ways to Keep a Computer Safe and Secure

You don’t need to be an expert to keep your computer safe and secure


6 things I do to respond to support queries quickly

Here are some of the things we do to make sure we're responding to support queries as quickly as possible