Commit 410790a355a6389bfa372e0834c31541b8ac8e4f
1 parent
27f31a7e
Exists in
spb-stable
and in
2 other branches
Add NotesFinder spec
Showing
1 changed file
with
26 additions
and
0 deletions
Show diff stats
| @@ -0,0 +1,26 @@ | @@ -0,0 +1,26 @@ | ||
| 1 | +require 'spec_helper' | ||
| 2 | + | ||
| 3 | +describe NotesFinder do | ||
| 4 | + let(:user) { create :user } | ||
| 5 | + let(:project) { create :project } | ||
| 6 | + let(:note1) { create :note_on_commit, project: project } | ||
| 7 | + let(:note2) { create :note_on_commit, project: project } | ||
| 8 | + let(:commit) { note1.commit } | ||
| 9 | + | ||
| 10 | + before do | ||
| 11 | + project.team << [user, :master] | ||
| 12 | + end | ||
| 13 | + | ||
| 14 | + describe :execute do | ||
| 15 | + before do | ||
| 16 | + note1 | ||
| 17 | + note2 | ||
| 18 | + end | ||
| 19 | + | ||
| 20 | + 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.size.should eq(2) | ||
| 24 | + end | ||
| 25 | + end | ||
| 26 | +end |