sinatra 0.3.0 → 0.3.1

Sign up to get free protection for your applications and to get access to all the features.

Potentially problematic release.


This version of sinatra might be problematic. Click here for more details.

data/ChangeLog CHANGED
@@ -1,3 +1,7 @@
1
+ = 0.3.1
2
+
3
+ * Unbreak optional path parameters [jeremyevans]
4
+
1
5
  = 0.3.0
2
6
 
3
7
  * Add sinatra.gemspec w/ support for github gem builds. Forks can now
@@ -163,7 +163,7 @@ module Sinatra
163
163
  return unless host === request.host
164
164
  end
165
165
  return unless pattern =~ request.path_info.squeeze('/')
166
- path_params = param_keys.zip($~.captures.map{|s| unescape(s)}).to_hash
166
+ path_params = param_keys.zip($~.captures.map{|s| unescape(s) if s}).to_hash
167
167
  params.merge!(path_params)
168
168
  splats = params.select { |k, v| k =~ /^_splat_\d+$/ }.sort.map(&:last)
169
169
  unless splats.empty?
@@ -3,8 +3,8 @@ Gem::Specification.new do |s|
3
3
  s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
4
4
 
5
5
  s.name = 'sinatra'
6
- s.version = '0.3.0'
7
- s.date = "2008-08-31"
6
+ s.version = '0.3.1'
7
+ s.date = "2008-09-08"
8
8
 
9
9
  s.description = "Classy web-development dressed in a DSL"
10
10
  s.summary = "Classy web-development dressed in a DSL"
@@ -33,6 +33,24 @@ context "Simple Events" do
33
33
  result.params.should.equal "foo" => 'a', "bar" => 'blake mizerany'
34
34
  end
35
35
 
36
+ specify "takes optional params in path" do
37
+ result = invoke_simple('/?:foo?/?:bar?', '/a/b')
38
+ result.should.not.be.nil
39
+ result.params.should.equal "foo" => 'a', "bar" => 'b'
40
+
41
+ result = invoke_simple('/?:foo?/?:bar?', '/a/')
42
+ result.should.not.be.nil
43
+ result.params.should.equal "foo" => 'a', "bar" => nil
44
+
45
+ result = invoke_simple('/?:foo?/?:bar?', '/a')
46
+ result.should.not.be.nil
47
+ result.params.should.equal "foo" => 'a', "bar" => nil
48
+
49
+ result = invoke_simple('/:foo?/?:bar?', '/')
50
+ result.should.not.be.nil
51
+ result.params.should.equal "foo" => nil, "bar" => nil
52
+ end
53
+
36
54
  specify "ignores to many /'s" do
37
55
  result = invoke_simple('/x/y', '/x//y')
38
56
  result.should.not.be.nil
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: sinatra
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.3.0
4
+ version: 0.3.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Blake Mizerany
@@ -9,7 +9,7 @@ autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
11
 
12
- date: 2008-08-31 00:00:00 -07:00
12
+ date: 2008-09-08 00:00:00 -07:00
13
13
  default_executable:
14
14
  dependencies:
15
15
  - !ruby/object:Gem::Dependency