Merge pull request #5961 from ashmaroli/cucumber-win-fix
Merge pull request 5961
This commit is contained in:
commit
e5317ced15
|
@ -174,10 +174,12 @@ Feature: Site configuration
|
||||||
Then I should get a zero exit status
|
Then I should get a zero exit status
|
||||||
And the _site directory should exist
|
And the _site directory should exist
|
||||||
And I should see "Page Layout: 2" in "_site/index.html"
|
And I should see "Page Layout: 2" in "_site/index.html"
|
||||||
And I should see "Post Layout: <p>content for entry1.</p>\n built at 2013-04-09T23:22:00-04:00" in "_site/2013/04/09/entry1.html" unless Windows
|
And I should see "Post Layout: <p>content for entry1.</p>\n built at" in "_site/2013/04/09/entry1.html"
|
||||||
And I should see "Post Layout: <p>content for entry1.</p>\n built at 2013-04-09T22:22:00-05:00" in "_site/2013/04/09/entry1.html" if on Windows
|
And I should see "Post Layout: <p>content for entry2.</p>\n built at" in "_site/2013/04/10/entry2.html"
|
||||||
And I should see "Post Layout: <p>content for entry2.</p>\n built at 2013-04-10T03:14:00-04:00" in "_site/2013/04/10/entry2.html" unless Windows
|
And I should see date "2013-04-09T23:22:00-04:00" in "_site/2013/04/09/entry1.html" unless Windows
|
||||||
And I should see "Post Layout: <p>content for entry2.</p>\n built at 2013-04-10T02:14:00-05:00" in "_site/2013/04/10/entry2.html" if on Windows
|
And I should see date "2013-04-09T22:22:00-05:00" in "_site/2013/04/09/entry1.html" if on Windows
|
||||||
|
And I should see date "2013-04-10T03:14:00-04:00" in "_site/2013/04/10/entry2.html" unless Windows
|
||||||
|
And I should see date "2013-04-10T02:14:00-05:00" in "_site/2013/04/10/entry2.html" if on Windows
|
||||||
|
|
||||||
Scenario: Generate proper dates with explicitly set timezone (different than posts' time)
|
Scenario: Generate proper dates with explicitly set timezone (different than posts' time)
|
||||||
Given I have a _layouts directory
|
Given I have a _layouts directory
|
||||||
|
|
|
@ -246,6 +246,30 @@ end
|
||||||
|
|
||||||
#
|
#
|
||||||
|
|
||||||
|
Then(%r!^I should see date "(.*)" in "(.*)" unless Windows$!) do |text, file|
|
||||||
|
step %(the "#{file}" file should exist)
|
||||||
|
regexp = Regexp.new(text)
|
||||||
|
if Jekyll::Utils::Platforms.really_windows? && !dst_active?
|
||||||
|
expect(file_contents(file)).not_to match regexp
|
||||||
|
else
|
||||||
|
expect(file_contents(file)).to match regexp
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
#
|
||||||
|
|
||||||
|
Then(%r!^I should see date "(.*)" in "(.*)" if on Windows$!) do |text, file|
|
||||||
|
step %(the "#{file}" file should exist)
|
||||||
|
regexp = Regexp.new(text)
|
||||||
|
if Jekyll::Utils::Platforms.really_windows? && !dst_active?
|
||||||
|
expect(file_contents(file)).to match regexp
|
||||||
|
else
|
||||||
|
expect(file_contents(file)).not_to match regexp
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
#
|
||||||
|
|
||||||
Then(%r!^I should see exactly "(.*)" in "(.*)"$!) do |text, file|
|
Then(%r!^I should see exactly "(.*)" in "(.*)"$!) do |text, file|
|
||||||
step %(the "#{file}" file should exist)
|
step %(the "#{file}" file should exist)
|
||||||
expect(file_contents(file).strip).to eq text
|
expect(file_contents(file).strip).to eq text
|
||||||
|
|
|
@ -163,3 +163,14 @@ def seconds_agnostic_time(time)
|
||||||
hour, minutes, = time.split(":")
|
hour, minutes, = time.split(":")
|
||||||
"#{hour}:#{minutes}"
|
"#{hour}:#{minutes}"
|
||||||
end
|
end
|
||||||
|
|
||||||
|
# Helper method for Windows
|
||||||
|
def dst_active?
|
||||||
|
config = Jekyll.configuration("quiet" => true)
|
||||||
|
ENV["TZ"] = config["timezone"]
|
||||||
|
dst = Time.now.isdst
|
||||||
|
|
||||||
|
# reset variable to default state on Windows
|
||||||
|
ENV["TZ"] = nil
|
||||||
|
dst
|
||||||
|
end
|
||||||
|
|
Loading…
Reference in New Issue