Get some nice Regexp which is agnostic about the seconds. #1582

Merged
merged 4 commits into from Oct 24, 2013

Projects

None yet

3 participants

@parkr
Member
parkr commented Sep 27, 2013

Fixes the issue of intermittent failures due to issues with being one second after generation time.

Alternative to #1573

/cc @mattr-

@kelvinst kelvinst and 1 other commented on an outdated diff Sep 27, 2013
features/support/env.rb
@@ -40,5 +40,15 @@ def location(folder, direction)
[before || '.', after || '.']
end
+def seconds_agnostic_time(datetime = Time.now)
+ pieces = datetime.to_s.split(" ")
+ time = "#{pieces[1].split(':').first}:#{pieces[1].split(':')[1]}:\\d{2}"
@kelvinst
kelvinst Sep 27, 2013

I know it's 💅, but what about:

  time_split = pieces[1].split(':')
  time = "#{time_split.first}:#{time_split[1]}:\\d{2}"

If you want to kill me for being so annoying, I understand you. 😘

PS.: The kiss was a joke, don't understand it wrong. 😆

@parkr
parkr Sep 28, 2013 Member

Yes, and more!

@kelvinst

Awesome. Just beautiful ❤️ 💙

@kelvinst kelvinst and 1 other commented on an outdated diff Sep 28, 2013
features/support/env.rb
@@ -40,5 +40,15 @@ def location(folder, direction)
[before || '.', after || '.']
end
+def seconds_agnostic_time(datetime = Time.now)
+ date, time, zone = datetime.strftime("%Y-%m-%d %H:%M:%S %z").split(" ")
@kelvinst
kelvinst Sep 28, 2013

So
I like it, but why get the seconds here to ignore them below?

@parkr
parkr Sep 28, 2013 Member

I have no idea!

@mattr- mattr- added a commit that referenced this pull request Oct 24, 2013
@mattr- mattr- Update history to reflect merge of #1582 9b40ae6
@mattr- mattr- merged commit 4258854 into master Oct 24, 2013

1 check passed

default The Travis CI build passed
Details
@parkr parkr deleted the seconds_agnostic_time branch Oct 24, 2013
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment