Welcome to mirror list, hosted at ThFree Co, Russian Federation.

gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
path: root/spec
diff options
context:
space:
mode:
authorPatrick Bajao <ebajao@gitlab.com>2019-08-09 03:13:09 +0300
committerPatrick Bajao <ebajao@gitlab.com>2019-08-09 03:13:09 +0300
commit6d318af5f95cc4091b09f1b2f8ed9981f3a8b9c7 (patch)
tree34ad57d297cc184075fb8c808eac3275266e8f3a /spec
parent00223f91f316a0d09b158595990cf1cd237c27ec (diff)
Revert "Merge branch '65152-selective-highlight' into 'master'"
This reverts merge request !31361
Diffstat (limited to 'spec')
-rw-r--r--spec/lib/gitlab/highlight_spec.rb8
-rw-r--r--spec/presenters/blob_presenter_spec.rb52
2 files changed, 3 insertions, 57 deletions
diff --git a/spec/lib/gitlab/highlight_spec.rb b/spec/lib/gitlab/highlight_spec.rb
index a410e4eab45..4676db6b8d8 100644
--- a/spec/lib/gitlab/highlight_spec.rb
+++ b/spec/lib/gitlab/highlight_spec.rb
@@ -62,14 +62,6 @@ describe Gitlab::Highlight do
expect(lines[2].text).to eq(' """')
end
- context 'since param is present' do
- it 'highlights with the LC starting from "since" param' do
- lines = described_class.highlight(file_name, content, since: 2).lines
-
- expect(lines[0]).to include('LC2')
- end
- end
-
context 'diff highlighting' do
let(:file_name) { 'test.diff' }
let(:content) { "+aaa\n+bbb\n- ccc\n ddd\n"}
diff --git a/spec/presenters/blob_presenter_spec.rb b/spec/presenters/blob_presenter_spec.rb
index 95db2ba6a0d..eacf383be7d 100644
--- a/spec/presenters/blob_presenter_spec.rb
+++ b/spec/presenters/blob_presenter_spec.rb
@@ -28,70 +28,24 @@ describe BlobPresenter, :seed_helper do
subject { described_class.new(blob) }
it 'returns highlighted content' do
- expect(Gitlab::Highlight)
- .to receive(:highlight)
- .with(
- 'files/ruby/regex.rb',
- git_blob.data,
- since: nil,
- plain: nil,
- language: nil
- )
+ expect(Gitlab::Highlight).to receive(:highlight).with('files/ruby/regex.rb', git_blob.data, plain: nil, language: nil)
subject.highlight
end
it 'returns plain content when :plain is true' do
- expect(Gitlab::Highlight)
- .to receive(:highlight)
- .with(
- 'files/ruby/regex.rb',
- git_blob.data,
- since: nil,
- plain: true,
- language: nil
- )
+ expect(Gitlab::Highlight).to receive(:highlight).with('files/ruby/regex.rb', git_blob.data, plain: true, language: nil)
subject.highlight(plain: true)
end
- context '"since" and "to" are present' do
- before do
- allow(git_blob)
- .to receive(:data)
- .and_return("line one\nline two\nline 3\nline 4")
- end
-
- it 'returns limited highlighted content' do
- expect(Gitlab::Highlight)
- .to receive(:highlight)
- .with(
- 'files/ruby/regex.rb',
- "line two\nline 3\n",
- since: 2,
- language: nil,
- plain: nil
- )
-
- subject.highlight(since: 2, to: 3)
- end
- end
-
context 'gitlab-language contains a match' do
before do
allow(blob).to receive(:language_from_gitattributes).and_return('ruby')
end
it 'passes language to inner call' do
- expect(Gitlab::Highlight)
- .to receive(:highlight)
- .with(
- 'files/ruby/regex.rb',
- git_blob.data,
- since: nil,
- plain: nil,
- language: 'ruby'
- )
+ expect(Gitlab::Highlight).to receive(:highlight).with('files/ruby/regex.rb', git_blob.data, plain: nil, language: 'ruby')
subject.highlight
end