Sha256: f91a04020b97b679becaabd0020bd6eb9b230d504d62a1b8271d48d2cae45d03
Contents?: true
Size: 472 Bytes
Versions: 2
Compression:
Stored size: 472 Bytes
Contents
# The ParseAsMatcher wraps the logic for checking that a string of Ruby code # is parsed to the expected AST. # class ParseAsMatcher def initialize(expected) @expected = expected end def matches?(actual) @actual = actual.to_ast.reduced_graph @actual == @expected end def failure_message ["Expected:\n#{@actual.inspect}\n", "to equal:\n#{@expected.inspect}"] end end class Object def parse_as(ast) ParseAsMatcher.new(ast) end end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
melbourne-1.0.1 | spec/matchers/parse_as.rb |
melbourne-1.0.0 | spec/matchers/parse_as.rb |