Skip to content

Instantly share code, notes, and snippets.

@tommyh
Created May 18, 2011 02:01
Show Gist options
  • Save tommyh/977856 to your computer and use it in GitHub Desktop.
Save tommyh/977856 to your computer and use it in GitHub Desktop.
Rspec Matcher: Valid Json
#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