http_router 0.9.6 → 0.9.7

Sign up to get free protection for your applications and to get access to all the features.
data/lib/http_router.rb CHANGED
@@ -24,6 +24,8 @@ class HttpRouter
24
24
  DoubleCompileError = Class.new(RuntimeError)
25
25
  # Raised an invalid request value is used
26
26
  InvalidRequestValueError = Class.new(RuntimeError)
27
+ # Raised when there are extra parameters passed in to #url
28
+ TooManyParametersException = Class.new(RuntimeError)
27
29
 
28
30
  # Creates a new HttpRouter.
29
31
  # Can be called with either <tt>HttpRouter.new(proc{|env| ... }, { .. options .. })</tt> or with the first argument omitted.
@@ -1,4 +1,4 @@
1
1
  # encoding: utf-8
2
2
  class HttpRouter #:nodoc
3
- VERSION = '0.9.6'
3
+ VERSION = '0.9.7'
4
4
  end
data/test/test_misc.rb CHANGED
@@ -50,7 +50,7 @@ class TestMisc < MiniTest::Unit::TestCase
50
50
  assert_equal '/test/var', r.url(:route, "var")
51
51
  end
52
52
 
53
- def test_regex_generation
53
+ def test_too_many_params
54
54
  r = HttpRouter.new
55
55
  r.add(%r|/test/.*|, :path_for_generation => '/test/:variable').name(:route).default_destination
56
56
  assert_equal '/test/var', r.url(:route, "var")
@@ -58,6 +58,12 @@ class TestMisc < MiniTest::Unit::TestCase
58
58
  assert_raises(HttpRouter::InvalidRouteException) { r.url(:route) }
59
59
  end
60
60
 
61
+ def test_too_many_args
62
+ r = HttpRouter.new
63
+ r.add('/').name(:route).default_destination
64
+ assert_raises(HttpRouter::TooManyParametersException) { r.url(:route, "hi") }
65
+ end
66
+
61
67
  def test_public_interface
62
68
  methods = HttpRouter.public_instance_methods.map(&:to_sym)
63
69
  assert methods.include?(:url_mount)
metadata CHANGED
@@ -1,13 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: http_router
3
3
  version: !ruby/object:Gem::Version
4
- hash: 55
4
+ hash: 53
5
5
  prerelease:
6
6
  segments:
7
7
  - 0
8
8
  - 9
9
- - 6
10
- version: 0.9.6
9
+ - 7
10
+ version: 0.9.7
11
11
  platform: ruby
12
12
  authors:
13
13
  - Joshua Hull
@@ -15,12 +15,13 @@ autorequire:
15
15
  bindir: bin
16
16
  cert_chain: []
17
17
 
18
- date: 2011-08-03 00:00:00 -07:00
18
+ date: 2011-08-09 00:00:00 -07:00
19
19
  default_executable:
20
20
  dependencies:
21
21
  - !ruby/object:Gem::Dependency
22
+ name: rack
22
23
  prerelease: false
23
- version_requirements: &id001 !ruby/object:Gem::Requirement
24
+ requirement: &id001 !ruby/object:Gem::Requirement
24
25
  none: false
25
26
  requirements:
26
27
  - - ">="
@@ -31,12 +32,12 @@ dependencies:
31
32
  - 0
32
33
  - 0
33
34
  version: 1.0.0
34
- requirement: *id001
35
- name: rack
36
35
  type: :runtime
36
+ version_requirements: *id001
37
37
  - !ruby/object:Gem::Dependency
38
+ name: url_mount
38
39
  prerelease: false
39
- version_requirements: &id002 !ruby/object:Gem::Requirement
40
+ requirement: &id002 !ruby/object:Gem::Requirement
40
41
  none: false
41
42
  requirements:
42
43
  - - ~>
@@ -47,12 +48,12 @@ dependencies:
47
48
  - 2
48
49
  - 1
49
50
  version: 0.2.1
50
- requirement: *id002
51
- name: url_mount
52
51
  type: :runtime
52
+ version_requirements: *id002
53
53
  - !ruby/object:Gem::Dependency
54
+ name: minitest
54
55
  prerelease: false
55
- version_requirements: &id003 !ruby/object:Gem::Requirement
56
+ requirement: &id003 !ruby/object:Gem::Requirement
56
57
  none: false
57
58
  requirements:
58
59
  - - ~>
