Always call Time#localtime to translate to TZ'd time.

This commit is contained in:
Parker Moore 2014-12-29 19:15:19 -05:00
parent f66862c508
commit 7bcf8d689e
6 changed files with 23 additions and 7 deletions

View File

@ -180,7 +180,7 @@ Feature: Site configuration
And I have an "index.html" page with layout "page" that contains "site index page" And I have an "index.html" page with layout "page" that contains "site index page"
And I have a configuration file with: And I have a configuration file with:
| key | value | | key | value |
| timezone | Australia/Sydney | | timezone | Australia/Melbourne |
And I have a _posts directory And I have a _posts directory
And I have the following posts: And I have the following posts:
| title | date | layout | content | | title | date | layout | content |

View File

@ -193,7 +193,15 @@ Then /^I should see escaped "(.*)" in "(.*)"$/ do |text, file|
end end
Then /^the "(.*)" file should +exist$/ do |file| Then /^the "(.*)" file should +exist$/ do |file|
assert File.file?(file), "The file \"#{file}\" does not exist" file_does_exist = File.file?(file)
unless file_does_exist
all_steps_to_path(file).each do |dir|
STDERR.puts ""
STDERR.puts "Dir #{dir}:"
STDERR.puts Dir["#{dir}/**/*"]
end
end
assert file_does_exist, "The file \"#{file}\" does not exist.\n"
end end
Then /^the "(.*)" file should not exist$/ do |file| Then /^the "(.*)" file should not exist$/ do |file|

View File

@ -13,6 +13,17 @@ def source_dir(*files)
File.join(TEST_DIR, *files) File.join(TEST_DIR, *files)
end end
def all_steps_to_path(path)
source = Pathname.new(source_dir('_site')).expand_path
dest = Pathname.new(path).expand_path
paths = []
dest.ascend do |f|
break if f.eql? source
paths.unshift f.to_s
end
paths
end
def jekyll_output_file def jekyll_output_file
JEKYLL_COMMAND_OUTPUT_FILE JEKYLL_COMMAND_OUTPUT_FILE
end end

View File

@ -309,7 +309,7 @@ module Jekyll
else else
Jekyll.logger.error "Invalid Date:", "'#{input}' is not a valid datetime." Jekyll.logger.error "Invalid Date:", "'#{input}' is not a valid datetime."
exit(1) exit(1)
end end.localtime
end end
def groupable?(element) def groupable?(element)

View File

@ -90,7 +90,7 @@ module Jekyll
# Returns the parsed date if successful, throws a FatalException # Returns the parsed date if successful, throws a FatalException
# if not # if not
def parse_date(input, msg = "Input could not be parsed.") def parse_date(input, msg = "Input could not be parsed.")
Time.parse(input) Time.parse(input).localtime
rescue ArgumentError rescue ArgumentError
raise Errors::FatalException.new("Invalid date '#{input}': " + msg) raise Errors::FatalException.new("Invalid date '#{input}': " + msg)
end end

View File

@ -1,8 +1,5 @@
#!/bin/bash #!/bin/bash
ls /usr/share/zoneinfo
ls /usr/share/zoneinfo/Australia
time bundle exec cucumber \ time bundle exec cucumber \
-f Features::Support::Overview \ -f Features::Support::Overview \
"$@" "$@"