merb 0.0.1 → 0.0.2

Sign up to get free protection for your applications and to get access to all the features.
@@ -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
- assert_equal( {:class=>"Test", :bar=>"123", :id=>"456", :method=>"foo"}, routes.route_request("/foo/123/baz/456"))
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
- assert_equal( {:class=>"Test", :there=>"jon", :guys=>"girls", :method=>"hello"}, routes.route_request( "/hey/jon/you/girls"))
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
- assert_equal({:class=>"upload", :id=>"12", :method=>"test"},routes.route_request( "/upload/test/12"))
37
+ assert_same_hash({:class=>"upload", :id=>"12", :method=>"test"},routes.route_request( "/upload/test/12"))
33
38
  routes = Merb::RouteMatcher.new
34
- assert_equal({:class=>"nik", :method=>"nak"},routes.route_request( "/nik/nak"))
39
+ assert_same_hash({:class=>"nik", :method=>"nak"},routes.route_request( "/nik/nak"))
35
40
  routes = Merb::RouteMatcher.new
36
- assert_equal({:class=>"lots", :method=>"of", :id => "12"},routes.route_request( "/lots/of/12"))
41
+ assert_same_hash({:class=>"lots", :method=>"of", :id => "12"},routes.route_request( "/lots/of/12"))
37
42
  routes = Merb::RouteMatcher.new
38
- assert_equal({:class => 'NoRouteFound', :method => 'noroute'},routes.route_request( "/"))
43
+ assert_same_hash({:class => 'NoRouteFound', :method => 'noroute'},routes.route_request( "/"))
39
44
  routes = Merb::RouteMatcher.new
40
- assert_equal({:class => 'NoRouteFound', :method => 'noroute'},routes.route_request( "/dfnasfnafn"))
45
+ assert_same_hash({:class => 'NoRouteFound', :method => 'noroute'},routes.route_request( "/dfnasfnafn"))
41
46
  routes = Merb::RouteMatcher.new
42
- assert_equal( {:class=>"Upload", :routes=>"234", :sweet=>"yup", :method=>"start"}, routes.route_request( "/these/234/are/yup"))
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
- assert_equal( {:class=>"Test", :a=>"12", :c=>"red", :id=>"12", :f=>"blue"}, routes.route_request( '/h/12/b/red/d/blue/g/12'))
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
- assert_equal({:class=>"NoRouteFound", :method=>"noroute"},routes.route_request( '/hdsfvsdfsdfdsf'))
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.1
7
- date: 2006-10-15 00:00:00 -07:00
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