Add test for Jekyll.env
This commit is contained in:
parent
780cff46b3
commit
3413c96845
|
@ -0,0 +1,5 @@
|
||||||
|
---
|
||||||
|
title: I'm a Jekyll environment exchequer
|
||||||
|
---
|
||||||
|
|
||||||
|
{{ jekyll.environment }}
|
|
@ -137,7 +137,7 @@ class TestFilters < Test::Unit::TestCase
|
||||||
assert_equal 2, g["items"].size
|
assert_equal 2, g["items"].size
|
||||||
when ""
|
when ""
|
||||||
assert g["items"].is_a?(Array), "The list of grouped items for '' is not an Array."
|
assert g["items"].is_a?(Array), "The list of grouped items for '' is not an Array."
|
||||||
assert_equal 10, g["items"].size
|
assert_equal 11, g["items"].size
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
|
@ -166,6 +166,7 @@ class TestSite < Test::Unit::TestCase
|
||||||
coffeescript.coffee
|
coffeescript.coffee
|
||||||
contacts.html
|
contacts.html
|
||||||
deal.with.dots.html
|
deal.with.dots.html
|
||||||
|
environment.html
|
||||||
exploit.md
|
exploit.md
|
||||||
foo.md
|
foo.md
|
||||||
index.html
|
index.html
|
||||||
|
@ -407,5 +408,35 @@ class TestSite < Test::Unit::TestCase
|
||||||
end
|
end
|
||||||
|
|
||||||
end
|
end
|
||||||
|
|
||||||
|
context "manipulating the Jekyll environment" do
|
||||||
|
setup do
|
||||||
|
@site = Site.new(site_configuration)
|
||||||
|
@site.process
|
||||||
|
@page = @site.pages.find { |p| p.name == "environment.html" }
|
||||||
|
end
|
||||||
|
|
||||||
|
should "default to 'development'" do
|
||||||
|
assert_equal "development", @page.content.strip
|
||||||
|
end
|
||||||
|
|
||||||
|
context "in production" do
|
||||||
|
setup do
|
||||||
|
ENV["JEKYLL_ENV"] = "production"
|
||||||
|
@site = Site.new(site_configuration)
|
||||||
|
@site.process
|
||||||
|
@page = @site.pages.find { |p| p.name == "environment.html" }
|
||||||
|
end
|
||||||
|
|
||||||
|
teardown do
|
||||||
|
ENV.delete("JEKYLL_ENV")
|
||||||
|
end
|
||||||
|
|
||||||
|
should "be overridden by JEKYLL_ENV" do
|
||||||
|
assert_equal "production", @page.content.strip
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
Loading…
Reference in New Issue