Created
March 28, 2012 19:09
-
-
Save apolzon/2229566 to your computer and use it in GitHub Desktop.
include javascript rspec matcher
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| RSpec::Matchers.define :include_javascript do |expected| | |
| match do |actual| | |
| actual && actual.match(/<script src="\/javascripts\/#{expected}\.js.+ type="text\/javascript"><\/script>/) | |
| end | |
| failure_message_for_should do |actual| | |
| "expected that javascript tag #{expected} would be present, but was not" | |
| end | |
| failure_message_for_should_not do |actual| | |
| "expected that javascript tag #{expected} would not be present, but was" | |
| end | |
| description do | |
| "include javascript tag #{expected}" | |
| end | |
| end |
Author
Yes it does, but thats just the way it gets output from javascript_include_tag. No sense in supporting people who don't use the Rails helpers!
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Seems like it has a double quote requirement