Skip to content

Instantly share code, notes, and snippets.

@crimsonknave
Created February 20, 2012 20:35
Show Gist options
  • Save crimsonknave/1871244 to your computer and use it in GitHub Desktop.
Save crimsonknave/1871244 to your computer and use it in GitHub Desktop.
Adding descriptions to json_spec matchers
class JsonSpec::Matchers::BeJsonEql
def description
"be equal to #{@expected}#{" at path #{@path}" if @path}"
end
end
class JsonSpec::Matchers::HaveJsonPath
def description
"have json path #{@path}"
end
end
class JsonSpec::Matchers::HaveJsonType
def description
"be json type #{@klass}#{" at path #{@path}" if @path}"
end
end
class JsonSpec::Matchers::HaveJsonSize
def description
"be #{@expected} long#{" at path #{@path}" if @path}"
end
end
class JsonSpec::Matchers::IncludeJson
def description
"include #{@expected_json}#{" at path #{@path}" if @path}"
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment