diff --git a/lib/block_kit/layout/rich_text/list.rb b/lib/block_kit/layout/rich_text/list.rb index 424bdd8..54ce368 100644 --- a/lib/block_kit/layout/rich_text/list.rb +++ b/lib/block_kit/layout/rich_text/list.rb @@ -11,7 +11,7 @@ class RichText::List < BlockKit::Base ].freeze attribute :style, :string - attribute :elements, Types::Array.of(RichText::Section) + attribute :elements, Types::Array.of(RichText::Section), default: [] attribute :indent, :integer attribute :offset, :integer attribute :border, :integer diff --git a/spec/block_kit/layout/rich_text/list_spec.rb b/spec/block_kit/layout/rich_text/list_spec.rb index c81b674..ed6ff88 100644 --- a/spec/block_kit/layout/rich_text/list_spec.rb +++ b/spec/block_kit/layout/rich_text/list_spec.rb @@ -42,6 +42,18 @@ ] }) end + + context "when elements are not specified" do + let(:attributes) { {style: :bullet} } + + it "returns an empty elements array" do + expect(block.as_json).to eq({ + type: described_class.type.to_s, + style: "bullet", + elements: [] + }) + end + end end context "attributes" do