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
d8327562
Commit
d8327562
authored
Dec 30, 2015
by
Rubén Dávila
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add specs for Gitlab::Diff::Highlight. #3945
parent
7de90f4b
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
28 additions
and
0 deletions
+28
-0
spec/lib/gitlab/diff/highlight_spec.rb
spec/lib/gitlab/diff/highlight_spec.rb
+28
-0
No files found.
spec/lib/gitlab/diff/highlight_spec.rb
0 → 100644
View file @
d8327562
require
'spec_helper'
describe
Gitlab
::
Diff
::
Highlight
,
lib:
true
do
include
RepoHelpers
let
(
:project
)
{
create
(
:project
)
}
let
(
:commit
)
{
project
.
commit
(
sample_commit
.
id
)
}
let
(
:diff
)
{
commit
.
diffs
.
first
}
let
(
:diff_file
)
{
Gitlab
::
Diff
::
File
.
new
(
diff
)
}
describe
'.process_diff_lines'
do
let
(
:diff_lines
)
{
Gitlab
::
Diff
::
Highlight
.
process_diff_lines
(
diff_file
)
}
it
'should return Gitlab::Diff::Line elements'
do
expect
(
diff_lines
.
first
).
to
be_an_instance_of
(
Gitlab
::
Diff
::
Line
)
end
it
'should highlight the code'
do
code
=
%Q{<span id="LC3" class="line"> <span class="k">def</span> <span class="nf">popen</span><span class="p">(</span><span class="n">cmd</span><span class="p">,</span> <span class="n">path</span><span class="o">=</span><span class="kp">nil</span><span class="p">)</span></span>
\n
}
expect
(
diff_lines
[
2
].
text
).
to
eq
(
code
)
end
it
'should keep the inline diff markup'
do
expect
(
diff_lines
[
5
].
text
).
to
match
(
Regexp
.
new
(
Regexp
.
escape
(
'<span class="idiff">RuntimeError, </span>'
)))
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