Add tests and validation logic to greenhouse integration

The Greenhouse integration code is brittle. It has broken all builds on `www-gitlab-com`- see slack thread below. 

Per @stanhu 's suggestion, it needs to be improved and tests need to be added. In particular: https://gitlab.com/gitlab-com/www-gitlab-com/blob/master/helpers/jobs_helpers.rb

cc @brandon_lyon 

### Slack thread 

<details>
<summary> Conversation on slack </summary>

From this thread in slack: https://gitlab.slack.com/archives/CETG54GQ0/p1576276480021000

Thread
is-this-known


Thread
is-this-known


Brandon Lyon  1 hour ago
Scrolling through the error, it seems to happen around `block in show_childs' on public/jobs/apply/index. I'll take a peek at the code and see if I notice anything unusual to do with child elements. (edited) 


Brandon Lyon  1 hour ago
Looks related to the partial builds process, at least that's the test that's failing ( build_proxy_resource )


Brandon Lyon  1 hour ago
Yeah something to do with the data being pulled from greenhouse possibly. The job apply template appears to source its data through jobs_listing.rb which sources the data from the greenhouse_io gem


Brandon Lyon  1 hour ago
I'm trying to run the test locally to see if it fails or passes from my machine
:thank-you:
1



Brendan  1 hour ago
A property to toggle wouldn’t be super hard. I can take a swing at that 
:dancingpenguin:
1



joshua  1 hour ago
We can’t break our jobs site though 


Brandon Lyon  1 hour ago
Yeah the test fails on my local machine in the same spot


Brendan  1 hour ago
Is the jobs site working? 


Brandon Lyon  1 hour ago
On another tangent, the job listing library hasn't been updated in 4 months so that's probably not the file responsible. The job page template hasn't been updated in weeks so I don't think that's it either.


Brandon Lyon  1 hour ago
It looks like there's a difference between jobs appearing in greenhouse and jobs appearing on-site at the moment. I'm not sure what the cause is for the difference.


William  1 hour ago
Local build also fails for me in the same spot



Brandon Lyon  1 hour ago
I've exhausted my investigatory skills and knowledge of the site. It's probably time to call in more knowledgeable people. The failing line numbers in question appear to be around one of these two spots but I'm not sure which:
https://gitlab.com/gitlab-com/www-gitlab-com/blob/master/source/jobs/apply/template.html.haml#L37
https://gitlab.com/gitlab-com/www-gitlab-com/blob/master/source/jobs/apply/template.html.haml#L48 (edited) 


Brandon Lyon  1 hour ago
Actually I do have a theory I can test first.


William  1 hour ago
I’m looking at the same 2 lines… looks like Tony from ROIDNA built the template https://gitlab.com/gitlab-com/www-gitlab-com/commit/601c8ccbf90c813adcc047270ebbef32ca832f1c
@stanhu @rspeicher any thoughts on troubleshooting the show_childs method?

GitLabGitLab
Resolve "Jobs Page Update Supporting Subcategory Listings" (601c8ccb) · Commits · GitLab.com / www-gitlab-com
Source for https://about.gitlab.com/


Brandon Lyon  43 minutes ago
My theory didn't pan out


stanhu  42 minutes ago
sounds like res.first is nil for some reason. Let's see if we can run this locally


Brandon Lyon  41 minutes ago
code name sounds like first result nil?


Darren Murph:car:  38 minutes ago
(Thanks all who are working on this by the way, much appreciated :collaboration-value: )
:collaboration-value:
1



Brandon Lyon  30 minutes ago
The show_childs method has the following options
def show_childs(data, item, arr, show_list, depth, dept_id, result, teams)
 (edited) 


stanhu  29 minutes ago
I think I have a fix. I don't completely understand the data, but we're just getting a single blank array under the engineering department job listing for one of the listings (edited) 
:yay:
2
:bulb:
1
:star2:
1



Brandon Lyon  27 minutes ago
I suspected the data but wasn't sure how to test it. Although in retrospect I probably could have looked at greenhouses documentation to figure out their API and tried postman. (edited) 


stanhu  27 minutes ago
whatever child ID 4034708002 is


Darren Murph:car:  27 minutes ago
When it’s all said and done, sounds like we’ll chalk it up to excessive greenhouse gas emissions mucking things up
:lol:
1



Brandon Lyon  26 minutes ago
Out of curiosity would the fix be in job_helpers.rb?


William  26 minutes ago
I suspect that there’s either a bug in greenhouse, or a job was posted where there’s an expected/required field and it was omitted. (edited) 
:100:
1



Brandon Lyon  25 minutes ago
Interesting, going to the URL manually says that job is not found
https://boards.greenhouse.io/gitlab/jobs/4034708002


stanhu  22 minutes ago
not sure if that's an actual job ID


stanhu  22 minutes ago
Ironically, it's barfing on child_id 4034708002
for https://boards.greenhouse.io/gitlab/jobs/4465197002
boards.greenhouse.io
Backend Engineer, Static Site Editor
Remote
:rolling_on_the_floor_laughing:
2



Brandon Lyon  21 minutes ago
ah gotcha


joshua  20 minutes ago
It knows


stanhu  19 minutes ago
pushing up a merge request now. This code needs serious improvements and testing :slightly_smiling_face:


stanhu  19 minutes ago
I think this is Greenhouse's way of saying we need to hire someone to maintain this page


Brandon Lyon  17 minutes ago
I pinged peopleops to see if they have any ideas because the greenhouse listing does look a bit different from some others


stanhu  16 minutes ago
https://gitlab.com/gitlab-com/www-gitlab-com/merge_requests/36883/diffs
GitLabGitLab
Fix broken Greenhouse job generation (!36883) · Merge Requests · GitLab.com / www-gitlab-com
Child ID 4034708002 did not exist, and the code did not handle this properly.
Author
Stan Hu
Assignee
Stan Hu
:thank-you:
2



William  8 minutes ago
Looks like it choked on rubocop - I committed the suggested fix

</details>

Story points: 2.0