test/name_collisions_test.rb in surrounded-0.9.10 vs test/name_collisions_test.rb in surrounded-0.9.11

- old
+ new

@@ -124,10 +124,25 @@ assert_output(nil, "base has name collisions with [:will_collide]\n") { new_context_with_collision } end + it 'can ignore collisions' do + set_handler :nothing + assert_output(nil, nil) { + new_context_with_collision + } + end + + it 'raises an error with an unknown handler' do + set_handler :barf + err = assert_raises(ArgumentError) { + new_context_with_collision + } + expect(err.message).must_match(/your name collision handler was set to \`barf' but there is no instance nor class method of that name/) + end + let(:create_context_with_multiple_collisions){ ContextWithMultipleCollisions.new(first: First.new, second: Second.new, third: Third.new) } it 'can handle multiple collisions' do @@ -141,10 +156,10 @@ } end it 'can use a class method' do class ContextOverridesName - def class_method_handler(message) + def self.class_method_handler(message) puts message end end set_handler :class_method_handler assert_output("base has name collisions with [:will_collide]\n"){