diff --git a/README.md b/README.md index 434801c..8868fc7 100644 --- a/README.md +++ b/README.md @@ -245,6 +245,28 @@ class ErbImplementationTest < ActiveSupport::TestCase end end +``` +If you're using RSpec you can add the following code to `spec/better_html_spec.rb` + +```ruby +# frozen_string_literal: true + +require "rails_helper" + +RSpec.describe "BetterHtml" do + it "does assert that all .html.erb templates are parseable" do + erb_glob = Rails.root.join( + "app", "views", "**", "{*.htm,*.html,*.htm.erb,*.html.erb,*.html+*.erb}" + ) + + Dir[erb_glob].each do |filename| + data = File.read(filename) + expect { BetterHtml::BetterErb::ErubiImplementation.new(data).validate! }.not_to raise_exception + end + end +end + + ``` ## Working with the ERB parser