提交 bbfa4a77 编写于 作者: J Jacob Vosmaer

Always set last_fetched_at in NotesFinder spec

上级 0b615eb0
......@@ -12,25 +12,25 @@ describe NotesFinder do
end
describe :execute do
let(:params) { { target_id: commit.id, target_type: 'commit', last_fetched_at: 1.hour.ago } }
before do
note1
note2
end
it 'should find all notes' do
params = { target_id: commit.id, target_type: 'commit' }
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' }
params.merge!(target_type: 'invalid')
expect { NotesFinder.new.execute(project, user, params) }.to raise_error('invalid target_type')
end
it 'filters out old notes' do
note2.update_attribute(:updated_at, 2.hours.ago)
params = { target_id: commit.id, target_type: 'commit', last_fetched_at: 1.hour.ago }
notes = NotesFinder.new.execute(project, user, params)
notes.should eq([note1])
end
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册