Use and expect latest hamlit (#212)
The hamlit 3.0 release defaults to implicit block capturing when yielding, and hamlit-block has been correspondingly deprecated.
This commit is contained in:
parent
a5c68ee061
commit
136ebb5401
3
Gemfile
3
Gemfile
|
@ -17,8 +17,7 @@ group :test do
|
||||||
gem "dry-inflector"
|
gem "dry-inflector"
|
||||||
gem "erbse", "~> 0.1.4"
|
gem "erbse", "~> 0.1.4"
|
||||||
gem "erubi"
|
gem "erubi"
|
||||||
gem "hamlit"
|
gem "hamlit", ">= 3.0"
|
||||||
gem "hamlit-block"
|
|
||||||
gem "dry-files", github: "dry-rb/dry-files"
|
gem "dry-files", github: "dry-rb/dry-files"
|
||||||
gem "hanami-cli", github: "hanami/cli", branch: "main"
|
gem "hanami-cli", github: "hanami/cli", branch: "main"
|
||||||
gem "hanami", github: "hanami/hanami", branch: "main"
|
gem "hanami", github: "hanami/hanami", branch: "main"
|
||||||
|
|
|
@ -5,8 +5,8 @@ module Hanami
|
||||||
module Tilt
|
module Tilt
|
||||||
module Haml
|
module Haml
|
||||||
def self.requirements
|
def self.requirements
|
||||||
["hamlit/block", <<~ERROR]
|
["hamlit", <<~ERROR]
|
||||||
hanami-view requires hamlit-block for full compatibility when rendering .haml templates (e.g. implicitly capturing block content when yielding)
|
hanami-view requires hamlit (3.0 or greater) for full compatibility when rendering .haml templates (e.g. implicitly capturing block content when yielding)
|
||||||
|
|
||||||
To ignore this and use another engine for .haml templates, dereigster this adapter before calling your views:
|
To ignore this and use another engine for .haml templates, dereigster this adapter before calling your views:
|
||||||
|
|
||||||
|
@ -15,7 +15,7 @@ module Hanami
|
||||||
end
|
end
|
||||||
|
|
||||||
def self.activate
|
def self.activate
|
||||||
# Requiring hamlit/block will register the engine with Tilt
|
# Requiring hamlit will register the engine with Tilt
|
||||||
self
|
self
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
|
@ -1,3 +1,2 @@
|
||||||
= wrapper do
|
!= wrapper do
|
||||||
= "Yielded"
|
= "Yielded"
|
||||||
|
|
||||||
|
|
|
@ -1,2 +1,2 @@
|
||||||
= render(:wrapper) do
|
!= render(:wrapper) do
|
||||||
= "Yielded"
|
= "Yielded"
|
||||||
|
|
|
@ -35,13 +35,13 @@ RSpec.describe "Template engines / haml (using hamlit-block as default engine)"
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
context "with hamlit-block not available" do
|
context "with hamlit not available" do
|
||||||
before do
|
before do
|
||||||
@load_path = $LOAD_PATH.dup
|
@load_path = $LOAD_PATH.dup
|
||||||
@loaded_features = $LOADED_FEATURES.dup
|
@loaded_features = $LOADED_FEATURES.dup
|
||||||
|
|
||||||
$LOAD_PATH.reject! { |path| path =~ /hamlit-block/ }
|
$LOAD_PATH.reject! { |path| path =~ /hamlit/ }
|
||||||
$LOADED_FEATURES.reject! { |path| path =~ /hamlit-block/ }
|
$LOADED_FEATURES.reject! { |path| path =~ /hamlit/ }
|
||||||
|
|
||||||
Hanami::View::Tilt.cache.clear
|
Hanami::View::Tilt.cache.clear
|
||||||
Hanami::View::Renderer.cache.clear
|
Hanami::View::Renderer.cache.clear
|
||||||
|
@ -52,12 +52,12 @@ RSpec.describe "Template engines / haml (using hamlit-block as default engine)"
|
||||||
$LOADED_FEATURES.replace @loaded_features
|
$LOADED_FEATURES.replace @loaded_features
|
||||||
end
|
end
|
||||||
|
|
||||||
it "raises an error explaining the hamlit-block requirement" do
|
it "raises an error explaining the hamlit requirement" do
|
||||||
view = Class.new(base_view) do
|
view = Class.new(base_view) do
|
||||||
config.template = "render_and_yield"
|
config.template = "render_and_yield"
|
||||||
end.new
|
end.new
|
||||||
|
|
||||||
expect { view.() }.to raise_error(LoadError, /hanami-view requires hamlit-block/m)
|
expect { view.() }.to raise_error(LoadError, /hanami-view requires hamlit/m)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
Loading…
Reference in New Issue