Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

on_breach method is not called when using superclass #38

Open
c80609a opened this issue Dec 22, 2020 · 1 comment
Open

on_breach method is not called when using superclass #38

c80609a opened this issue Dec 22, 2020 · 1 comment

Comments

@c80609a
Copy link

c80609a commented Dec 22, 2020

No superclass, on_breach is called:

module Api
  module V2
    class FetchThreedsParams
      include Interactor
      include Interactor::Contracts

      expects do
        required(:user).filled
      end

      on_breach do |breaches|
        puts '1'*30
      end

      before do

      end

      def call

      end
    end
  end
end

# rails c
# Running via Spring preloader in process 70120
# Loading development environment (Rails 5.2.4.4)
# 2.5.1 :001 > Api::V2::FetchThreedsParams.call
# 111111111111111111111111111
#  => #<Interactor::Context>

With superclass, on_breach is not called:

class BaseInteractor
  include Interactor
  include Interactor::Contracts
end

module Api
  class FetchThreedsParams < ::BaseInteractor
    expects do
      required(:user).filled
    end

    on_breach do |breaches|
      puts '1'*30
    end

    before do

    end

    def call

    end
  end
end

# rails c
# Running via Spring preloader in process 70120
# Loading development environment (Rails 5.2.4.4)
# 2.5.1 :001 > Api::FetchThreedsParams.call
# => #<Interactor::Context user=["user is missing"]>

What i am doing wrong?
https://github.com/c080609a/schema_test - example project (Rails 5.2.4.4, ruby-2.5.1, 3 classes, no database).

@fpenapita
Copy link

Same problem!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants