Class: ScraperWiki::API::Matchers::CountMatcher

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

Instance Method Summary collapse

Methods inherited from TablesMatcher

#on

Methods inherited from CustomMatcher

#does_not_match?, #initialize

Constructor Details

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

Instance Method Details

#failure_messageObject



314
315
316
# File 'lib/scraperwiki-api/matchers.rb', line 314

def failure_message
  "expected #{@actual['short_name']} to have #{@expected} rows, not #{@actual['datasummary']['tables'][@table]['count']}"
end

#matches?(actual) ⇒ Boolean

Returns:

  • (Boolean)


309
310
311
312
# File 'lib/scraperwiki-api/matchers.rb', line 309

def matches?(actual)
  super
  actual['datasummary']['tables'][@table]['count'] == @expected
end

#negative_failure_messageObject



318
319
320
# File 'lib/scraperwiki-api/matchers.rb', line 318

def negative_failure_message
  "expected #{@actual['short_name']} to not have #{@expected} rows"
end