diff --git a/test/source/environment.html b/test/source/environment.html
new file mode 100644
index 00000000..b875a61f
--- /dev/null
+++ b/test/source/environment.html
@@ -0,0 +1,5 @@
+---
+title: I'm a Jekyll environment exchequer
+---
+
+{{ jekyll.environment }}
diff --git a/test/test_filters.rb b/test/test_filters.rb
index e56a88ce..22734378 100644
--- a/test/test_filters.rb
+++ b/test/test_filters.rb
@@ -137,7 +137,7 @@ class TestFilters < Test::Unit::TestCase
assert_equal 2, g["items"].size
when ""
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
diff --git a/test/test_site.rb b/test/test_site.rb
index 94263491..de02b8dd 100644
--- a/test/test_site.rb
+++ b/test/test_site.rb
@@ -166,6 +166,7 @@ class TestSite < Test::Unit::TestCase
coffeescript.coffee
contacts.html
deal.with.dots.html
+ environment.html
exploit.md
foo.md
index.html
@@ -407,5 +408,35 @@ class TestSite < Test::Unit::TestCase
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