require 'test_helper' require 'ostruct' class TreeForTest < ActiveSupport::TestCase class Context def initialize(roles) @roles = roles end end class Role attr :name, :children def initialize(name, children: []) @name = name @children = children end end def roles [Role.new('SuperAdmin', children: [Role.new('Admin', children: [Role.new('Publisher', children: [Role.new('Author')]), Role.new('Auditor')])])] end EXAMPLE_MARKUP = <<-HTML