Commit 164c6374 authored by Rubén Dávila's avatar Rubén Dávila

Fix broken specs. #3945

parent 78d7c0e0
--- ---
- - match - - match
- 6 - 6
- '@@ -6,12 +6,18 @@ module Popen' - "@@ -6,12 +6,18 @@ module Popen"
- 2f6fcd96b88b36ce98c38da085c795a27d92a3dd_6_6 - 2f6fcd96b88b36ce98c38da085c795a27d92a3dd_6_6
- match - match
- 6 - 6
- '@@ -6,12 +6,18 @@ module Popen' - "@@ -6,12 +6,18 @@ module Popen"
- 2f6fcd96b88b36ce98c38da085c795a27d92a3dd_6_6 - 2f6fcd96b88b36ce98c38da085c795a27d92a3dd_6_6
- - - -
- 6 - 6
- | - |2
<span id="LC2" class="line"> </span> <span id="LC6" class="line"></span>
- 2f6fcd96b88b36ce98c38da085c795a27d92a3dd_6_6 - 2f6fcd96b88b36ce98c38da085c795a27d92a3dd_6_6
- -
- 6 - 6
- | - |2
<span id="LC2" class="line"> </span> <span id="LC6" class="line"></span>
- 2f6fcd96b88b36ce98c38da085c795a27d92a3dd_6_6 - 2f6fcd96b88b36ce98c38da085c795a27d92a3dd_6_6
- - - -
- 7 - 7
- | - |2
<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> <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>
- 2f6fcd96b88b36ce98c38da085c795a27d92a3dd_7_7 - 2f6fcd96b88b36ce98c38da085c795a27d92a3dd_7_7
- -
- 7 - 7
- | - |2
<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> <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>
- 2f6fcd96b88b36ce98c38da085c795a27d92a3dd_7_7 - 2f6fcd96b88b36ce98c38da085c795a27d92a3dd_7_7
- - - -
- 8 - 8
- | - |2
<span id="LC4" class="line"> <span class="k">unless</span> <span class="n">cmd</span><span class="p">.</span><span class="nf">is_a?</span><span class="p">(</span><span class="no">Array</span><span class="p">)</span></span> <span id="LC8" class="line"> <span class="k">unless</span> <span class="n">cmd</span><span class="p">.</span><span class="nf">is_a?</span><span class="p">(</span><span class="no">Array</span><span class="p">)</span></span>
- 2f6fcd96b88b36ce98c38da085c795a27d92a3dd_8_8 - 2f6fcd96b88b36ce98c38da085c795a27d92a3dd_8_8
- -
- 8 - 8
- | - |2
<span id="LC4" class="line"> <span class="k">unless</span> <span class="n">cmd</span><span class="p">.</span><span class="nf">is_a?</span><span class="p">(</span><span class="no">Array</span><span class="p">)</span></span> <span id="LC8" class="line"> <span class="k">unless</span> <span class="n">cmd</span><span class="p">.</span><span class="nf">is_a?</span><span class="p">(</span><span class="no">Array</span><span class="p">)</span></span>
- 2f6fcd96b88b36ce98c38da085c795a27d92a3dd_8_8 - 2f6fcd96b88b36ce98c38da085c795a27d92a3dd_8_8
- - old - - old
- 9 - 9
- | - |
- <span id="LC5" class="line"><span class="k">raise</span> <span class="s2">&quot;System commands must be given as an array of strings&quot;</span></span> -<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>
- 2f6fcd96b88b36ce98c38da085c795a27d92a3dd_9_9 - 2f6fcd96b88b36ce98c38da085c795a27d92a3dd_9_9
- new - new
- 9 - 9
- | - |
+ <span id="LC6" class="line"><span class="k">raise</span> <span class="idiff">RuntimeError, </span><span class="s2">&quot;System commands must be given as an array of strings&quot;</span></span> +<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>
- 2f6fcd96b88b36ce98c38da085c795a27d92a3dd_10_9 - 2f6fcd96b88b36ce98c38da085c795a27d92a3dd_10_9
- - - -
- 10 - 10
- | - |2
<span id="LC7" class="line"> <span class="k">end</span></span> <span id="LC10" class="line"> <span class="k">end</span></span>
- 2f6fcd96b88b36ce98c38da085c795a27d92a3dd_10_10 - 2f6fcd96b88b36ce98c38da085c795a27d92a3dd_10_10
- -
- 10 - 10
- | - |2
<span id="LC7" class="line"> <span class="k">end</span></span> <span id="LC10" class="line"> <span class="k">end</span></span>
- 2f6fcd96b88b36ce98c38da085c795a27d92a3dd_10_10 - 2f6fcd96b88b36ce98c38da085c795a27d92a3dd_10_10
- - - -
- 11 - 11
- | - |2
<span id="LC8" class="line"> </span> <span id="LC11" class="line"></span>
- 2f6fcd96b88b36ce98c38da085c795a27d92a3dd_11_11 - 2f6fcd96b88b36ce98c38da085c795a27d92a3dd_11_11
- -
- 11 - 11
- | - |2
<span id="LC8" class="line"> </span> <span id="LC11" class="line"></span>
- 2f6fcd96b88b36ce98c38da085c795a27d92a3dd_11_11 - 2f6fcd96b88b36ce98c38da085c795a27d92a3dd_11_11
- - - -
- 12 - 12
- | - |2
<span id="LC9" class="line"> <span class="n">path</span> <span class="o">||=</span> <span class="no">Dir</span><span class="p">.</span><span class="nf">pwd</span></span> <span id="LC12" class="line"> <span class="n">path</span> <span class="o">||=</span> <span class="no">Dir</span><span class="p">.</span><span class="nf">pwd</span></span>
- 2f6fcd96b88b36ce98c38da085c795a27d92a3dd_12_12 - 2f6fcd96b88b36ce98c38da085c795a27d92a3dd_12_12
- -
- 12 - 12
- | - |2
<span id="LC9" class="line"> <span class="n">path</span> <span class="o">||=</span> <span class="no">Dir</span><span class="p">.</span><span class="nf">pwd</span></span> <span id="LC12" class="line"> <span class="n">path</span> <span class="o">||=</span> <span class="no">Dir</span><span class="p">.</span><span class="nf">pwd</span></span>
- 2f6fcd96b88b36ce98c38da085c795a27d92a3dd_12_12 - 2f6fcd96b88b36ce98c38da085c795a27d92a3dd_12_12
- - old - - old
- 13 - 13
- | - |
- <span id="LC10" class="line"><span class="n">vars</span> <span class="o">=</span> <span class="p">{</span> <span class="s2">&quot;PWD&quot;</span> <span class="o">=&gt;</span> <span class="n">path</span> <span class="p">}</span></span> -<span id="LC13" class="line"> <span class="n">vars</span> <span class="o">=</span> <span class="p">{</span> <span class="s2">&quot;PWD&quot;</span> <span class="o">=&gt;</span> <span class="n">path</span> <span class="p">}</span></span>
- 2f6fcd96b88b36ce98c38da085c795a27d92a3dd_13_13 - 2f6fcd96b88b36ce98c38da085c795a27d92a3dd_13_13
- old - old
- -
...@@ -89,12 +89,12 @@ ...@@ -89,12 +89,12 @@
- - old - - old
- 14 - 14
- | - |
- <span id="LC11" class="line"><span class="n">options</span> <span class="o">=</span> <span class="p">{</span> <span class="ss">chdir: </span><span class="n">path</span> <span class="p">}</span></span> -<span id="LC14" class="line"> <span class="n">options</span> <span class="o">=</span> <span class="p">{</span> <span class="ss">chdir: </span><span class="n">path</span> <span class="p">}</span></span>
- 2f6fcd96b88b36ce98c38da085c795a27d92a3dd_14_13 - 2f6fcd96b88b36ce98c38da085c795a27d92a3dd_14_13
- new - new
- 13 - 13
- | - |
+<span id="LC12" class="line"></span> +<span id="LC13" class="line"></span>
- 2f6fcd96b88b36ce98c38da085c795a27d92a3dd_15_13 - 2f6fcd96b88b36ce98c38da085c795a27d92a3dd_15_13
- - - -
- -
...@@ -103,7 +103,7 @@ ...@@ -103,7 +103,7 @@
- new - new
- 14 - 14
- | - |
+ <span id="LC13" class="line"><span class="n">vars</span> <span class="o">=</span> <span class="p">{</span></span> +<span id="LC14" class="line"> <span class="n">vars</span> <span class="o">=</span> <span class="p">{</span></span>
- 2f6fcd96b88b36ce98c38da085c795a27d92a3dd_15_14 - 2f6fcd96b88b36ce98c38da085c795a27d92a3dd_15_14
- - - -
- -
...@@ -112,7 +112,7 @@ ...@@ -112,7 +112,7 @@
- new - new
- 15 - 15
- | - |
+ <span id="LC14" class="line"><span class="s2">&quot;PWD&quot;</span> <span class="o">=&gt;</span> <span class="n">path</span></span> +<span id="LC15" class="line"> <span class="s2">&quot;PWD&quot;</span> <span class="o">=&gt;</span> <span class="n">path</span></span>
- 2f6fcd96b88b36ce98c38da085c795a27d92a3dd_15_15 - 2f6fcd96b88b36ce98c38da085c795a27d92a3dd_15_15
- - - -
- -
...@@ -121,7 +121,7 @@ ...@@ -121,7 +121,7 @@
- new - new
- 16 - 16
- | - |
+ <span id="LC15" class="line"><span class="p">}</span></span> +<span id="LC16" class="line"> <span class="p">}</span></span>
- 2f6fcd96b88b36ce98c38da085c795a27d92a3dd_15_16 - 2f6fcd96b88b36ce98c38da085c795a27d92a3dd_15_16
- - - -
- -
...@@ -130,7 +130,7 @@ ...@@ -130,7 +130,7 @@
- new - new
- 17 - 17
- | - |
+<span id="LC16" class="line"></span> +<span id="LC17" class="line"></span>
- 2f6fcd96b88b36ce98c38da085c795a27d92a3dd_15_17 - 2f6fcd96b88b36ce98c38da085c795a27d92a3dd_15_17
- - - -
- -
...@@ -139,7 +139,7 @@ ...@@ -139,7 +139,7 @@
- new - new
- 18 - 18
- | - |
+ <span id="LC17" class="line"><span class="n">options</span> <span class="o">=</span> <span class="p">{</span></span> +<span id="LC18" class="line"> <span class="n">options</span> <span class="o">=</span> <span class="p">{</span></span>
- 2f6fcd96b88b36ce98c38da085c795a27d92a3dd_15_18 - 2f6fcd96b88b36ce98c38da085c795a27d92a3dd_15_18
- - - -
- -
...@@ -148,7 +148,7 @@ ...@@ -148,7 +148,7 @@
- new - new
- 19 - 19
- | - |
+ <span id="LC18" class="line"><span class="ss">chdir: </span><span class="n">path</span></span> +<span id="LC19" class="line"> <span class="ss">chdir: </span><span class="n">path</span></span>
- 2f6fcd96b88b36ce98c38da085c795a27d92a3dd_15_19 - 2f6fcd96b88b36ce98c38da085c795a27d92a3dd_15_19
- - - -
- -
...@@ -157,75 +157,75 @@ ...@@ -157,75 +157,75 @@
- new - new
- 20 - 20
- | - |
+ <span id="LC19" class="line"><span class="p">}</span></span> +<span id="LC20" class="line"> <span class="p">}</span></span>
- 2f6fcd96b88b36ce98c38da085c795a27d92a3dd_15_20 - 2f6fcd96b88b36ce98c38da085c795a27d92a3dd_15_20
- - - -
- 15 - 15
- | - |2
<span id="LC20" class="line"> </span> <span id="LC21" class="line"></span>
- 2f6fcd96b88b36ce98c38da085c795a27d92a3dd_15_21 - 2f6fcd96b88b36ce98c38da085c795a27d92a3dd_15_21
- -
- 21 - 21
- | - |2
<span id="LC20" class="line"> </span> <span id="LC21" class="line"></span>
- 2f6fcd96b88b36ce98c38da085c795a27d92a3dd_15_21 - 2f6fcd96b88b36ce98c38da085c795a27d92a3dd_15_21
- - - -
- 16 - 16
- | - |2
<span id="LC21" class="line"> <span class="k">unless</span> <span class="no">File</span><span class="p">.</span><span class="nf">directory?</span><span class="p">(</span><span class="n">path</span><span class="p">)</span></span> <span id="LC22" class="line"> <span class="k">unless</span> <span class="no">File</span><span class="p">.</span><span class="nf">directory?</span><span class="p">(</span><span class="n">path</span><span class="p">)</span></span>
- 2f6fcd96b88b36ce98c38da085c795a27d92a3dd_16_22 - 2f6fcd96b88b36ce98c38da085c795a27d92a3dd_16_22
- -
- 22 - 22
- | - |2
<span id="LC21" class="line"> <span class="k">unless</span> <span class="no">File</span><span class="p">.</span><span class="nf">directory?</span><span class="p">(</span><span class="n">path</span><span class="p">)</span></span> <span id="LC22" class="line"> <span class="k">unless</span> <span class="no">File</span><span class="p">.</span><span class="nf">directory?</span><span class="p">(</span><span class="n">path</span><span class="p">)</span></span>
- 2f6fcd96b88b36ce98c38da085c795a27d92a3dd_16_22 - 2f6fcd96b88b36ce98c38da085c795a27d92a3dd_16_22
- - - -
- 17 - 17
- | - |2
<span id="LC22" class="line"> <span class="no">FileUtils</span><span class="p">.</span><span class="nf">mkdir_p</span><span class="p">(</span><span class="n">path</span><span class="p">)</span></span> <span id="LC23" class="line"> <span class="no">FileUtils</span><span class="p">.</span><span class="nf">mkdir_p</span><span class="p">(</span><span class="n">path</span><span class="p">)</span></span>
- 2f6fcd96b88b36ce98c38da085c795a27d92a3dd_17_23 - 2f6fcd96b88b36ce98c38da085c795a27d92a3dd_17_23
- -
- 23 - 23
- | - |2
<span id="LC22" class="line"> <span class="no">FileUtils</span><span class="p">.</span><span class="nf">mkdir_p</span><span class="p">(</span><span class="n">path</span><span class="p">)</span></span> <span id="LC23" class="line"> <span class="no">FileUtils</span><span class="p">.</span><span class="nf">mkdir_p</span><span class="p">(</span><span class="n">path</span><span class="p">)</span></span>
- 2f6fcd96b88b36ce98c38da085c795a27d92a3dd_17_23 - 2f6fcd96b88b36ce98c38da085c795a27d92a3dd_17_23
- - match - - match
- 19 - 19
- '@@ -19,6 +25,7 @@ module Popen' - "@@ -19,6 +25,7 @@ module Popen"
- 2f6fcd96b88b36ce98c38da085c795a27d92a3dd_19_25 - 2f6fcd96b88b36ce98c38da085c795a27d92a3dd_19_25
- match - match
- 25 - 25
- '@@ -19,6 +25,7 @@ module Popen' - "@@ -19,6 +25,7 @@ module Popen"
- 2f6fcd96b88b36ce98c38da085c795a27d92a3dd_19_25 - 2f6fcd96b88b36ce98c38da085c795a27d92a3dd_19_25
- - - -
- 19 - 19
- | - |2
<span id="LC24" class="line"> </span> <span id="LC25" class="line"></span>
- 2f6fcd96b88b36ce98c38da085c795a27d92a3dd_19_25 - 2f6fcd96b88b36ce98c38da085c795a27d92a3dd_19_25
- -
- 25 - 25
- | - |2
<span id="LC24" class="line"> </span> <span id="LC25" class="line"></span>
- 2f6fcd96b88b36ce98c38da085c795a27d92a3dd_19_25 - 2f6fcd96b88b36ce98c38da085c795a27d92a3dd_19_25
- - - -
- 20 - 20
- | - |2
<span id="LC25" class="line"> <span class="vi">@cmd_output</span> <span class="o">=</span> <span class="s2">&quot;&quot;</span></span> <span id="LC26" class="line"> <span class="vi">@cmd_output</span> <span class="o">=</span> <span class="s2">&quot;&quot;</span></span>
- 2f6fcd96b88b36ce98c38da085c795a27d92a3dd_20_26 - 2f6fcd96b88b36ce98c38da085c795a27d92a3dd_20_26
- -
- 26 - 26
- | - |2
<span id="LC25" class="line"> <span class="vi">@cmd_output</span> <span class="o">=</span> <span class="s2">&quot;&quot;</span></span> <span id="LC26" class="line"> <span class="vi">@cmd_output</span> <span class="o">=</span> <span class="s2">&quot;&quot;</span></span>
- 2f6fcd96b88b36ce98c38da085c795a27d92a3dd_20_26 - 2f6fcd96b88b36ce98c38da085c795a27d92a3dd_20_26
- - - -
- 21 - 21
- | - |2
<span id="LC26" class="line"> <span class="vi">@cmd_status</span> <span class="o">=</span> <span class="mi">0</span></span> <span id="LC27" class="line"> <span class="vi">@cmd_status</span> <span class="o">=</span> <span class="mi">0</span></span>
- 2f6fcd96b88b36ce98c38da085c795a27d92a3dd_21_27 - 2f6fcd96b88b36ce98c38da085c795a27d92a3dd_21_27
- -
- 27 - 27
- | - |2
<span id="LC26" class="line"> <span class="vi">@cmd_status</span> <span class="o">=</span> <span class="mi">0</span></span> <span id="LC27" class="line"> <span class="vi">@cmd_status</span> <span class="o">=</span> <span class="mi">0</span></span>
- 2f6fcd96b88b36ce98c38da085c795a27d92a3dd_21_27 - 2f6fcd96b88b36ce98c38da085c795a27d92a3dd_21_27
- - - -
- -
...@@ -234,37 +234,35 @@ ...@@ -234,37 +234,35 @@
- new - new
- 28 - 28
- | - |
+<span id="LC27" class="line"></span> +<span id="LC28" class="line"></span>
- 2f6fcd96b88b36ce98c38da085c795a27d92a3dd_22_28 - 2f6fcd96b88b36ce98c38da085c795a27d92a3dd_22_28
- - - -
- 22 - 22
- | - |2
<span id="LC28" class="line"> <span class="no">Open3</span><span class="p">.</span><span class="nf">popen3</span><span class="p">(</span><span class="n">vars</span><span class="p">,</span> <span class="o">*</span><span class="n">cmd</span><span class="p">,</span> <span class="n">options</span><span class="p">)</span> <span class="k">do</span> <span class="o">|</span><span class="n">stdin</span><span class="p">,</span> <span class="n">stdout</span><span class="p">,</span> <span class="n">stderr</span><span class="p">,</span> <span class="n">wait_thr</span><span class="o">|</span></span> <span id="LC29" class="line"> <span class="no">Open3</span><span class="p">.</span><span class="nf">popen3</span><span class="p">(</span><span class="n">vars</span><span class="p">,</span> <span class="o">*</span><span class="n">cmd</span><span class="p">,</span> <span class="n">options</span><span class="p">)</span> <span class="k">do</span> <span class="o">|</span><span class="n">stdin</span><span class="p">,</span> <span class="n">stdout</span><span class="p">,</span> <span class="n">stderr</span><span class="p">,</span> <span class="n">wait_thr</span><span class="o">|</span></span>
- 2f6fcd96b88b36ce98c38da085c795a27d92a3dd_22_29 - 2f6fcd96b88b36ce98c38da085c795a27d92a3dd_22_29
- -
- 29 - 29
- | - |2
<span id="LC28" class="line"> <span class="no">Open3</span><span class="p">.</span><span class="nf">popen3</span><span class="p">(</span><span class="n">vars</span><span class="p">,</span> <span class="o">*</span><span class="n">cmd</span><span class="p">,</span> <span class="n">options</span><span class="p">)</span> <span class="k">do</span> <span class="o">|</span><span class="n">stdin</span><span class="p">,</span> <span class="n">stdout</span><span class="p">,</span> <span class="n">stderr</span><span class="p">,</span> <span class="n">wait_thr</span><span class="o">|</span></span> <span id="LC29" class="line"> <span class="no">Open3</span><span class="p">.</span><span class="nf">popen3</span><span class="p">(</span><span class="n">vars</span><span class="p">,</span> <span class="o">*</span><span class="n">cmd</span><span class="p">,</span> <span class="n">options</span><span class="p">)</span> <span class="k">do</span> <span class="o">|</span><span class="n">stdin</span><span class="p">,</span> <span class="n">stdout</span><span class="p">,</span> <span class="n">stderr</span><span class="p">,</span> <span class="n">wait_thr</span><span class="o">|</span></span>
- 2f6fcd96b88b36ce98c38da085c795a27d92a3dd_22_29 - 2f6fcd96b88b36ce98c38da085c795a27d92a3dd_22_29
- - - -
- 23 - 23
- | - |2
<span id="LC29" class="line"> <span class="vi">@cmd_output</span> <span class="o">&lt;&lt;</span> <span class="n">stdout</span><span class="p">.</span><span class="nf">read</span></span> <span id="LC30" class="line"> <span class="vi">@cmd_output</span> <span class="o">&lt;&lt;</span> <span class="n">stdout</span><span class="p">.</span><span class="nf">read</span></span>
- 2f6fcd96b88b36ce98c38da085c795a27d92a3dd_23_30 - 2f6fcd96b88b36ce98c38da085c795a27d92a3dd_23_30
- -
- 30 - 30
- | - |2
<span id="LC29" class="line"> <span class="vi">@cmd_output</span> <span class="o">&lt;&lt;</span> <span class="n">stdout</span><span class="p">.</span><span class="nf">read</span></span> <span id="LC30" class="line"> <span class="vi">@cmd_output</span> <span class="o">&lt;&lt;</span> <span class="n">stdout</span><span class="p">.</span><span class="nf">read</span></span>
- 2f6fcd96b88b36ce98c38da085c795a27d92a3dd_23_30 - 2f6fcd96b88b36ce98c38da085c795a27d92a3dd_23_30
- - - -
- 24 - 24
- <span id="LC30" class="line"> <span class="vi">@cmd_output</span> <span - |2
class="o">&lt;&lt;</span> <span class="n">stderr</span><span class="p">.</span><span <span id="LC31" class="line"> <span class="vi">@cmd_output</span> <span class="o">&lt;&lt;</span> <span class="n">stderr</span><span class="p">.</span><span class="nf">read</span></span>
class="nf">read</span></span>
- 2f6fcd96b88b36ce98c38da085c795a27d92a3dd_24_31 - 2f6fcd96b88b36ce98c38da085c795a27d92a3dd_24_31
- -
- 31 - 31
- <span id="LC30" class="line"> <span class="vi">@cmd_output</span> <span - |2
class="o">&lt;&lt;</span> <span class="n">stderr</span><span class="p">.</span><span <span id="LC31" class="line"> <span class="vi">@cmd_output</span> <span class="o">&lt;&lt;</span> <span class="n">stderr</span><span class="p">.</span><span class="nf">read</span></span>
class="nf">read</span></span>
- 2f6fcd96b88b36ce98c38da085c795a27d92a3dd_24_31 - 2f6fcd96b88b36ce98c38da085c795a27d92a3dd_24_31
...@@ -4,11 +4,12 @@ describe DiffHelper do ...@@ -4,11 +4,12 @@ describe DiffHelper do
include RepoHelpers include RepoHelpers
let(:project) { create(:project) } let(:project) { create(:project) }
let(:repository) { project.repository }
let(:commit) { project.commit(sample_commit.id) } let(:commit) { project.commit(sample_commit.id) }
let(:diffs) { commit.diffs } let(:diffs) { commit.diffs }
let(:diff) { diffs.first } let(:diff) { diffs.first }
let(:diff_refs) { [commit.parent.id, commit.id] } let(:diff_refs) { [commit.parent.id, commit.id] }
let(:diff_file) { Gitlab::Diff::File.new(diff, diff_refs, project.repository) } let(:diff_file) { Gitlab::Diff::File.new(diff, diff_refs, repository) }
describe 'diff_hard_limit_enabled?' do describe 'diff_hard_limit_enabled?' do
it 'should return true if param is provided' do it 'should return true if param is provided' do
...@@ -45,41 +46,41 @@ describe DiffHelper do ...@@ -45,41 +46,41 @@ describe DiffHelper do
describe 'safe_diff_files' do describe 'safe_diff_files' do
it 'should return all files from a commit that is smaller than safe limits' do it 'should return all files from a commit that is smaller than safe limits' do
expect(safe_diff_files(diffs).length).to eq(2) expect(safe_diff_files(diffs, diff_refs, repository).length).to eq(2)
end end
it 'should return only the first file if the diff line count in the 2nd file takes the total beyond safe limits' do it 'should return only the first file if the diff line count in the 2nd file takes the total beyond safe limits' do
allow(diffs[1].diff).to receive(:lines).and_return([""] * 4999) #simulate 4999 lines allow(diffs[1].diff).to receive(:lines).and_return([""] * 4999) #simulate 4999 lines
expect(safe_diff_files(diffs).length).to eq(1) expect(safe_diff_files(diffs, diff_refs, repository).length).to eq(1)
end end
it 'should return all files from a commit that is beyond safe limit for numbers of lines if force diff is true' do it 'should return all files from a commit that is beyond safe limit for numbers of lines if force diff is true' do
allow(controller).to receive(:params) { { force_show_diff: true } } allow(controller).to receive(:params) { { force_show_diff: true } }
allow(diffs[1].diff).to receive(:lines).and_return([""] * 4999) #simulate 4999 lines allow(diffs[1].diff).to receive(:lines).and_return([""] * 4999) #simulate 4999 lines
expect(safe_diff_files(diffs).length).to eq(2) expect(safe_diff_files(diffs, diff_refs, repository).length).to eq(2)
end end
it 'should return only the first file if the diff line count in the 2nd file takes the total beyond hard limits' do it 'should return only the first file if the diff line count in the 2nd file takes the total beyond hard limits' do
allow(controller).to receive(:params) { { force_show_diff: true } } allow(controller).to receive(:params) { { force_show_diff: true } }
allow(diffs[1].diff).to receive(:lines).and_return([""] * 49999) #simulate 49999 lines allow(diffs[1].diff).to receive(:lines).and_return([""] * 49999) #simulate 49999 lines
expect(safe_diff_files(diffs).length).to eq(1) expect(safe_diff_files(diffs, diff_refs, repository).length).to eq(1)
end end
it 'should return only a safe number of file diffs if a commit touches more files than the safe limits' do it 'should return only a safe number of file diffs if a commit touches more files than the safe limits' do
large_diffs = diffs * 100 #simulate 200 diffs large_diffs = diffs * 100 #simulate 200 diffs
expect(safe_diff_files(large_diffs).length).to eq(100) expect(safe_diff_files(large_diffs, diff_refs, repository).length).to eq(100)
end end
it 'should return all file diffs if a commit touches more files than the safe limits but force diff is true' do it 'should return all file diffs if a commit touches more files than the safe limits but force diff is true' do
allow(controller).to receive(:params) { { force_show_diff: true } } allow(controller).to receive(:params) { { force_show_diff: true } }
large_diffs = diffs * 100 #simulate 200 diffs large_diffs = diffs * 100 #simulate 200 diffs
expect(safe_diff_files(large_diffs).length).to eq(200) expect(safe_diff_files(large_diffs, diff_refs, repository).length).to eq(200)
end end
it 'should return a limited file diffs if a commit touches more files than the hard limits and force diff is true' do it 'should return a limited file diffs if a commit touches more files than the hard limits and force diff is true' do
allow(controller).to receive(:params) { { force_show_diff: true } } allow(controller).to receive(:params) { { force_show_diff: true } }
very_large_diffs = diffs * 1000 #simulate 2000 diffs very_large_diffs = diffs * 1000 #simulate 2000 diffs
expect(safe_diff_files(very_large_diffs).length).to eq(1000) expect(safe_diff_files(very_large_diffs, diff_refs, repository).length).to eq(1000)
end end
end end
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment