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
65230022
Commit
65230022
authored
May 25, 2016
by
ZJ van de Weg
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Remove old tests, and use right factories
parent
9777a3d3
Changes
3
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
9 additions
and
69 deletions
+9
-69
features/steps/project/issues/issues.rb
features/steps/project/issues/issues.rb
+5
-5
features/steps/project/merge_requests.rb
features/steps/project/merge_requests.rb
+4
-4
spec/models/note_spec.rb
spec/models/note_spec.rb
+0
-60
No files found.
features/steps/project/issues/issues.rb
View file @
65230022
...
...
@@ -192,14 +192,14 @@ class Spinach::Features::ProjectIssues < Spinach::FeatureSteps
step
'issue "Release 0.4" have 2 upvotes and 1 downvote'
do
awardable
=
Issue
.
find_by
(
title:
'Release 0.4'
)
create_list
(
:
upvote
,
2
,
project:
project
,
awardable:
awardable
)
create
(
:
downvote
,
project:
project
,
awardable:
awardable
)
create_list
(
:
award_emoji
,
2
,
awardable:
awardable
)
create
(
:
award_emoji
,
:downvote
,
awardable:
awardable
)
end
step
'issue "Tweet control" have 1 upvote and 2 downvotes'
do
issu
e
=
Issue
.
find_by
(
title:
'Tweet control'
)
create
(
:
upvote
,
project:
project
,
noteable:
issu
e
)
create_list
(
:
downvote
,
2
,
project:
project
,
noteable:
issue
)
awardabl
e
=
Issue
.
find_by
(
title:
'Tweet control'
)
create
(
:
award_emoji
,
:upvote
,
awardable:
awardabl
e
)
create_list
(
:
award_emoji
,
2
,
awardable:
awardable
,
name:
'thumbsdown'
)
end
step
'The list should be sorted by "Least popular"'
do
...
...
features/steps/project/merge_requests.rb
View file @
65230022
...
...
@@ -179,14 +179,14 @@ class Spinach::Features::ProjectMergeRequests < Spinach::FeatureSteps
step
'merge request "Bug NS-04" have 2 upvotes and 1 downvote'
do
merge_request
=
MergeRequest
.
find_by
(
title:
'Bug NS-04'
)
create_list
(
:
upvote
,
2
,
project:
project
,
awardable:
merge_request
)
create
(
:
downvote
,
project:
project
,
awardable:
merge_request
)
create_list
(
:
award_emoji
,
2
,
awardable:
merge_request
)
create
(
:
award_emoji
,
:downvote
,
awardable:
merge_request
)
end
step
'merge request "Bug NS-06" have 1 upvote and 2 downvotes'
do
awardable
=
MergeRequest
.
find_by
(
title:
'Bug NS-06'
)
create
(
:
upvote
,
project:
project
,
awardable:
awardable
)
create_list
(
:
downvote
,
2
,
project:
project
,
awardable:
awardable
)
create
(
:
award_emoji
,
awardable:
awardable
)
create_list
(
:
award_emoji
,
2
,
awardable:
awardable
,
name:
"thumbsdown"
)
end
step
'The list should be sorted by "Least popular"'
do
...
...
spec/models/note_spec.rb
View file @
65230022
...
...
@@ -113,66 +113,6 @@ describe Note, models: true do
end
end
describe
'#active?'
do
it
'is always true when the note has no associated diff'
do
note
=
build
(
:note
)
expect
(
note
).
to
receive
(
:diff
).
and_return
(
nil
)
expect
(
note
).
to
be_active
end
it
'is never true when the note has no noteable associated'
do
note
=
build
(
:note
)
expect
(
note
).
to
receive
(
:diff
).
and_return
(
double
)
expect
(
note
).
to
receive
(
:noteable
).
and_return
(
nil
)
expect
(
note
).
not_to
be_active
end
it
'returns the memoized value if defined'
do
note
=
build
(
:note
)
expect
(
note
).
to
receive
(
:diff
).
and_return
(
double
)
expect
(
note
).
to
receive
(
:noteable
).
and_return
(
double
)
note
.
instance_variable_set
(
:@active
,
'foo'
)
expect
(
note
).
not_to
receive
(
:find_noteable_diff
)
expect
(
note
.
active?
).
to
eq
'foo'
end
context
'for a merge request noteable'
do
it
'is false when noteable has no matching diff'
do
merge
=
build_stubbed
(
:merge_request
,
:simple
)
note
=
build
(
:note
,
noteable:
merge
)
allow
(
note
).
to
receive
(
:diff
).
and_return
(
double
)
expect
(
note
).
to
receive
(
:find_noteable_diff
).
and_return
(
nil
)
expect
(
note
).
not_to
be_active
end
it
'is true when noteable has a matching diff'
do
merge
=
create
(
:merge_request
,
:simple
)
# Generate a real line_code value so we know it will match. We use a
# random line from a random diff just for funsies.
diff
=
merge
.
diffs
.
to_a
.
sample
line
=
Gitlab
::
Diff
::
Parser
.
new
.
parse
(
diff
.
diff
.
each_line
).
to_a
.
sample
code
=
Gitlab
::
Diff
::
LineCode
.
generate
(
diff
.
new_path
,
line
.
new_pos
,
line
.
old_pos
)
# We're persisting in order to trigger the set_diff callback
note
=
create
(
:note
,
noteable:
merge
,
line_code:
code
)
# Make sure we don't get a false positive from a guard clause
expect
(
note
).
to
receive
(
:find_noteable_diff
).
and_call_original
expect
(
note
).
to
be_active
end
end
end
describe
"editable?"
do
it
"returns true"
do
note
=
build
(
:note
)
...
...
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