tkymtk's blog

Ruby on Rails及びその周辺について調べたこと。Do whatever you want to do at your own pace.

RSpec: metaタグをテストする方法

  • findhave_selectorvisible: falseを使います。

例:

<meta name="viewport" content="width=device-width, initial-scale=1.0">

のテストは↓

expect(page).to have_css('meta[name="viewport"][content="width=device-width, initial-scale=1.0"]', visible: false )
間違いがあれば、ご指摘下さると幸いです。