File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -271,7 +271,9 @@ def validate_acyclic!
271271 #
272272 # @see #[]
273273 def initialize ( name , content = nil , options = nil )
274- options = { } unless options . is_a? ( Hash )
274+ raise ArgumentError , 'Options must be a hash' if options && !options . is_a? ( Hash )
275+
276+ options ||= { }
275277 @checks_enabled = options . fetch ( :checks , true )
276278
277279 raise ArgumentError , 'Node name HAS to be provided!' if checks_enabled? && name . nil?
Original file line number Diff line number Diff line change @@ -80,6 +80,7 @@ def test_root_setup
8080 assert_equal ( 0 , @root . in_degree , 'Root should have an in-degree of 0' )
8181 assert_equal ( 0 , @root . node_height , "Root's height before adding any children is 0" )
8282 assert_raise ( ArgumentError ) { Tree ::TreeNode . new ( nil ) }
83+ assert_raise ( ArgumentError ) { Tree ::TreeNode . new ( 'ROOT' , nil , :bad ) }
8384 end
8485
8586 def test_root
You can’t perform that action at this time.
0 commit comments