diff options
author | Sean McGivern <sean@gitlab.com> | 2018-07-17 14:58:14 +0100 |
---|---|---|
committer | Sean McGivern <sean@gitlab.com> | 2018-07-17 14:58:14 +0100 |
commit | fc580935ca2171d4f5628818aa4826fbce4a7261 (patch) | |
tree | 0afc54fe28001891da9ae0ffdb3c83eae517261d | |
parent | 1e2c28ab4194217ffcacd4e2e6cd41b1cc50bb09 (diff) | |
download | gitlab-ce-fc580935ca2171d4f5628818aa4826fbce4a7261.tar.gz |
Keep #absolute_image_urls as a private instance method
-rw-r--r-- | lib/gitlab/hook_data/base_builder.rb | 10 | ||||
-rw-r--r-- | spec/lib/gitlab/hook_data/base_builder_spec.rb | 12 |
2 files changed, 13 insertions, 9 deletions
diff --git a/lib/gitlab/hook_data/base_builder.rb b/lib/gitlab/hook_data/base_builder.rb index 1e90a2b3fe1..4ffca356b29 100644 --- a/lib/gitlab/hook_data/base_builder.rb +++ b/lib/gitlab/hook_data/base_builder.rb @@ -17,7 +17,9 @@ module Gitlab @object = object end - def self.absolute_image_urls(markdown_text) + private + + def absolute_image_urls(markdown_text) return markdown_text unless markdown_text.present? markdown_text.gsub(MARKDOWN_SIMPLE_IMAGE) do @@ -31,12 +33,6 @@ module Gitlab end end end - - private - - def absolute_image_urls(markdown_text) - self.class.absolute_image_urls(markdown_text) - end end end end diff --git a/spec/lib/gitlab/hook_data/base_builder_spec.rb b/spec/lib/gitlab/hook_data/base_builder_spec.rb index c5cc6177b1e..a921dd766c3 100644 --- a/spec/lib/gitlab/hook_data/base_builder_spec.rb +++ b/spec/lib/gitlab/hook_data/base_builder_spec.rb @@ -1,7 +1,15 @@ require 'spec_helper' describe Gitlab::HookData::BaseBuilder do - describe '.absolute_image_urls' do + describe '#absolute_image_urls' do + let(:subclass) do + Class.new(described_class) do + public :absolute_image_urls + end + end + + subject { subclass.new(nil) } + using RSpec::Parameterized::TableSyntax where do @@ -50,7 +58,7 @@ describe Gitlab::HookData::BaseBuilder do end with_them do - it { expect(described_class.absolute_image_urls(input)).to eq(output) } + it { expect(subject.absolute_image_urls(input)).to eq(output) } end end end |