public
Rubygem
Description: Merb Core: All you need. None you don't.
Homepage: http://www.merbivore.com
Clone URL: git://github.com/wycats/merb-core.git
Added spec for the route matcher testing regexp routes. [#386]
benburkert (author)
Fri Jun 27 16:16:40 -0700 2008
commit  38f1b58fc2a0c9be3b21ccb5da03f38d4c9166a9
tree    db483b9d5b9282be24366f8ccea75b0b8846513f
parent  1fed4e5b1c95b145e9e30d2679417348678adda5
...
4
5
6
7
 
8
9
10
...
21
22
23
 
24
25
26
...
35
36
37
 
38
39
 
 
 
 
 
 
 
 
 
40
41
42
...
4
5
6
 
7
8
9
10
...
21
22
23
24
25
26
27
...
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
0
@@ -4,7 +4,7 @@ Merb.start :environment => 'test', :log_level => :fatal
0
 
0
 class TestController < Merb::Controller
0
   def get(id = nil); end
0
- def post; end
0
+ def post(version = nil); end
0
 end
0
 
0
 class IDish
0
@@ -21,6 +21,7 @@ describe Merb::Test::Rspec::RouteMatchers do
0
 
0
   before(:each) do
0
     Merb::Router.prepare do |r|
0
+ r.match(%r"/v(\d+\.\d+)", :method => :post).to(:controller => "test_controller", :action => "post", :version => "[1]")
0
       r.match("/", :method => :get).to(:controller => "test_controller", :action => "get").name(:getter)
0
       r.match("/", :method => :post).to(:controller => "test_controller", :action => "post")
0
       r.match("/:id").to(:controller => "test_controller", :action => "get").name(:with_id)
0
@@ -35,8 +36,18 @@ describe Merb::Test::Rspec::RouteMatchers do
0
 
0
     it "should work with the url helper and ParamMatcher" do
0
       idish = IDish.new(rand(1000).to_s)
0
+
0
       request_to(url(:with_id, idish)).should route_to(TestController, :get).with(idish)
0
     end
0
+
0
+ it "should work with a negative ParamMatcher" do
0
+ request_to(url(:with_id, :id => 100)).should_not route_to(TestController, :get).with(:id => 1)
0
+ end
0
+
0
+ it "should work with a route containing a regexp" do
0
+ request_to("/v1.2", :post).should route_to(TestController, :post).with(:version => "1.2")
0
+ request_to("/v1.0", :post).should_not route_to(TestController, :post).with(:version => "3.14")
0
+ end
0
   end
0
 
0
   module Merb::Test::Rspec::RouteMatchers

Comments

    No one has commented yet.