Falling back to default 'search_url' and docs

This commit is contained in:
Aleksey Ivanov 2017-05-23 12:21:31 +03:00
parent a4b7f1b1f5
commit 0e9c24ab54
2 changed files with 3 additions and 9 deletions

View file

@ -15,7 +15,7 @@ module Agents
You may set `min_events` for the minimal number of accumulated events before the agent starts detecting.
You may set `search_url` to point to something else than Twitter search.
You may set `search_url` to point to something else than Twitter search. Default value is `https://twitter.com/search?q=%{q}` where `%{q}` will be replaced with group name.
MD
event_description <<-MD
@ -30,7 +30,7 @@ module Agents
MD
def validate_options
unless options['expected_receive_period_in_days'].present? && options['message'].present? && options['value_path'].present? && options['min_events'].present? && options['search_url'].present?
unless options['expected_receive_period_in_days'].present? && options['message'].present? && options['value_path'].present? && options['min_events'].present?
errors.add(:base, "expected_receive_period_in_days, value_path, min_events and message are required")
end
end

View file

@ -9,8 +9,7 @@ describe Agents::PeakDetectorAgent do
'group_by_path' => "filter",
'value_path' => "count",
'message' => "A peak was found",
'min_events' => "4",
'search_url' => "https://twitter.com/search?q=%{q}"
'min_events' => "4"
}
}
@ -91,11 +90,6 @@ describe Agents::PeakDetectorAgent do
expect(@agent).not_to be_valid
end
it "should validate presence of search_url" do
@agent.options['search_url'] = nil
expect(@agent).not_to be_valid
end
it "should validate presence of expected_receive_period_in_days" do
@agent.options['expected_receive_period_in_days'] = ""
expect(@agent).not_to be_valid