Sha256: 22775ed2ef02142cc4c95f4fc211c183db1b3b1ebaa1b7f2374c07bca2559ef9
Contents?: true
Size: 675 Bytes
Versions: 13
Compression:
Stored size: 675 Bytes
Contents
class SpecMatcher def initialize(context_and_or_spec_name, context_name) @context_name = context_name @name_to_match = context_and_or_spec_name end def matches? spec if matches_context? if matches_spec?(spec) or context_only? return true end end if matches_spec? spec if spec_only? spec return true end end end private def spec_only? spec @name_to_match == spec end def context_only? @name_to_match == @context_name end def matches_context? @name_to_match =~ /^#{@context_name}\b/ end def matches_spec? spec @name_to_match =~ /\b#{spec}$/ end end
Version data entries
13 entries across 13 versions & 1 rubygems