Fixes so that the timezone gets written when it explicit is specificied in a test

This commit is contained in:
John Piasetzki 2013-05-18 10:14:00 -04:00
parent 6936bbded8
commit c4750cf48f
1 changed files with 9 additions and 6 deletions

View File

@ -62,14 +62,17 @@ Given /^I have the following (draft|post)s?(?: (.*) "(.*)")?:$/ do |status, dire
if "draft" == status if "draft" == status
path = File.join(before || '.', '_drafts', after || '.', "#{title}.#{ext}") path = File.join(before || '.', '_drafts', after || '.', "#{title}.#{ext}")
else else
format = if has_time_component?(post['date']) if has_time_component?(post['date'])
'%Y-%m-%d %H:%M %z' format = '%Y-%m-%d %H:%M %z'
parsed_date = DateTime.strptime(post['date'], format)
post['date'] = parsed_date.to_s
date = parsed_date.strftime('%Y-%m-%d')
else else
'%m/%d/%Y' # why even format = '%m/%d/%Y' # why even
parsed_date = DateTime.strptime(post['date'], format)
post['date'] = parsed_date.strftime('%Y-%m-%d %H:%M')
date = parsed_date.strftime('%Y-%m-%d')
end end
parsed_date = DateTime.strptime(post['date'], format)
post['date'] = parsed_date.strftime('%Y-%m-%d %H:%M')
date = parsed_date.strftime('%Y-%m-%d')
path = File.join(before || '.', '_posts', after || '.', "#{date}-#{title}.#{ext}") path = File.join(before || '.', '_posts', after || '.', "#{date}-#{title}.#{ext}")
end end