usher 0.8.2 → 0.8.3
Sign up to get free protection for your applications and to get access to all the features.
- data/lib/usher/route.rb +2 -1
- data/spec/private/generate_spec.rb +5 -0
- data/usher.gemspec +1 -1
- metadata +3 -3
data/lib/usher/route.rb
CHANGED
@@ -83,7 +83,8 @@ class Usher
|
|
83
83
|
end
|
84
84
|
|
85
85
|
def find_matching_path(params)
|
86
|
-
|
86
|
+
significant_param_keys = (params && params.is_a?(Hash)) ? (params.keys & grapher.significant_keys) : nil
|
87
|
+
matching_path = if significant_param_keys.nil? || significant_param_keys.empty?
|
87
88
|
@paths.first
|
88
89
|
else
|
89
90
|
@paths.size == 1 ? @paths.first : grapher.find_matching_path(params)
|
@@ -19,6 +19,11 @@ describe "Usher URL generation" do
|
|
19
19
|
@route_set.generator.generate(:sample, {:action => 'action'}).should == '/sample/action'
|
20
20
|
end
|
21
21
|
|
22
|
+
it "should generate a simple URL and ignore the optional part" do
|
23
|
+
@route_set.add_named_route(:test, '/test1/url2(.:format)')
|
24
|
+
@route_set.generator.generate(:test, {:foo => 'baz'}).should == '/test1/url2?foo=baz'
|
25
|
+
end
|
26
|
+
|
22
27
|
it "should generate a simple URL with a single variable (and escape)" do
|
23
28
|
@route_set.add_named_route(:sample, '/sample/:action', :controller => 'sample')
|
24
29
|
@route_set.generator.generate(:sample, {:action => 'action time'}).should == '/sample/action%20time'
|
data/usher.gemspec
CHANGED
@@ -5,7 +5,7 @@ require "base64"
|
|
5
5
|
|
6
6
|
Gem::Specification.new do |s|
|
7
7
|
s.name = "usher"
|
8
|
-
s.version = "0.8.
|
8
|
+
s.version = "0.8.3"
|
9
9
|
s.authors = ["Daniel Neighman", "Daniel Vartanov", "Jakub Šťastný", "Joshua Hull", "Davide D'Agostino"].sort
|
10
10
|
s.homepage = "http://github.com/joshbuddy/usher"
|
11
11
|
s.summary = "Pure ruby general purpose router with interfaces for rails, rack, email or choose your own adventure"
|
metadata
CHANGED
@@ -5,8 +5,8 @@ version: !ruby/object:Gem::Version
|
|
5
5
|
segments:
|
6
6
|
- 0
|
7
7
|
- 8
|
8
|
-
-
|
9
|
-
version: 0.8.
|
8
|
+
- 3
|
9
|
+
version: 0.8.3
|
10
10
|
platform: ruby
|
11
11
|
authors:
|
12
12
|
- Daniel Neighman
|
@@ -19,7 +19,7 @@ authors:
|
|
19
19
|
autorequire:
|
20
20
|
bindir: bin
|
21
21
|
cert_chain:
|
22
|
-
date: 2010-05-
|
22
|
+
date: 2010-05-21 00:00:00 -04:00
|
23
23
|
default_executable:
|
24
24
|
dependencies:
|
25
25
|
- !ruby/object:Gem::Dependency
|