Add test code for 'whitelist' option.
This commit is contained in:
parent
615d49ed66
commit
6187861e91
|
@ -233,3 +233,26 @@ Feature: Site configuration
|
|||
Then the _site directory should exist
|
||||
And I should see "Whatever" in "_site/index.html"
|
||||
And I should see "this is a test" in "_site/test.txt"
|
||||
|
||||
Scenario: Add an empty whitelist to restrict all gems
|
||||
Given I have an "index.html" file that contains "Whatever"
|
||||
And I have a configuration file with:
|
||||
| key | value |
|
||||
| gems | [jekyll_test_plugin] |
|
||||
| whitelist | [] |
|
||||
When I run jekyll in safe mode
|
||||
Then the _site directory should exist
|
||||
And I should see "Whatever" in "_site/index.html"
|
||||
And the "_site/test.txt" file should not exist
|
||||
|
||||
Scenario: Add a whitelist to restrict some gems but allow others
|
||||
Given I have an "index.html" file that contains "Whatever"
|
||||
And I have a configuration file with:
|
||||
| key | value |
|
||||
| gems | [jekyll_test_plugin, jekyll_test_plugin_malicious] |
|
||||
| whitelist | [jekyll_test_plugin] |
|
||||
When I run jekyll in safe mode
|
||||
Then the _site directory should exist
|
||||
And I should see "Whatever" in "_site/index.html"
|
||||
And the "_site/test.txt" file should exist
|
||||
And I should see "this is a test" in "_site/test.txt"
|
||||
|
|
|
@ -126,6 +126,10 @@ When /^I run jekyll$/ do
|
|||
run_jekyll
|
||||
end
|
||||
|
||||
When /^I run jekyll in safe mode$/ do
|
||||
run_jekyll(:safe => true)
|
||||
end
|
||||
|
||||
When /^I run jekyll with drafts$/ do
|
||||
run_jekyll(:drafts => true)
|
||||
end
|
||||
|
|
|
@ -15,6 +15,7 @@ def run_jekyll(opts = {})
|
|||
command = JEKYLL_PATH.clone
|
||||
command << " build"
|
||||
command << " --drafts" if opts[:drafts]
|
||||
command << " --safe" if opts[:safe]
|
||||
command << " >> /dev/null 2>&1" if opts[:debug].nil?
|
||||
system command
|
||||
end
|
||||
|
@ -50,7 +51,7 @@ def seconds_agnostic_datetime(datetime = Time.now)
|
|||
pieces = datetime.to_s.split(" ")
|
||||
if pieces.size == 6 # Ruby 1.8.7
|
||||
date = pieces[0..2].join(" ")
|
||||
time = seconds_agnostic_time(pieces[3])
|
||||
time = seconds_agnostic_time(pieces[3])
|
||||
zone = pieces[4..5].join(" ")
|
||||
else # Ruby 1.9.1 or greater
|
||||
date, time, zone = pieces
|
||||
|
|
Loading…
Reference in New Issue