Class: ScraperWiki::API::Matchers::SetAnyOf

Inherits:
DatastoreMatcher show all
Defined in:
lib/scraperwiki-api/matchers.rb

Instance Method Summary collapse

Methods inherited from DatastoreMatcher

#does_not_match?, #failure_message, #failure_size, #failures, #items, #matches, #matches?, #negative_failure_message

Methods inherited from CustomMatcher

#does_not_match?, #failure_message, #initialize, #matches?, #negative_failure_message

Constructor Details

This class inherits a constructor from ScraperWiki::API::Matchers::CustomMatcher

Instance Method Details

#failure_descriptionObject



439
440
441
# File 'lib/scraperwiki-api/matchers.rb', line 439

def failure_description
  "records didn't set any of #{@expected.join ','}"
end

#mismatchesObject



431
432
433
434
435
436
437
# File 'lib/scraperwiki-api/matchers.rb', line 431

def mismatches
  items.select do |item|
    @expected.all? do |field|
      item[field].respond_to?(:empty?) ? item[field].empty? : !item[field]
    end
  end
end

#negative_failure_descriptionObject



443
444
445
# File 'lib/scraperwiki-api/matchers.rb', line 443

def negative_failure_description
  "records set any of #{@expected.join ','}"
end