require 'spec_helper' describe Gitlab::Diff::InlineDiffMarker, lib: true do describe '#mark' do context "when the rich text is html safe" do let(:raw) { "abc 'def'" } let(:rich) { %{abc 'def'}.html_safe } let(:inline_diffs) { [2..5] } let(:subject) { described_class.new(raw, rich).mark(inline_diffs) } it 'marks the range' do expect(subject).to eq(%{abc 'def'}) expect(subject).to be_html_safe end end context "when the text text is not html safe" do let(:raw) { "abc 'def'" } let(:inline_diffs) { [2..5] } let(:subject) { described_class.new(raw).mark(inline_diffs) } it 'marks the range' do expect(subject).to eq(%{abc 'def'}) expect(subject).to be_html_safe end end end end