Class: ScraperWiki::API::Matchers::RunIntervalMatcher

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

Instance Method Summary collapse

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



147
148
149
150
151
152
153
# File 'lib/scraperwiki-api/matchers.rb', line 147

def failure_message
  if @expected == -1
    "expected #{@actual['short_name']} to never run"
  else
    "expected #{@actual['short_name']} to run #{@expected}"
  end
end

#matches?(actual) ⇒ Boolean

Returns:

  • (Boolean)


142
143
144
145
# File 'lib/scraperwiki-api/matchers.rb', line 142

def matches?(actual)
  super
  actual['run_interval'] == ScraperWiki::API::RUN_INTERVALS[@expected]
end

#negative_failure_messageObject



155
156
157
158
159
160
161
# File 'lib/scraperwiki-api/matchers.rb', line 155

def negative_failure_message
  if @expected == -1
    "expected #{@actual['short_name']} to run at some time"
  else
    "expected #{@actual['short_name']} to not run #{@expected}"
  end
end