Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
G
gitlab-ce
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Léo-Paul Géneau
gitlab-ce
Commits
7339464e
Commit
7339464e
authored
Apr 28, 2014
by
Jacob Vosmaer
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fail faster on an invalid target_type
parent
e5cf5f4f
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
7 additions
and
0 deletions
+7
-0
app/finders/notes_finder.rb
app/finders/notes_finder.rb
+2
-0
spec/finders/notes_finder_spec.rb
spec/finders/notes_finder_spec.rb
+5
-0
No files found.
app/finders/notes_finder.rb
View file @
7339464e
...
@@ -12,6 +12,8 @@ class NotesFinder
...
@@ -12,6 +12,8 @@ class NotesFinder
project
.
merge_requests
.
find
(
target_id
).
mr_and_commit_notes
.
inc_author
.
fresh
project
.
merge_requests
.
find
(
target_id
).
mr_and_commit_notes
.
inc_author
.
fresh
when
"snippet"
when
"snippet"
project
.
snippets
.
find
(
target_id
).
notes
.
fresh
project
.
snippets
.
find
(
target_id
).
notes
.
fresh
else
raise
'invalid target_type'
end
end
end
end
end
end
spec/finders/notes_finder_spec.rb
View file @
7339464e
...
@@ -22,5 +22,10 @@ describe NotesFinder do
...
@@ -22,5 +22,10 @@ describe NotesFinder do
notes
=
NotesFinder
.
new
.
execute
(
project
,
user
,
params
)
notes
=
NotesFinder
.
new
.
execute
(
project
,
user
,
params
)
notes
.
size
.
should
eq
(
2
)
notes
.
size
.
should
eq
(
2
)
end
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
end
end
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment