RSpec: 测试是否调用了方法 - 参数数量错误(给定 0,预期 1)

RSpec: Test if a method was called - wrong number of arguments (given 0, expected 1)

我有以下控制器的操作方法:

def update
    @membership.update(membership_params)

    if(@membership.admin)
      ProjectAssignments::RemoveProjectAssignmentsByUser.call!(user_id: membership.user_id, project_id: membership.project_id)
    end
    
    respond_with(@membership)
  end

我需要测试ProjectAssignments::RemoveProjectAssignmentsByUser.call!在更新操作中被调用。

我写了测试,但是报错

it "should call interactor" do
        expect {
          put :update, params: update_params, as: :json
        }.to receive { :call! }.with(hash_including({user_id: membership.user_id, project_id: membership.project_id})
      end

错误 - ArgumentError: 参数数量错误(给定 0,预期 1)

it "should call interactor" do
  expect(ProjectAssignments::RemoveProjectAssignmentsByUser).to receive(:call!).with(
      user_id: membership.user_id, project_id: membership.project_id
  )
  # call the update method here
end