From 45a8087bbdde309703db3860a160bab3fdb8c14a Mon Sep 17 00:00:00 2001
From: Takashi Kokubun <takashikkbn@gmail.com>
Date: Tue, 25 Oct 2022 09:25:18 -0700
Subject: [PATCH] Support temple 0.9.1+ (#894)

---
 slim.gemspec               | 2 +-
 test/core/test_commands.rb | 6 +++++-
 2 files changed, 6 insertions(+), 2 deletions(-)

diff --git a/slim.gemspec b/slim.gemspec
index 0bbc7ae4..095dafd5 100644
--- a/slim.gemspec
+++ b/slim.gemspec
@@ -19,6 +19,6 @@ Gem::Specification.new do |s|
 
   s.required_ruby_version = '>=2.0.0'
 
-  s.add_runtime_dependency('temple', ['>= 0.7.6', '< 0.9'])
+  s.add_runtime_dependency('temple', ['>= 0.7.6', '!= 0.9.0'])
   s.add_runtime_dependency('tilt', ['>= 2.0.6', '< 2.1'])
 end
diff --git a/test/core/test_commands.rb b/test/core/test_commands.rb
index 7cf8e838..15a77dd7 100644
--- a/test/core/test_commands.rb
+++ b/test/core/test_commands.rb
@@ -58,7 +58,11 @@ def test_rails
     prepare_common_test DYNAMIC_TEMPLATE, '--rails' do |out, err|
       assert err.empty?
 
-      assert out.include? %Q{@output_buffer = ActiveSupport::SafeBuffer.new;}
+      if Gem::Version.new(Temple::VERSION) >= Gem::Version.new('0.9')
+        assert out.include? %Q{@output_buffer = output_buffer || ActionView::OutputBuffer.new;}
+      else
+        assert out.include? %Q{@output_buffer = ActiveSupport::SafeBuffer.new;}
+      end
       assert out.include? %Q{@output_buffer.safe_concat(("<p>Hello "#{STRING_FREEZER}));}
       assert out.include? %Q{@output_buffer.safe_concat(((::Temple::Utils.escape_html((name))).to_s));}
       assert out.include? %Q{@output_buffer.safe_concat(("!</p>"#{STRING_FREEZER}));}
