mirror of
https://github.com/usetrmnl/terminus.git
synced 2026-08-13 14:29:27 -07:00
Removed extensions URI Builder
Safe to remove since it's no longer needed. Issue: 352 Milestone: minor
This commit is contained in:
@@ -1,17 +0,0 @@
|
||||
# frozen_string_literal: true
|
||||
|
||||
module Terminus
|
||||
module Aspects
|
||||
module Extensions
|
||||
# A specialized URI builder based template and data to produce an array of fully formed URIs.
|
||||
class URIBuilder
|
||||
include Deps["aspects.extensions.contextualizer", renderer: "liquid.basic"]
|
||||
|
||||
def call extension, template
|
||||
contextualizer.call(extension)
|
||||
.then { |data| renderer.call(template, data).split }
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
@@ -1,32 +0,0 @@
|
||||
# frozen_string_literal: true
|
||||
|
||||
require "hanami_helper"
|
||||
|
||||
RSpec.describe Terminus::Aspects::Extensions::URIBuilder do
|
||||
subject(:builder) { described_class.new }
|
||||
|
||||
describe "#call" do
|
||||
let :extension do
|
||||
Factory.structs[
|
||||
:extension,
|
||||
fields: [
|
||||
{"keyname" => "one", "default" => 1},
|
||||
{"keyname" => "two", "default" => 2}
|
||||
]
|
||||
]
|
||||
end
|
||||
|
||||
it "answers URIs with default data" do
|
||||
expect(builder.call(extension, "https://test.io")).to contain_exactly("https://test.io")
|
||||
end
|
||||
|
||||
it "answers URIs with custom data" do
|
||||
template = <<~CONTENT
|
||||
https://test.io/{{extension.values.one}}
|
||||
https://test.io/{{extension.values.two}}
|
||||
CONTENT
|
||||
|
||||
expect(builder.call(extension, template)).to eq(%w[https://test.io/1 https://test.io/2])
|
||||
end
|
||||
end
|
||||
end
|
||||
Reference in New Issue
Block a user