From 0e9c24ab54157c973f1e85426d7273619a33a0e2 Mon Sep 17 00:00:00 2001 From: Aleksey Ivanov Date: Tue, 23 May 2017 12:21:31 +0300 Subject: [PATCH] Falling back to default 'search_url' and docs --- app/models/agents/peak_detector_agent.rb | 4 ++-- spec/models/agents/peak_detector_agent_spec.rb | 8 +------- 2 files changed, 3 insertions(+), 9 deletions(-) diff --git a/app/models/agents/peak_detector_agent.rb b/app/models/agents/peak_detector_agent.rb index 045d4843..327b6e40 100644 --- a/app/models/agents/peak_detector_agent.rb +++ b/app/models/agents/peak_detector_agent.rb @@ -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 diff --git a/spec/models/agents/peak_detector_agent_spec.rb b/spec/models/agents/peak_detector_agent_spec.rb index 7acfaf6c..ec000dd1 100644 --- a/spec/models/agents/peak_detector_agent_spec.rb +++ b/spec/models/agents/peak_detector_agent_spec.rb @@ -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