joshbuddy-usher 0.4.6 → 0.4.7

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
data/VERSION.yml CHANGED
@@ -1,4 +1,4 @@
1
1
  ---
2
- :patch: 6
3
- :major: 0
4
2
  :minor: 4
3
+ :patch: 7
4
+ :major: 0
data/lib/usher/node.rb CHANGED
@@ -1,6 +1,6 @@
1
1
  $:.unshift File.dirname(__FILE__)
2
2
 
3
- require '/Users/josh/Development/fuzzy_hash/lib/fuzzy_hash'
3
+ require 'fuzzy_hash'
4
4
 
5
5
  class Usher
6
6
 
@@ -19,13 +19,13 @@ describe "Usher route recognition" do
19
19
  it "should recognize a specific domain name" do
20
20
  target_route = route_set.add_route('/sample', :controller => 'sample', :action => 'action', :conditions => {:protocol => 'http'})
21
21
  route_set.add_route('/sample', :controller => 'sample', :action => 'action2', :conditions => {:protocol => 'https'})
22
- target_route.paths.include?(route_set.recognize(build_request({:method => 'get', :path => '/sample', :protocol => 'http'})).first).should == true
22
+ route_set.recognize(build_request({:method => 'get', :path => '/sample', :protocol => 'http'})).path.route.should == target_route
23
23
  end
24
24
 
25
25
  it "should recognize a regex domain name" do
26
26
  target_route = route_set.add_route('/sample', :controller => 'sample', :action => 'action', :conditions => {:domain => /^admin.*$/})
27
27
  route_set.add_route('/sample', :controller => 'sample', :action => 'action2', :conditions => {:domain => 'www.host.com'})
28
- target_route.paths.include?(route_set.recognize(build_request({:method => 'get', :path => '/sample', :domain => 'admin.host.com'})).first).should == true
28
+ route_set.recognize(build_request({:method => 'get', :path => '/sample', :domain => 'admin.host.com'})).path.route.should == target_route
29
29
  end
30
30
 
31
31
  it "should recognize a format-style variable" do
@@ -122,17 +122,17 @@ describe "Usher route recognition" do
122
122
  target_route_http_www = route_set.add_route('/sample', :controller => 'sample', :action => 'action', :conditions => {:protocol => 'http', :domain => 'www.spec.com'})
123
123
  target_route_https_msie = route_set.add_route('/sample', :controller => 'sample', :action => 'action2', :conditions => {:protocol => 'https', :user_agent => 'MSIE 6.0'})
124
124
  target_route_https_admin = route_set.add_route('/sample', :controller => 'sample', :action => 'action2', :conditions => {:protocol => 'https', :domain => 'admin.spec.com'})
125
- target_route_http_admin.paths.include?(route_set.recognize(build_request({:method => 'get', :path => '/sample', :protocol => 'http', :domain => 'admin.spec.com', :user_agent => nil})).first).should == true
126
- target_route_http_www.paths.include?(route_set.recognize(build_request({:method => 'get', :path => '/sample', :protocol => 'http', :domain => 'www.spec.com', :user_agent => nil})).first).should == true
127
- target_route_https_msie.paths.include?(route_set.recognize(build_request({:method => 'get', :path => '/sample', :protocol => 'https', :domain => 'admin.spec.com', :user_agent => 'MSIE 6.0'})).first).should == true
128
- target_route_https_admin.paths.include?(route_set.recognize(build_request({:method => 'get', :path => '/sample', :protocol => 'https', :domain => 'admin.spec.com', :user_agent => nil})).first).should == true
125
+ route_set.recognize(build_request({:method => 'get', :path => '/sample', :protocol => 'http', :domain => 'admin.spec.com', :user_agent => nil})).path.route.should == target_route_http_admin
126
+ route_set.recognize(build_request({:method => 'get', :path => '/sample', :protocol => 'http', :domain => 'www.spec.com', :user_agent => nil})).path.route.should == target_route_http_www
127
+ route_set.recognize(build_request({:method => 'get', :path => '/sample', :protocol => 'https', :domain => 'admin.spec.com', :user_agent => 'MSIE 6.0'})).path.route.should == target_route_https_msie
128
+ route_set.recognize(build_request({:method => 'get', :path => '/sample', :protocol => 'https', :domain => 'admin.spec.com', :user_agent => nil})).path.route.should == target_route_https_admin
129
129
  end
130
130
 
131
131
  it "should correctly fix that tree if conditionals are used later" do
132
132
  noop_route = route_set.add_route('/noop', :controller => 'products', :action => 'noop')
133
133
  product_show_route = route_set.add_route('/products/show/:id', :id => /\d+/, :conditions => {:method => 'get'})
134
- noop_route.paths.include?(route_set.recognize(build_request({:method => 'get', :path => '/noop', :domain => 'admin.host.com'})).first).should == true
135
- product_show_route.paths.include?(route_set.recognize(build_request({:method => 'get', :path => '/products/show/123', :domain => 'admin.host.com'})).first).should == true
134
+ route_set.recognize(build_request({:method => 'get', :path => '/noop', :domain => 'admin.host.com'})).path.route.should == noop_route
135
+ route_set.recognize(build_request({:method => 'get', :path => '/products/show/123', :domain => 'admin.host.com'})).path.route.should == product_show_route
136
136
  end
