Unable to run single(!) rails interactor at rails 6

Viewed 248

Unable to run single(!) rails interactor at rails 6. According to https://github.com/collectiveidea/interactor-rails execute: rails generate interactor authenticate_user to create interactor. Command bin/rspec works perfectly and produce output:

Pending: (Failures listed here are expected and do not affect your suite's status)

  1) AuthenticateUser.call add some examples to (or delete) /Users/.../spec/interactors/authenticate_user_spec.rb
     # Not yet implemented
     # ./spec/interactors/authenticate_user_spec.rb:5

Command bin/rspec spec/interactors/authenticate_user_spec.rb to run single interactor produces error:

An error occurred while loading ./spec/interactors/authenticate_user_spec.rb.
Failure/Error:
  RSpec.describe AuthenticateUser, type: :interactor do
    describe '.call' do
      pending "add some examples to (or delete) #{__FILE__}"
    end
  end

NameError:
  uninitialized constant AuthenticateUser
# ./spec/interactors/authenticate_user_spec.rb:3:in `<top (required)>'
No examples found.


Finished in 0.00004 seconds (files took 0.25648 seconds to load)
0 examples, 0 failures, 1 error occurred outside of examples

Does anybody know how to run spec for single interactor? As far as I understand interactors dir is not autoloaded. Thanks!

Sincerely yours, Anna

1 Answers

fix: default generator produce "require 'spec_helper'", it should be replaced with "require 'rails_helper'". The problem has been fixed by this replacement.

Related