better support for to dash
This commit is contained in:
parent
70edad9be0
commit
cc30030c08
@ -1,7 +1,7 @@
|
||||
PATH
|
||||
remote: .
|
||||
specs:
|
||||
apache-config-generator (0.2.7)
|
||||
apache-config-generator (0.2.8)
|
||||
rainbow
|
||||
|
||||
GEM
|
||||
|
@ -216,7 +216,6 @@ module Apache
|
||||
|
||||
def from_tester(from, opts)
|
||||
from = test(from, opts)
|
||||
from = @from if (@to == '-')
|
||||
from = :http_forbidden if (forbidden?)
|
||||
from
|
||||
end
|
||||
@ -284,7 +283,9 @@ module Apache
|
||||
result = from
|
||||
|
||||
if match?(from, opts)
|
||||
result = super(from, opts) if !(@to == '-')
|
||||
if !(@to == '-')
|
||||
result = super(from, opts)
|
||||
end
|
||||
end
|
||||
|
||||
result.replace_placeholderize(opts)
|
||||
|
@ -97,6 +97,7 @@ describe Apache::RewriteRule, "a RewriteRule" do
|
||||
end
|
||||
|
||||
context 'dash' do
|
||||
context 'no conditions' do
|
||||
subject {
|
||||
rule = Apache::RewriteRule.new
|
||||
rule.rule(%r{^/test$}, '-', :last => true)
|
||||
@ -105,6 +106,25 @@ describe Apache::RewriteRule, "a RewriteRule" do
|
||||
|
||||
it "should succeed and return itself" do
|
||||
subject.test('/test').should == '/test'
|
||||
subject.test('/fail').should == '/fail'
|
||||
end
|
||||
end
|
||||
|
||||
context 'conditions' do
|
||||
subject do
|
||||
rule = Apache::RewriteRule.new
|
||||
rule.cond('/%{REQUEST_FILENAME}', '^/test$')
|
||||
rule.rule(%r{^/test$}, '-', :last => true)
|
||||
rule
|
||||
end
|
||||
|
||||
it "should fail" do
|
||||
subject.test('/test', :request_filename => 'cats').should == '/test'
|
||||
end
|
||||
|
||||
it "should succeed" do
|
||||
subject.test('/test', :request_filename => 'test').should == '/test'
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
Loading…
Reference in New Issue
Block a user