summaryrefslogtreecommitdiff
path: root/spec/helpers/diff_helper_spec.rb
diff options
context:
space:
mode:
authorJeroen van Baarsen <jeroenvanbaarsen@gmail.com>2015-02-12 19:17:35 +0100
committerJeroen van Baarsen <jeroenvanbaarsen@gmail.com>2015-02-12 19:17:35 +0100
commit0c4a70a306b871899bf87ce4673918abfee4d95f (patch)
treec7a702fb511209ffe0eceba245d1ffea71dce1aa /spec/helpers/diff_helper_spec.rb
parentde1c450abd6b367390a1295cac402344f500d41d (diff)
downloadgitlab-ce-0c4a70a306b871899bf87ce4673918abfee4d95f.tar.gz
Updated rspec to rspec 3.x syntax
Signed-off-by: Jeroen van Baarsen <jeroenvanbaarsen@gmail.com>
Diffstat (limited to 'spec/helpers/diff_helper_spec.rb')
-rw-r--r--spec/helpers/diff_helper_spec.rb28
1 files changed, 14 insertions, 14 deletions
diff --git a/spec/helpers/diff_helper_spec.rb b/spec/helpers/diff_helper_spec.rb
index b07742a6ee2..75da43a68a6 100644
--- a/spec/helpers/diff_helper_spec.rb
+++ b/spec/helpers/diff_helper_spec.rb
@@ -10,58 +10,58 @@ describe DiffHelper do
describe 'diff_hard_limit_enabled?' do
it 'should return true if param is provided' do
- controller.stub(:params).and_return { { :force_show_diff => true } }
- diff_hard_limit_enabled?.should be_true
+ allow(controller).to receive(:params) { { :force_show_diff => true } }
+ expect(diff_hard_limit_enabled?).to be_truthy
end
it 'should return false if param is not provided' do
- diff_hard_limit_enabled?.should be_false
+ expect(diff_hard_limit_enabled?).to be_falsey
end
end
describe 'allowed_diff_size' do
it 'should return hard limit for a diff if force diff is true' do
- controller.stub(:params).and_return { { :force_show_diff => true } }
- allowed_diff_size.should eq(1000)
+ allow(controller).to receive(:params) { { :force_show_diff => true } }
+ expect(allowed_diff_size).to eq(1000)
end
it 'should return safe limit for a diff if force diff is false' do
- allowed_diff_size.should eq(100)
+ expect(allowed_diff_size).to eq(100)
end
end
describe 'parallel_diff' do
it 'should return an array of arrays containing the parsed diff' do
- parallel_diff(diff_file, 0).should match_array(parallel_diff_result_array)
+ expect(parallel_diff(diff_file, 0)).to match_array(parallel_diff_result_array)
end
end
describe 'generate_line_code' do
it 'should generate correct line code' do
- generate_line_code(diff_file.file_path, diff_file.diff_lines.first).should == '2f6fcd96b88b36ce98c38da085c795a27d92a3dd_6_6'
+ expect(generate_line_code(diff_file.file_path, diff_file.diff_lines.first)).to eq('2f6fcd96b88b36ce98c38da085c795a27d92a3dd_6_6')
end
end
describe 'unfold_bottom_class' do
it 'should return empty string when bottom line shouldnt be unfolded' do
- unfold_bottom_class(false).should == ''
+ expect(unfold_bottom_class(false)).to eq('')
end
it 'should return js class when bottom lines should be unfolded' do
- unfold_bottom_class(true).should == 'js-unfold-bottom'
+ expect(unfold_bottom_class(true)).to eq('js-unfold-bottom')
end
end
describe 'diff_line_content' do
it 'should return non breaking space when line is empty' do
- diff_line_content(nil).should eq(" &nbsp;")
+ expect(diff_line_content(nil)).to eq(" &nbsp;")
end
it 'should return the line itself' do
- diff_line_content(diff_file.diff_lines.first.text).should eq("@@ -6,12 +6,18 @@ module Popen")
- diff_line_content(diff_file.diff_lines.first.type).should eq("match")
- diff_line_content(diff_file.diff_lines.first.new_pos).should eq(6)
+ expect(diff_line_content(diff_file.diff_lines.first.text)).to eq("@@ -6,12 +6,18 @@ module Popen")
+ expect(diff_line_content(diff_file.diff_lines.first.type)).to eq("match")
+ expect(diff_line_content(diff_file.diff_lines.first.new_pos)).to eq(6)
end
end