Week 12, day 1
This is it, hiring week, our final week as students at Makers, during which we are coached in making our github repos presentable, writing a functional CV, handling tech tests and interviews. More on that later in the week.
So one of my teammates on the 2-day Makerthon - Gymbuddy pushed up some changes to our readme and most of our tests started failing even though they were passing before. We were perplexed because no code or tests had been touched. Stay with me for more.
We were getting the same error for all the failing tests. In hindsight this was a really simple error but last night it took a little while to debug.
Failure/Error: create_post
Capybara::ElementNotFound:
Unable to find option "01"
Basically, what was happening was that a helper method of ours was selecting the present date and time to input into our form, it was looking for '01' for the date because it was the 1st, but our form deletes leading zeros, so the correct option should have been '1'.
It took some debugging with `launchy' to finally figure that out, and boy did I feel dumb after that! It was pretty funny and I'm sure the guys and gals at Makers will get a real good laugh out of it in the morning.
I also had to use this strftime picker to get the correct expression. So, ultimately there was a bug in our testing procedure that we hadn't picked up because the dates we were testing on were double digits. I definitely feel much better prepared for a similar error in future.
Our final helper method for selecting date and time:
def select_date_and_time(date)
select date.strftime('%Y'), :from => "post_day_1i" #year
select date.strftime('%B'), :from => "post_day_2i" #month
select date.strftime('%k'), :from => "post_day_3i" #day
select date.strftime('%H'), :from => "post_time_4i" #hour
select date.strftime('%M'), :from => "post_time_5i" #minute
end