diff options
author | Douwe Maan <douwe@selenight.nl> | 2016-01-30 12:53:12 +0100 |
---|---|---|
committer | Douwe Maan <douwe@selenight.nl> | 2016-01-30 12:53:12 +0100 |
commit | fa0cbb13990a7e7edec55e9724e9c4d676743f3b (patch) | |
tree | cdf86f4f89ee608af44b683e7c77f849a70a3a2b /spec/helpers | |
parent | 677b4db9e682b29bb15dddb84fe80b976490a671 (diff) | |
download | gitlab-ce-fa0cbb13990a7e7edec55e9724e9c4d676743f3b.tar.gz |
Fix specs and add a new one
Diffstat (limited to 'spec/helpers')
-rw-r--r-- | spec/helpers/diff_helper_spec.rb | 17 |
1 files changed, 13 insertions, 4 deletions
diff --git a/spec/helpers/diff_helper_spec.rb b/spec/helpers/diff_helper_spec.rb index 955d2852cfd..14986a74c2e 100644 --- a/spec/helpers/diff_helper_spec.rb +++ b/spec/helpers/diff_helper_spec.rb @@ -104,8 +104,7 @@ describe DiffHelper do end end - describe 'diff_line_content' do - + describe '#diff_line_content' do it 'should return non breaking space when line is empty' do expect(diff_line_content(nil)).to eq(' ') end @@ -116,9 +115,19 @@ describe DiffHelper do expect(diff_line_content(diff_file.diff_lines.first.type)).to eq('match') expect(diff_file.diff_lines.first.new_pos).to eq(6) end + end + + describe "#mark_inline_diffs" do + let(:old_line) { %{abc 'def'} } + let(:new_line) { %{abc "def"} } + + it "returns strings with marked inline diffs" do + marked_old_line, marked_new_line = mark_inline_diffs(old_line, new_line) - it 'should return safe HTML' do - expect(diff_line_content(diff_file.diff_lines.first.text)).to be_html_safe + expect(marked_old_line).to eq("abc <span class='idiff left right'>'def'</span>") + expect(marked_old_line).to be_html_safe + expect(marked_new_line).to eq("abc <span class='idiff left right'>"def"</span>") + expect(marked_new_line).to be_html_safe end end end |