add spec for filters class
This commit is contained in:
parent
dea21f0f8d
commit
fa44b31280
|
@ -2,6 +2,9 @@ module Jekyll
|
|||
class SeoTag
|
||||
class Drop < Jekyll::Drops::Drop
|
||||
TITLE_SEPARATOR = " | ".freeze
|
||||
FORMAT_STRING_METHODS = %i[
|
||||
markdownify strip_html normalize_whitespace escape_once
|
||||
].freeze
|
||||
|
||||
def initialize(text, context)
|
||||
@obj = {}
|
||||
|
@ -190,8 +193,7 @@ module Jekyll
|
|||
end
|
||||
|
||||
def format_string(string)
|
||||
methods = %i[markdownify strip_html normalize_whitespace escape_once]
|
||||
methods.each do |method|
|
||||
FORMAT_STRING_METHODS.each do |method|
|
||||
string = filters.public_send(method, string)
|
||||
end
|
||||
|
||||
|
|
|
@ -0,0 +1,18 @@
|
|||
RSpec.describe Jekyll::SeoTag::Filters do
|
||||
let(:page) { make_page }
|
||||
let(:site) { make_site }
|
||||
let(:context) { make_context(:page => page, :site => site) }
|
||||
subject { described_class.new(context) }
|
||||
|
||||
it "stores the context" do
|
||||
expect(subject.instance_variable_get("@context")).to be_a(Liquid::Context)
|
||||
end
|
||||
|
||||
it "exposes jekyll filters" do
|
||||
expect(subject).to respond_to(:markdownify)
|
||||
end
|
||||
|
||||
it "exposes liquid standard filters" do
|
||||
expect(subject).to respond_to(:normalize_whitespace)
|
||||
end
|
||||
end
|
Loading…
Reference in New Issue