• Lin Jen-Shin's avatar
    Also verify if extending would override a class method · f71fc932
    Lin Jen-Shin authored
    Since extending a class means including on the singleton class of the
    class, this should now complain this:
    
    ``` ruby
    module M
      extend Gitlab::Utils::Override
    
      override :f
      def f
        super.succ
      end
    end
    
    class C
      extend M
    
      def self.f
        0
      end
    end
    ```
    
    It should complain because `C.f` wasn't calling `M#f`.
    This should pass verification:
    
    ``` ruby
    module M
      extend Gitlab::Utils::Override
    
      override :f
      def f
        super.succ
      end
    end
    
    class B
      def self.f
        0
      end
    end
    
    class C < B
      extend M
    end
    ```
    
    Because `C.f` would now call `M#f`, and `M#f` does override something.
    f71fc932
override.rb 2.96 KB