merb 0.0.1 → 0.0.2
Sign up to get free protection for your applications and to get access to all the features.
- data/Rakefile +1 -1
- data/doc/rdoc/classes/Merb.html +128 -0
- data/doc/rdoc/classes/Merb/Config.html +159 -0
- data/doc/rdoc/created.rid +1 -0
- data/doc/rdoc/files/LICENSE.html +129 -0
- data/doc/rdoc/files/README.html +297 -0
- data/doc/rdoc/files/lib/merb_config_rb.html +101 -0
- data/doc/rdoc/files/lib/merb_rb.html +113 -0
- data/doc/rdoc/files/server_rb.html +122 -0
- data/doc/rdoc/fr_class_index.html +28 -0
- data/doc/rdoc/fr_file_index.html +31 -0
- data/doc/rdoc/fr_method_index.html +27 -0
- data/doc/rdoc/index.html +24 -0
- data/doc/rdoc/rdoc-style.css +208 -0
- data/examples/sample_app/app/controllers/noroutefound.rb +4 -0
- data/examples/sample_app/app/controllers/posts.rb +27 -0
- data/examples/sample_app/app/models/post.rb +2 -0
- data/examples/sample_app/app/views/posts/list.rhtml +13 -0
- data/examples/sample_app/app/views/posts/new.rhtml +36 -0
- data/examples/sample_app/app/views/posts/show.rhtml +12 -0
- data/examples/sample_app/conf/merb_init.rb +12 -1
- data/examples/sample_app/conf/router.rb +8 -2
- data/lib/merb.rb +1 -1
- data/lib/merb/merb_controller.rb +1 -3
- data/lib/merb/merb_handler.rb +43 -13
- data/test/unit/route_matcher_test.rb +16 -11
- metadata +27 -2
@@ -1,8 +1,13 @@
|
|
1
1
|
require File.dirname(__FILE__) + '/../test_helper'
|
2
2
|
require File.dirname(__FILE__) + '/../../lib/merb'
|
3
|
-
|
3
|
+
require 'set'
|
4
4
|
class RouteMatcherTest < Test::Unit::TestCase
|
5
5
|
|
6
|
+
def assert_same_hash(hsh1, hsh2)
|
7
|
+
assert_equal hsh1.keys.map(&:to_s).sort_by{|k| k}, hsh2.keys.map(&:to_s).sort_by{|k| k}
|
8
|
+
assert_equal hsh1.values.map(&:to_s).sort_by{|k| k}, hsh2.values.map(&:to_s).sort_by{|k| k}
|
9
|
+
end
|
10
|
+
|
6
11
|
def setup
|
7
12
|
Merb::RouteMatcher.prepare do |r|
|
8
13
|
r.add '/foo/:bar/baz/:id', :class => 'Test', :method => 'foo'
|
@@ -25,28 +30,28 @@ class RouteMatcherTest < Test::Unit::TestCase
|
|
25
30
|
|
26
31
|
def test_route_matching
|
27
32
|
routes = Merb::RouteMatcher.new
|
28
|
-
|
33
|
+
assert_same_hash( {:class=>"Test", :id =>"456", :bar =>"123", :method=>"foo"}, routes.route_request("/foo/123/baz/456"))
|
29
34
|
routes = Merb::RouteMatcher.new
|
30
|
-
|
35
|
+
assert_same_hash( {:class=>"Test", :guys =>"girls", :there =>"jon", :method=>"hello"}, routes.route_request( "/hey/jon/you/girls"))
|
31
36
|
routes = Merb::RouteMatcher.new
|
32
|
-
|
37
|
+
assert_same_hash({:class=>"upload", :id=>"12", :method=>"test"},routes.route_request( "/upload/test/12"))
|
33
38
|
routes = Merb::RouteMatcher.new
|
34
|
-
|
39
|
+
assert_same_hash({:class=>"nik", :method=>"nak"},routes.route_request( "/nik/nak"))
|
35
40
|
routes = Merb::RouteMatcher.new
|
36
|
-
|
41
|
+
assert_same_hash({:class=>"lots", :method=>"of", :id => "12"},routes.route_request( "/lots/of/12"))
|
37
42
|
routes = Merb::RouteMatcher.new
|
38
|
-
|
43
|
+
assert_same_hash({:class => 'NoRouteFound', :method => 'noroute'},routes.route_request( "/"))
|
39
44
|
routes = Merb::RouteMatcher.new
|
40
|
-
|
45
|
+
assert_same_hash({:class => 'NoRouteFound', :method => 'noroute'},routes.route_request( "/dfnasfnafn"))
|
41
46
|
routes = Merb::RouteMatcher.new
|
42
|
-
|
47
|
+
assert_same_hash( {:class=>"Upload", :routes=>"234", :sweet=>"yup", :method=>"start"}, routes.route_request( "/these/234/are/yup"))
|
43
48
|
routes = Merb::RouteMatcher.new
|
44
|
-
|
49
|
+
assert_same_hash( {:class=>"Test", :a=>"12", :c=>"red", :id=>"12", :f=>"blue"}, routes.route_request( '/h/12/b/red/d/blue/g/12'))
|
45
50
|
end
|
46
51
|
|
47
52
|
def test_route_doesnt_match
|
48
53
|
routes = Merb::RouteMatcher.new
|
49
|
-
|
54
|
+
assert_same_hash({:class=>"NoRouteFound", :method=>"noroute"},routes.route_request( '/hdsfvsdfsdfdsf'))
|
50
55
|
end
|
51
56
|
|
52
57
|
def test_regexes_included_in_compiled_statement
|
metadata
CHANGED
@@ -3,8 +3,8 @@ rubygems_version: 0.9.0
|
|
3
3
|
specification_version: 1
|
4
4
|
name: merb
|
5
5
|
version: !ruby/object:Gem::Version
|
6
|
-
version: 0.0.
|
7
|
-
date: 2006-10-
|
6
|
+
version: 0.0.2
|
7
|
+
date: 2006-10-16 00:00:00 -07:00
|
8
8
|
summary: Merb == Mongrel + Erb. Pocket rocket web framework.
|
9
9
|
require_paths:
|
10
10
|
- lib
|
@@ -34,6 +34,24 @@ files:
|
|
34
34
|
- Rakefile
|
35
35
|
- server.rb
|
36
36
|
- bin/merb
|
37
|
+
- doc/rdoc
|
38
|
+
- doc/rdoc/classes
|
39
|
+
- doc/rdoc/created.rid
|
40
|
+
- doc/rdoc/files
|
41
|
+
- doc/rdoc/fr_class_index.html
|
42
|
+
- doc/rdoc/fr_file_index.html
|
43
|
+
- doc/rdoc/fr_method_index.html
|
44
|
+
- doc/rdoc/index.html
|
45
|
+
- doc/rdoc/rdoc-style.css
|
46
|
+
- doc/rdoc/classes/Merb
|
47
|
+
- doc/rdoc/classes/Merb.html
|
48
|
+
- doc/rdoc/classes/Merb/Config.html
|
49
|
+
- doc/rdoc/files/lib
|
50
|
+
- doc/rdoc/files/LICENSE.html
|
51
|
+
- doc/rdoc/files/README.html
|
52
|
+
- doc/rdoc/files/server_rb.html
|
53
|
+
- doc/rdoc/files/lib/merb_config_rb.html
|
54
|
+
- doc/rdoc/files/lib/merb_rb.html
|
37
55
|
- test/test_helper.rb
|
38
56
|
- test/unit
|
39
57
|
- test/unit/route_matcher_test.rb
|
@@ -52,12 +70,19 @@ files:
|
|
52
70
|
- examples/sample_app/log
|
53
71
|
- examples/sample_app/public
|
54
72
|
- examples/sample_app/app/controllers
|
73
|
+
- examples/sample_app/app/models
|
55
74
|
- examples/sample_app/app/views
|
56
75
|
- examples/sample_app/app/controllers/noroutefound.rb
|
76
|
+
- examples/sample_app/app/controllers/posts.rb
|
57
77
|
- examples/sample_app/app/controllers/test.rb
|
58
78
|
- examples/sample_app/app/controllers/upload.rb
|
79
|
+
- examples/sample_app/app/models/post.rb
|
80
|
+
- examples/sample_app/app/views/posts
|
59
81
|
- examples/sample_app/app/views/test
|
60
82
|
- examples/sample_app/app/views/upload
|
83
|
+
- examples/sample_app/app/views/posts/list.rhtml
|
84
|
+
- examples/sample_app/app/views/posts/new.rhtml
|
85
|
+
- examples/sample_app/app/views/posts/show.rhtml
|
61
86
|
- examples/sample_app/app/views/test/foo.rhtml
|
62
87
|
- examples/sample_app/app/views/test/hello.rhtml
|
63
88
|
- examples/sample_app/app/views/upload/start.rhtml
|