diff --git a/lib/hanami/view/context_helpers/content_helpers.rb b/lib/hanami/view/context_helpers/content_helpers.rb deleted file mode 100644 index aa5d7fab..00000000 --- a/lib/hanami/view/context_helpers/content_helpers.rb +++ /dev/null @@ -1,26 +0,0 @@ -module Hanami - class View - module ContextHelpers - module ContentHelpers - def initialize(**) - @content_for = {} - super - end - - def content_for(key, value = nil, &block) - output = nil - - if block - @content_for[key] = yield - elsif value - @content_for[key] = value - else - output = @content_for[key] - end - - output - end - end - end - end -end diff --git a/spec/unit/context_helpers/content_helpers_spec.rb b/spec/unit/context_helpers/content_helpers_spec.rb deleted file mode 100644 index 168c7ea6..00000000 --- a/spec/unit/context_helpers/content_helpers_spec.rb +++ /dev/null @@ -1,37 +0,0 @@ -# frozen_string_literal: true - -RSpec.describe Hanami::View::Context, "ContentHelpers" do - let(:context) { - Class.new(described_class) do - include Hanami::View::ContextHelpers::ContentHelpers - end.new - } - - describe "#content_for" do - context "no content set" do - it "returns nil" do - expect(context.content_for(:title)).to be nil - end - end - - context "content set" do - before do - context.content_for :title, "Hello World" - end - - it "returns the content" do - expect(context.content_for(:title)).to eq "Hello World" - end - end - - context "content set with a block" do - before do - context.content_for(:title) { "Hello Block" } - end - - it "saves the content returned from the block" do - expect(context.content_for(:title)).to eq "Hello Block" - end - end - end -end