Skip to content

Cannot use super in call with inheritance #19

@rewritten

Description

@rewritten

The following spec fails in master, I'm working on a fix, but it will be quite invasive (prepending modules generated at runtime, and aliasing the user-provided :call method so we can respect the method resolution and only use the topmost call(args)

  context 'when subclassing' do
    let(:service) do
      Class.new do
        include Injectable

        argument :num, required: true

        def call
          num + 2
        end
      end
    end

    let(:service_subclass) do
      Class.new(service) do
        def call
          super + 3
        end
      end
    end

    it 'respects inheritance' do
      expect(service_subclass.call(num: 1)).to eq 6
    end
  end

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions