Commit bbfa4a771ab8ca4745419b8d660af89249e088f4
1 parent
0b615eb0
Exists in
spb-stable
and in
2 other branches
Always set last_fetched_at in NotesFinder spec
Showing
1 changed file
with
3 additions
and
3 deletions
Show diff stats
spec/finders/notes_finder_spec.rb
@@ -12,25 +12,25 @@ describe NotesFinder do | @@ -12,25 +12,25 @@ describe NotesFinder do | ||
12 | end | 12 | end |
13 | 13 | ||
14 | describe :execute do | 14 | describe :execute do |
15 | + let(:params) { { target_id: commit.id, target_type: 'commit', last_fetched_at: 1.hour.ago } } | ||
16 | + | ||
15 | before do | 17 | before do |
16 | note1 | 18 | note1 |
17 | note2 | 19 | note2 |
18 | end | 20 | end |
19 | 21 | ||
20 | it 'should find all notes' do | 22 | it 'should find all notes' do |
21 | - params = { target_id: commit.id, target_type: 'commit' } | ||
22 | notes = NotesFinder.new.execute(project, user, params) | 23 | notes = NotesFinder.new.execute(project, user, params) |
23 | notes.size.should eq(2) | 24 | notes.size.should eq(2) |
24 | end | 25 | end |
25 | 26 | ||
26 | it 'should raise an exception for an invalid target_type' do | 27 | it 'should raise an exception for an invalid target_type' do |
27 | - params = { target_id: commit.id, target_type: 'invalid' } | 28 | + params.merge!(target_type: 'invalid') |
28 | expect { NotesFinder.new.execute(project, user, params) }.to raise_error('invalid target_type') | 29 | expect { NotesFinder.new.execute(project, user, params) }.to raise_error('invalid target_type') |
29 | end | 30 | end |
30 | 31 | ||
31 | it 'filters out old notes' do | 32 | it 'filters out old notes' do |
32 | note2.update_attribute(:updated_at, 2.hours.ago) | 33 | note2.update_attribute(:updated_at, 2.hours.ago) |
33 | - params = { target_id: commit.id, target_type: 'commit', last_fetched_at: 1.hour.ago } | ||
34 | notes = NotesFinder.new.execute(project, user, params) | 34 | notes = NotesFinder.new.execute(project, user, params) |
35 | notes.should eq([note1]) | 35 | notes.should eq([note1]) |
36 | end | 36 | end |