|
@@ -40,6 +40,19 @@ describe Agents::DeDuplicationAgent do
|
|
|
end
|
|
|
end
|
|
|
|
|
|
+ describe '#initialize_memory' do
|
|
|
+ it 'sets properties to an empty array' do
|
|
|
+ expect(@checker.memory['properties']).to eq([])
|
|
|
+ end
|
|
|
+
|
|
|
+ it 'does not override an existing value' do
|
|
|
+ @checker.memory['properties'] = [1,2,3]
|
|
|
+ @checker.save
|
|
|
+ @checker.reload
|
|
|
+ expect(@checker.memory['properties']).to eq([1,2,3])
|
|
|
+ end
|
|
|
+ end
|
|
|
+
|
|
|
describe "#working?" do
|
|
|
before :each do
|
|
|
# Need to create an event otherwise event_created_within? returns nil
|
|
@@ -123,5 +136,14 @@ describe Agents::DeDuplicationAgent do
|
|
|
}.to change(Event, :count).by(1)
|
|
|
expect(@checker.memory['properties'].last).to eq('3023526198')
|
|
|
end
|
|
|
+
|
|
|
+ it "should still work after the memory was cleared" do
|
|
|
+ @checker.memory = {}
|
|
|
+ @checker.save
|
|
|
+ @checker.reload
|
|
|
+ expect {
|
|
|
+ @checker.receive([@event])
|
|
|
+ }.not_to raise_error
|
|
|
+ end
|
|
|
end
|
|
|
end
|