1
0
Fork 0
mirror of https://github.com/sinatra/sinatra synced 2023-03-27 23:18:01 -04:00

guard named caputres tests (they only work on Ruby 1.9). fixes #169.

This commit is contained in:
Konstantin Haase 2011-02-17 16:11:31 +01:00
parent 0428794e66
commit e07a6030cc

View file

@ -179,9 +179,10 @@ class RoutingTest < Test::Unit::TestCase
assert_equal "foo=;bar=", body
end
it "supports named captures like %r{/hello/(?<person>[^/?#]+)}" do
it "supports named captures like %r{/hello/(?<person>[^/?#]+)} on Ruby >= 1.9" do
next if RUBY_VERSION < '1.9'
mock_app {
get %r{/hello/(?<person>[^/?#]+)} do
get Regexp.new('/hello/(?<person>[^/?#]+)') do
"Hello #{params['person']}"
end
}
@ -189,9 +190,10 @@ class RoutingTest < Test::Unit::TestCase
assert_equal 'Hello Frank', body
end
it "supports optional named captures like %r{/page(?<format>.[^/?#]+)?}" do
it "supports optional named captures like %r{/page(?<format>.[^/?#]+)?} on Ruby >= 1.9" do
next if RUBY_VERSION < '1.9'
mock_app {
get %r{/page(?<format>.[^/?#]+)?} do
get Regexp.new('/page(?<format>.[^/?#]+)?') do
"format=#{params[:format]}"
end
}