
Security News
CISA’s 2025 SBOM Guidance Adds Hashes, Licenses, Tool Metadata, and Context
CISA’s 2025 draft SBOM guidance adds new fields like hashes, licenses, and tool metadata to make software inventories more actionable.
= assert_valid_markup plugin for Rails
Validate your (X)HTML from within your functional tests. If anything changes to invalidate your markup, you'll know pronto.
If xmllint/xmlcatalog are available in your PATH, this plugin will use them to validate your xml. When doing so, it will automatically fetch and cache all DTDs locally so that you don't incur a network hit on future runs.
Otherwise, validations will be done using the W3C Validator web service (http://validator.w3.org/). Responses from the web service are cached, so your tests aren't slowed down unless something has changed.
== Installation
Install as a gem:
gem install assert_valid_markup
and edit config/environments/test.rb:
config.gem 'assert_valid_markup'
or install as a plugin:
./script/plugin install http://github.com/wr0ngway/assert_valid_markup
== Usage
Calling the assertion with no parameters validates whatever is in @request.body, which is automatically set by the existing get/post/etc helpers. For example:
class FooControllerTest < Test::Unit::TestCase
def test_bar_markup
get :bar
assert_valid_markup
end
end
Add a string parameter to the assertion to validate any random fragment. Por ejemplo:
class FooControllerTest < Test::Unit::TestCase
def test_bar_markup
assert_valid_markup "<div>Hello, world.</div>"
end
end
For the ultimate in convenience, use the class-level methods to validate a slew of actions in one line. Par exemple:
class FooControllerTest < Test::Unit::TestCase
assert_valid_markup :bar, :baz, :qux
end
# automatically validate all GETs in BarControllerTest
class BarControllerTest < Test::Unit::TestCase
assert_all_valid_markup
end
# Add this to test_helper to automatically validate the responses for ALL GETs in ALL controllers
class ActionController::TestCase < ActiveSupport::TestCase
assert_all_valid_markup
end
== Credits
Scott Raymond sco@scottraymond.net. Released under the MIT license. Matt Conway matt@conwaysplace.com (xmllint additions) Latest version: http://github.com/wr0ngway/assert_valid_markup
FAQs
Unknown package
We found that assert_valid_markup demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
CISA’s 2025 draft SBOM guidance adds new fields like hashes, licenses, and tool metadata to make software inventories more actionable.
Security News
A clarification on our recent research investigating 60 malicious Ruby gems.
Security News
ESLint now supports parallel linting with a new --concurrency flag, delivering major speed gains and closing a 10-year-old feature request.