npauzenga / Blocitoff

Self-destructing To-Do list app with rake automation

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

tests in create_user_spec require subject.call to receive interactor_context

npauzenga opened this issue · comments

Heya @enriikke! I'm going to merge the relevant PR but I wanted to keep this issue alive. --

  2) CreateUser.call calls the EncryptPassword interactor
     Failure/Error: subject.call
     NoMethodError:
       undefined method `save' for nil:NilClass

That's with the specs run like this, without giving subject.call any arguments --

    it "calls the MakeNewUser interactor" do
      expect(make_new_user).to receive(:run!)
      subject.call
    end

If I do this --

    it "calls the MakeNewUser interactor" do
      expect(make_new_user).to receive(:run!)
      subject.call(interactor_context)
    end

...everybody's happy. This is tested on the create_user_spec. We do expect that CreateUser.call will be given user_params in our controller...