Created
May 18, 2011 02:01
-
-
Save tommyh/977856 to your computer and use it in GitHub Desktop.
Rspec Matcher: Valid Json
This file contains 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
#in controller test | |
# response.body.should be_valid_json | |
RSpec::Matchers.define :be_valid_json do | |
match do |actual| | |
JSON.parse(actual) | |
end | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment