assert_template matches against Regexp #5375

Merged
merged 1 commit into from Mar 12, 2012

Projects

None yet

2 participants

@nertzy
Contributor
nertzy commented Mar 11, 2012

This allows for more strict template assertions, while maintaining backward compatibility.

For example, if you use assert_template("foo/bar") and "foo/bar/baz" was rendered, the test passes.

But if you use assert_template(%r{\Afoo/bar\Z}), you will catch that a different template was rendered.

Also, if you passed an unsupported argument to assert_template() in the past, it would silently succeed. Now it raises an ArgumentError.

@nertzy nertzy assert_template matches against Regexp
This allows for more strict template assertions,
while maintaining backward compatibility.

For example, if you use assert_template("foo/bar")
and "foo/bar/baz" was rendered, the test passes.

But if you use assert_template(%r{\Afoo/bar\Z}),
you will catch that a different template was
rendered.

Also, if you passed an unsupported argument to
assert_template() in the past, it would silently
succeed. Now it raises an ArgumentError.
b142bd8
@tenderlove tenderlove merged commit fd22471 into rails:master Mar 12, 2012
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment