提交 7339464e 编写于 作者: J Jacob Vosmaer

Fail faster on an invalid target_type

上级 e5cf5f4f
......@@ -12,6 +12,8 @@ class NotesFinder
project.merge_requests.find(target_id).mr_and_commit_notes.inc_author.fresh
when "snippet"
project.snippets.find(target_id).notes.fresh
else
raise 'invalid target_type'
end
end
end
......@@ -22,5 +22,10 @@ describe NotesFinder do
notes = NotesFinder.new.execute(project, user, params)
notes.size.should eq(2)
end
it 'should raise an exception for an invalid target_type' do
params = { target_id: commit.id, target_type: 'invalid' }
expect { NotesFinder.new.execute(project, user, params) }.to raise_error('invalid target_type')
end
end
end
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册