From 4ba882953419f1dda6d309338e23e026f3774595 Mon Sep 17 00:00:00 2001 From: Akinori MUSHA Date: Tue, 27 Jun 2023 20:57:35 +0900 Subject: [PATCH] Auto-format the code --- spec/models/agents/trigger_agent_spec.rb | 53 ++++++++++++------------ 1 file changed, 26 insertions(+), 27 deletions(-) diff --git a/spec/models/agents/trigger_agent_spec.rb b/spec/models/agents/trigger_agent_spec.rb index e6cd6037d2..ca164f696f 100644 --- a/spec/models/agents/trigger_agent_spec.rb +++ b/spec/models/agents/trigger_agent_spec.rb @@ -7,10 +7,10 @@ 'options' => { 'expected_receive_period_in_days' => 2, 'rules' => [{ - 'type' => "regex", - 'value' => "a\\db", - 'path' => "foo.bar.baz", - }], + 'type' => "regex", + 'value' => "a\\db", + 'path' => "foo.bar.baz", + }], 'message' => "I saw '{{foo.bar.baz}}' from {{name}}" } } @@ -21,7 +21,7 @@ @event = Event.new @event.agent = agents(:bob_rain_notifier_agent) - @event.payload = { 'foo' => { "bar" => { 'baz' => "a2b" }}, + @event.payload = { 'foo' => { "bar" => { 'baz' => "a2b" } }, 'name' => "Joe" } end @@ -119,7 +119,7 @@ @event.payload['foo']['bar']['baz'] = "a222b" expect { @checker.receive([@event]) - }.not_to change { Event.count } + }.not_to(change { Event.count }) @event.payload['foo']['bar']['baz'] = "a2b" expect { @@ -136,7 +136,7 @@ } expect { @checker.receive([@event]) - }.not_to change { Event.count } + }.not_to(change { Event.count }) @event.payload['foo']['bar']['baz'] = "a2b" expect { @@ -159,7 +159,7 @@ expect { @checker.receive([@event]) - }.not_to change { Event.count } + }.not_to(change { Event.count }) @event.payload['foo']['bar']['baz'] = "a22b" expect { @@ -177,7 +177,7 @@ expect { @checker.receive([@event]) - }.not_to change { Event.count } + }.not_to(change { Event.count }) @event.payload['foo']['bar']['baz'] = "a3b" expect { @@ -202,7 +202,7 @@ @checker.options['rules'].first['value'] = 3 expect { @checker.receive([@event]) - }.not_to change { Event.count } + }.not_to(change { Event.count }) end it "handles array of numerical comparisons" do @@ -217,7 +217,7 @@ @checker.options['rules'].first['value'] = [4, 3] expect { @checker.receive([@event]) - }.not_to change { Event.count } + }.not_to(change { Event.count }) end it "handles exact comparisons" do @@ -227,7 +227,7 @@ @checker.options['rules'].first['value'] = "hello there" expect { @checker.receive([@event]) - }.not_to change { Event.count } + }.not_to(change { Event.count }) @checker.options['rules'].first['value'] = "hello world" expect { @@ -242,7 +242,7 @@ @checker.options['rules'].first['value'] = ["hello there", "hello universe"] expect { @checker.receive([@event]) - }.not_to change { Event.count } + }.not_to(change { Event.count }) @checker.options['rules'].first['value'] = ["hello world", "hello universe"] expect { @@ -257,7 +257,7 @@ expect { @checker.receive([@event]) - }.not_to change { Event.count } + }.not_to(change { Event.count }) @checker.options['rules'].first['value'] = "hello there" @@ -273,7 +273,7 @@ expect { @checker.receive([@event]) - }.not_to change { Event.count } + }.not_to(change { Event.count }) @checker.options['rules'].first['value'] = ["hello there", "hello world"] @@ -289,13 +289,13 @@ expect { @checker.receive([@event]) - }.not_to change { Event.count } + }.not_to(change { Event.count }) @checker.options['rules'].first['value'] = ["hello there", "hello world"] expect { @checker.receive([@event]) - }.not_to change { Event.count } + }.not_to(change { Event.count }) @checker.options['rules'].first['value'] = ["hello there", "hello here"] @@ -316,22 +316,22 @@ @checker.options['rules'].first['path'] = "foo" expect { @checker.receive([@event]) - }.not_to change { Event.count } + }.not_to(change { Event.count }) @checker.options['rules'].first['value'] = "hi" expect { @checker.receive([@event]) - }.not_to change { Event.count } + }.not_to(change { Event.count }) end it "handles multiple events" do event2 = Event.new event2.agent = agents(:bob_weather_agent) - event2.payload = { 'foo' => { 'bar' => { 'baz' => "a2b" }}} + event2.payload = { 'foo' => { 'bar' => { 'baz' => "a2b" } } } event3 = Event.new event3.agent = agents(:bob_weather_agent) - event3.payload = { 'foo' => { 'bar' => { 'baz' => "a222b" }}} + event3.payload = { 'foo' => { 'bar' => { 'baz' => "a222b" } } } expect { @checker.receive([@event, event2, event3]) @@ -380,7 +380,7 @@ expect { @checker.receive([@event]) - }.not_to change { Event.count } + }.not_to(change { Event.count }) end it "can accept a partial rule set match when 'must_match' is present and less than the total number of rules" do @@ -396,8 +396,7 @@ expect { @checker.receive([@event]) - }.to change { Event.count } # but the first one matches - + }.to(change { Event.count }) # but the first one matches @checker.options['must_match'] = "2" @@ -411,7 +410,7 @@ expect { @checker.receive([@event]) - }.not_to change { Event.count } # only 1 matches, we needed 2 + }.not_to(change { Event.count }) # only 1 matches, we needed 2 end end @@ -429,7 +428,7 @@ expect { @checker.receive([@event]) - }.not_to change { Event.count } + }.not_to(change { Event.count }) @checker.options['rules'].first['value'] = 6 expect { @@ -444,7 +443,7 @@ @checker.receive([@event]) - expect(@checker.most_recent_event.payload).to eq(@event.payload.merge(:message => "I saw '5' from Joe")) + expect(@checker.most_recent_event.payload).to eq(@event.payload.merge(message: "I saw '5' from Joe")) end end end