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
|
Then the _site directory should exist
|
||||||
And I should see "Whatever" in "_site/index.html"
|
And I should see "Whatever" in "_site/index.html"
|
||||||
And I should see "this is a test" in "_site/test.txt"
|
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
|
run_jekyll
|
||||||
end
|
end
|
||||||
|
|
||||||
|
When /^I run jekyll in safe mode$/ do
|
||||||
|
run_jekyll(:safe => true)
|
||||||
|
end
|
||||||
|
|
||||||
When /^I run jekyll with drafts$/ do
|
When /^I run jekyll with drafts$/ do
|
||||||
run_jekyll(:drafts => true)
|
run_jekyll(:drafts => true)
|
||||||
end
|
end
|
||||||
|
|
|
@ -15,6 +15,7 @@ def run_jekyll(opts = {})
|
||||||
command = JEKYLL_PATH.clone
|
command = JEKYLL_PATH.clone
|
||||||
command << " build"
|
command << " build"
|
||||||
command << " --drafts" if opts[:drafts]
|
command << " --drafts" if opts[:drafts]
|
||||||
|
command << " --safe" if opts[:safe]
|
||||||
command << " >> /dev/null 2>&1" if opts[:debug].nil?
|
command << " >> /dev/null 2>&1" if opts[:debug].nil?
|
||||||
system command
|
system command
|
||||||
end
|
end
|
||||||
|
|
Loading…
Reference in New Issue