@@ -63,12 +64,12 @@ dependencies:
63
64
  - 0
64
65
  - 0
65
66
  version: 2.0.0
66
- requirement: *id003
67
- name: minitest
68
67
  type: :development
68
+ version_requirements: *id003
69
69
  - !ruby/object:Gem::Dependency
70
+ name: code_stats
70
71
  prerelease: false
71
- version_requirements: &id004 !ruby/object:Gem::Requirement
72
+ requirement: &id004 !ruby/object:Gem::Requirement
72
73
  none: false
73
74
  requirements:
74
75
  - - ">="
@@ -77,12 +78,12 @@ dependencies:
77
78
  segments:
78
79
  - 0
79
80
  version: "0"
80
- requirement: *id004
81
- name: code_stats
82
81
  type: :development
82
+ version_requirements: *id004
83
83
  - !ruby/object:Gem::Dependency
84
+ name: rake
84
85
  prerelease: false
85
- version_requirements: &id005 !ruby/object:Gem::Requirement
86
+ requirement: &id005 !ruby/object:Gem::Requirement
86
87
  none: false
87
88
  requirements:
88
89
  - - ~>
@@ -93,12 +94,12 @@ dependencies:
93
94
  - 8
94
95
  - 7
95
96
  version: 0.8.7
96
- requirement: *id005
97
- name: rake
98
97
  type: :development
98
+ version_requirements: *id005
99
99
  - !ruby/object:Gem::Dependency
100
+ name: rbench
100
101
  prerelease: false
101
- version_requirements: &id006 !ruby/object:Gem::Requirement
102
+ requirement: &id006 !ruby/object:Gem::Requirement
102
103
  none: false
103
104
  requirements:
104
105
  - - ">="
@@ -107,12 +108,12 @@ dependencies:
107
108
  segments:
108
109
  - 0
109
110
  version: "0"
110
- requirement: *id006
111
- name: rbench
112
111
  type: :development
112
+ version_requirements: *id006
113
113
  - !ruby/object:Gem::Dependency
114
+ name: json
114
115
  prerelease: false
115
- version_requirements: &id007 !ruby/object:Gem::Requirement
116
+ requirement: &id007 !ruby/object:Gem::Requirement
116
117
  none: false
117
118
  requirements:
118
119
  - - ">="
@@ -121,12 +122,12 @@ dependencies:
121
122
  segments:
122
123
  - 0
123
124
  version: "0"
124
- requirement: *id007
125
- name: json
126
125
  type: :development
126
+ version_requirements: *id007
127
127
  - !ruby/object:Gem::Dependency
128
+ name: phocus
128
129
  prerelease: false
129
- version_requirements: &id008 !ruby/object:Gem::Requirement
130
+ requirement: &id008 !ruby/object:Gem::Requirement
130
131
  none: false
131
132
  requirements:
132
133
  - - ">="
@@ -135,12 +136,12 @@ dependencies:
135
136
  segments:
136
137
  - 0
137
138
  version: "0"
138
- requirement: *id008
139
- name: phocus
140
139
  type: :development
140
+ version_requirements: *id008
141
141
  - !ruby/object:Gem::Dependency
142
+ name: bundler
142
143
  prerelease: false
143
- version_requirements: &id009 !ruby/object:Gem::Requirement
144
+ requirement: &id009 !ruby/object:Gem::Requirement
144
145
  none: false
145
146
  requirements:
146
147
  - - ~>
@@ -151,12 +152,12 @@ dependencies:
151
152
  - 0
152
153
  - 0
153
154
  version: 1.0.0
154
- requirement: *id009
155
- name: bundler
156
155
  type: :development
156
+ version_requirements: *id009
157
157
  - !ruby/object:Gem::Dependency
158
+ name: thin
158
159
  prerelease: false
159
- version_requirements: &id010 !ruby/object:Gem::Requirement
160
+ requirement: &id010 !ruby/object:Gem::Requirement
160
161
  none: false
161
162
  requirements:
162
163
  - - "="
@@ -167,9 +168,8 @@ dependencies:
167
168
  - 2
168
169
  - 8
169
170
  version: 1.2.8
170
- requirement: *id010
171
- name: thin
172
171
  type: :development
172
+ version_requirements: *id010
173
173
  description: This library allows you to recognize and build URLs in a Rack application.
174
174
  email: joshbuddy@gmail.com
175
175
  executables: []