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
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Kirill Smelkov
gitlab-ce
Commits
e5d89c10
Commit
e5d89c10
authored
Sep 02, 2015
by
Robert Speicher
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Remove unnecessary current_user context from filter specs
parent
21cacb36
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
11 additions
and
24 deletions
+11
-24
spec/lib/gitlab/markdown/cross_project_reference_spec.rb
spec/lib/gitlab/markdown/cross_project_reference_spec.rb
+8
-16
spec/lib/gitlab/markdown/user_reference_filter_spec.rb
spec/lib/gitlab/markdown/user_reference_filter_spec.rb
+3
-8
No files found.
spec/lib/gitlab/markdown/cross_project_reference_spec.rb
View file @
e5d89c10
...
...
@@ -2,20 +2,16 @@ require 'spec_helper'
module
Gitlab::Markdown
describe
CrossProjectReference
do
# context in the html-pipeline sense, not in the rspec sense
let
(
:context
)
do
{
current_user:
double
(
'user'
),
project:
double
(
'project'
)
}
end
include
described_class
describe
'#project_from_ref'
do
context
'when no project was referenced'
do
it
'returns the project from context'
do
expect
(
project_from_ref
(
nil
)).
to
eq
context
[
:project
]
project
=
double
allow
(
self
).
to
receive
(
:context
).
and_return
({
project:
project
})
expect
(
project_from_ref
(
nil
)).
to
eq
project
end
end
...
...
@@ -26,19 +22,15 @@ module Gitlab::Markdown
end
context
'when referenced project exists'
do
let
(
:project2
)
{
double
(
'referenced project'
)
}
it
'returns the referenced project'
do
project2
=
double
(
'referenced project'
)
before
do
expect
(
Project
).
to
receive
(
:find_with_namespace
).
with
(
'cross/reference'
).
and_return
(
project2
)
end
context
'and the user has permission to read it'
do
it
'returns the referenced project'
do
expect
(
project_from_ref
(
'cross/reference'
)).
to
eq
project2
end
end
end
end
end
end
spec/lib/gitlab/markdown/user_reference_filter_spec.rb
View file @
e5d89c10
...
...
@@ -80,20 +80,15 @@ module Gitlab::Markdown
context
'mentioning a group'
do
let
(
:group
)
{
create
(
:group
)
}
let
(
:user
)
{
create
(
:user
)
}
let
(
:reference
)
{
group
.
to_reference
}
before
do
group
.
add_developer
(
user
)
end
it
'links to the Group'
do
doc
=
filter
(
"Hey
#{
reference
}
"
,
current_user:
user
)
doc
=
filter
(
"Hey
#{
reference
}
"
)
expect
(
doc
.
css
(
'a'
).
first
.
attr
(
'href'
)).
to
eq
urls
.
group_url
(
group
)
end
it
'includes a data-group-id attribute'
do
doc
=
filter
(
"Hey
#{
reference
}
"
,
current_user:
user
)
doc
=
filter
(
"Hey
#{
reference
}
"
)
link
=
doc
.
css
(
'a'
).
first
expect
(
link
).
to
have_attribute
(
'data-group-id'
)
...
...
@@ -101,7 +96,7 @@ module Gitlab::Markdown
end
it
'adds to the results hash'
do
result
=
pipeline_result
(
"Hey
#{
reference
}
"
,
current_user:
user
)
result
=
pipeline_result
(
"Hey
#{
reference
}
"
)
expect
(
result
[
:references
][
:user
]).
to
eq
group
.
users
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