Keep #absolute_image_urls as a private instance method

This commit is contained in:
Sean McGivern 2018-07-17 14:58:14 +01:00
parent 1e2c28ab41
commit fc580935ca
2 changed files with 13 additions and 9 deletions

View file

@ -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

View file

@ -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