Sha256: b1a79c20d2ea4ef80d58da1b95927721615aa0fcb7afd4de9924685660912287
Contents?: true
Size: 1.11 KB
Versions: 5
Compression:
Stored size: 1.11 KB
Contents
module Buscar module IndexMatchers class IncludeTag def initialize(name) @name = name end def matches?(index) @index = index !index.records.detect { |tag| tag.name == @name }.nil? end def failure_message "Expected records to include tag #{@name}. Got: [#{@index.records.collect(&:name).join(', ')}]" end def negative_failure_message "Expected records to exclude tag #{@name}. Got: [#{@index.records.collect(&:name).join(', ')}]" end end def include_tag(name) IncludeTag.new(name) end class SortTags def initialize(*names) @names = names end def matches?(index) @index = index return false unless index.records.length == @names.length index.records.collect(&:name) == @names end def failure_message "Expected tags to be sorted in this order: [#{@names.join(', ')}], but got: [#{@index.records.collect(&:name).join(', ')}]" end def negative_failure_message "Expected tags mot to be sorted in this order: [#{@names.join(', ')}]" end end def sort_tags(*names) SortTags.new(*names) end end end
Version data entries
5 entries across 5 versions & 1 rubygems
Version | Path |
---|---|
buscar-1.0.4 | spec/matchers.rb |
buscar-1.0.3 | spec/matchers.rb |
buscar-1.0.2 | spec/matchers.rb |
buscar-1.0.1 | spec/matchers.rb |
buscar-1.0.0 | spec/matchers.rb |