From 51e63a795e04b1fddc666e6b0a71ddd76196618a Mon Sep 17 00:00:00 2001 From: Robert Speicher Date: Fri, 30 Nov 2018 13:47:08 -0600 Subject: [PATCH] Add additional scope check to Todo#for_target spec This works around a condition where the Issue and the MergeRequest created by FactoryBoth both had the same ID, which caused `for_target` to return two records when we only expected one. --- spec/models/todo_spec.rb | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/spec/models/todo_spec.rb b/spec/models/todo_spec.rb index 82ff2a002e0..3682e21ca40 100644 --- a/spec/models/todo_spec.rb +++ b/spec/models/todo_spec.rb @@ -236,7 +236,8 @@ describe Todo do create(:todo, target: create(:merge_request)) - expect(described_class.for_target(todo.target)).to eq([todo]) + expect(described_class.for_type(Issue.name).for_target(todo.target)) + .to contain_exactly(todo) end end