require 'test_helper' module ExpressAdmin class DefinitionListTest < ActiveSupport::TestCase def assigns {list_types: list_types} end def helpers mock_action_view end def list_types @list_types ||= OpenStruct.new( array: ["field1", "field2"], hash: {term1: "def1", term2: "def2", term3: "def3"}, hash_with_in_words: { "Created At:" => :created_at_in_words }) end def deflist(*args) arbre { definition_list(:deflist, *args) }.to_s end def deflist_with_resource(*args) arbre(widget: Widget.first) { definition_list(:widget, *args) }.to_s end test "accepts array as input" do assert deflist(list_types[:array]) end test "accepts hash as input" do assert deflist(list_types[:hash]) end test "uses keys as labels and values as definitions" do assert_match /