137
137
 
138
138
  it "should use conditionals that are boolean" do
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: joshbuddy-usher
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.4.6
4
+ version: 0.4.7
5
5
  platform: ruby
6
6
  authors:
7
7
  - Joshua Hull
@@ -9,7 +9,7 @@ autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
11
 
12
- date: 2009-06-09 00:00:00 -07:00
12
+ date: 2009-06-12 00:00:00 -07:00
13
13
  default_executable:
14
14
  dependencies:
15
15
  - !ruby/object:Gem::Dependency
@@ -33,47 +33,38 @@ extra_rdoc_files:
33
33
  files:
34
34
  - History.txt
35
35
  - Manifest.txt
36
- - Rakefile
37
36
  - README.rdoc
37
+ - Rakefile
38
38
  - VERSION.yml
39
- - lib/usher
39
+ - lib/usher.rb
40
40
  - lib/usher/exceptions.rb
41
41
  - lib/usher/generate.rb
42
42
  - lib/usher/grapher.rb
43
- - lib/usher/interface
43
+ - lib/usher/interface.rb
44
44
  - lib/usher/interface/email_interface.rb
45
45
  - lib/usher/interface/merb_interface.rb
46
- - lib/usher/interface/rack_interface
46
+ - lib/usher/interface/rack_interface.rb
47
47
  - lib/usher/interface/rack_interface/mapper.rb
48
48
  - lib/usher/interface/rack_interface/route.rb
49
- - lib/usher/interface/rack_interface.rb
50
- - lib/usher/interface/rails2_2_interface
51
- - lib/usher/interface/rails2_2_interface/mapper.rb
52
49
  - lib/usher/interface/rails2_2_interface.rb
50
+ - lib/usher/interface/rails2_2_interface/mapper.rb
53
51
  - lib/usher/interface/rails2_3_interface.rb
54
- - lib/usher/interface.rb
55
52
  - lib/usher/node.rb
56
- - lib/usher/route
53
+ - lib/usher/route.rb
57
54
  - lib/usher/route/path.rb
58
55
  - lib/usher/route/request_method.rb
59
56
  - lib/usher/route/variable.rb
60
- - lib/usher/route.rb
61
57
  - lib/usher/splitter.rb
62
- - lib/usher.rb
63
- - spec/private
64
- - spec/private/email
58
+ - rails/init.rb
65
59
  - spec/private/email/recognize_spec.rb
66
60
  - spec/private/generate_spec.rb
67
61
  - spec/private/grapher_spec.rb
68
62
  - spec/private/path_spec.rb
69
- - spec/private/rack
70
63
  - spec/private/rack/dispatch_spec.rb
71
- - spec/private/rails2_2
72
64
  - spec/private/rails2_2/compat.rb
73
65
  - spec/private/rails2_2/generate_spec.rb
74
66
  - spec/private/rails2_2/path_spec.rb
75
67
  - spec/private/rails2_2/recognize_spec.rb
76
- - spec/private/rails2_3
77
68
  - spec/private/rails2_3/compat.rb
78
69
  - spec/private/rails2_3/generate_spec.rb
79
70
  - spec/private/rails2_3/path_spec.rb
@@ -82,12 +73,10 @@ files:
82
73
  - spec/private/request_method_spec.rb
83
74
  - spec/private/split_spec.rb
84
75
  - spec/spec.opts
85
- - rails/init.rb
86
76
  has_rdoc: true
87
77
  homepage: http://github.com/joshbuddy/usher
88
78
  post_install_message:
89
79
  rdoc_options:
90
- - --inline-source
91
80
  - --charset=UTF-8
92
81
  require_paths:
93
82
  - lib
@@ -110,5 +99,20 @@ rubygems_version: 1.2.0
110
99
  signing_key:
111
100
  specification_version: 2
112
101
  summary: A general purpose routing library
113
- test_files: []
114
-
102
+ test_files:
103
+ - spec/private/email/recognize_spec.rb
104
+ - spec/private/generate_spec.rb
105
+ - spec/private/grapher_spec.rb
106
+ - spec/private/path_spec.rb
107
+ - spec/private/rack/dispatch_spec.rb
108
+ - spec/private/rails2_2/compat.rb
109
+ - spec/private/rails2_2/generate_spec.rb
110
+ - spec/private/rails2_2/path_spec.rb
111
+ - spec/private/rails2_2/recognize_spec.rb
112
+ - spec/private/rails2_3/compat.rb
113
+ - spec/private/rails2_3/generate_spec.rb
114
+ - spec/private/rails2_3/path_spec.rb
115
+ - spec/private/rails2_3/recognize_spec.rb
116
+ - spec/private/recognize_spec.rb
117
+ - spec/private/request_method_spec.rb
118
+ - spec/private/split_spec.rb