Followup to #41, allow those values anyways

This commit is contained in:
Neil Matatall 2013-03-27 10:10:40 -07:00
Родитель 73cac635c3
Коммит d641975eb3
2 изменённых файлов: 13 добавлений и 1 удалений

Просмотреть файл

@ -38,7 +38,7 @@ module SecureHeaders
if !@config[:value]
raise XXssProtectionBuildError.new(":value key is missing")
elsif @config[:value]
unless [0,1].include?(@config[:value])
unless [0,1].include?(@config[:value].to_i)
raise XXssProtectionBuildError.new(":value must be 1 or 0")
end

Просмотреть файл

@ -17,6 +17,18 @@ module SecureHeaders
end
context "when using a hash value" do
it "should allow string values ('1' or '0' are the only valid strings)" do
lambda {
XXssProtection.new(:value => '1')
}.should_not raise_error
end
it "should allow integer values (1 or 0 are the only valid integers)" do
lambda {
XXssProtection.new(:value => 1)
}.should_not raise_error
end
it "should raise an error if no value key is supplied" do
lambda {
XXssProtection.new(:mode => 'block')