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
diff options
context:
space:
mode:
authorMark Chao <mchao@gitlab.com>2018-09-11 07:37:44 +0300
committerMark Chao <mchao@gitlab.com>2018-10-30 10:44:55 +0300
commitbc14e4ed1024efa1e0a411bd59e1339fb1af20c0 (patch)
tree249ac6ce57b9758d3472dd4b1319527636b72f44 /spec/presenters
parent39ae9a59a59615092fbef189466f37c34f4a7fb1 (diff)
Move :plain option to Highlight class
This is to DRY the repeated file size check. Move spec and constants to Highlight
Diffstat (limited to 'spec/presenters')
-rw-r--r--spec/presenters/blob_presenter_spec.rb26
1 files changed, 5 insertions, 21 deletions
diff --git a/spec/presenters/blob_presenter_spec.rb b/spec/presenters/blob_presenter_spec.rb
index 5c83fa39d80..e85e7a41017 100644
--- a/spec/presenters/blob_presenter_spec.rb
+++ b/spec/presenters/blob_presenter_spec.rb
@@ -18,31 +18,15 @@ 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, plain: false, language: nil)
+ expect(Gitlab::Highlight).to receive(:highlight).with('files/ruby/regex.rb', git_blob.data, plain: nil, language: nil)
subject.highlight
end
- context 'with :plain' do
- it 'returns plain content when no_highlighting? is true' do
- allow(blob).to receive(:no_highlighting?).and_return(true)
+ it 'returns plain content when :plain is true' do
+ expect(Gitlab::Highlight).to receive(:highlight).with('files/ruby/regex.rb', git_blob.data, plain: true, 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, plain: true, language: nil)
-
- subject.highlight(plain: true)
- end
-
- it 'returns plain content when :plain is false, but no_highlighting? is true' do
- allow(blob).to receive(:no_highlighting?).and_return(true)
-
- expect(Gitlab::Highlight).to receive(:highlight).with('files/ruby/regex.rb', git_blob.data, plain: true, language: nil)
-
- subject.highlight(plain: false)
- end
+ subject.highlight(plain: true)
end
context 'gitlab-language contains a match' do
@@ -51,7 +35,7 @@ describe BlobPresenter, :seed_helper do
end
it 'passes language to inner call' do
- expect(Gitlab::Highlight).to receive(:highlight).with('files/ruby/regex.rb', git_blob.data, plain: false, language: 'ruby')
+ expect(Gitlab::Highlight).to receive(:highlight).with('files/ruby/regex.rb', git_blob.data, plain: nil, language: 'ruby')
subject.highlight
end