Rspec Html Matchers

screenshot of Rspec Html Matchers

Old school have_tag, with_tag(and more) matchers for rspec 3 (Nokogiri powered)

Overview

The rspec-html-matchers gem provides RSpec matchers for testing complex HTML output. It is designed to test HTML elements and attributes with developer-friendly error messages. The gem is built on top of Nokogiri and has support for Capybara testing framework. It offers a syntax similar to the have_tag matcher from RSpec. Installation is simple and usage examples are provided for matching tags, content, and form inputs.

Features

  • RSpec Matchers: Provides RSpec matchers for testing HTML elements and attributes.
  • Developer-friendly Output: Offers clear error messages for easier debugging.
  • Built on Nokogiri: Utilizes the Nokogiri gem for HTML parsing.
  • Support for Capybara: Works seamlessly with the Capybara testing framework.
  • Syntax Similar to have_tag: Familiar syntax for matching HTML elements.
  • Framework Agnostic: Can take input as a String or Capybara's page object.
  • Form Input Matchers: Includes shorthand matchers for various form input types.