summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRubén Dávila <rdavila84@gmail.com>2016-01-12 17:49:11 -0500
committerRubén Dávila <rdavila84@gmail.com>2016-01-12 17:49:11 -0500
commitf547e733d1f8acf2c8ae82835b91ae166cf95b16 (patch)
treea9f5c000275823f686b7009fe0c3659512587de5
parent6e3358a5077f5c6052e733722cd6baa63e43c081 (diff)
downloadgitlab-ce-f547e733d1f8acf2c8ae82835b91ae166cf95b16.tar.gz
Add more specs. #3945
-rw-r--r--spec/lib/gitlab/diff/highlight_spec.rb18
1 files changed, 18 insertions, 0 deletions
diff --git a/spec/lib/gitlab/diff/highlight_spec.rb b/spec/lib/gitlab/diff/highlight_spec.rb
index 4ab509f47b9..cdeed603e23 100644
--- a/spec/lib/gitlab/diff/highlight_spec.rb
+++ b/spec/lib/gitlab/diff/highlight_spec.rb
@@ -30,6 +30,24 @@ describe Gitlab::Diff::Highlight, lib: true do
expect(diff_lines[0].text).to eq('@@ -6,12 +6,18 @@ module Popen')
expect(diff_lines[22].text).to eq('@@ -19,6 +25,7 @@ module Popen')
end
+
+ it 'should highlight unchanged lines' do
+ code = %Q{ <span id="LC7" 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 highlight added lines' do
+ code = %Q{+<span id="LC9" class="line"> <span class="k">raise</span> <span class="no">RuntimeError</span><span class="p">,</span> <span class="s2">&quot;System commands must be given as an array of strings&quot;</span></span>\n}
+
+ expect(diff_lines[5].text).to eq(code)
+ end
+
+ it 'should highlight removed lines' do
+ code = %Q{-<span id="LC9" class="line"> <span class="k">raise</span> <span class="s2">&quot;System commands must be given as an array of strings&quot;</span></span>\n}
+
+ expect(diff_lines[4].text).to eq(code)
+ end
end
end