| 567 | | end |
|---|
| 568 | | |
|---|
| 569 | | describe Merb::Router, "with resources using a member action" do |
|---|
| | 567 | |
|---|
| | 568 | it "should match GET to /flowers/random" do |
|---|
| | 569 | index, route = Merb::Router.match(SimpleRequest.new(:path => '/flowers/random', :method => :get), {}) |
|---|
| | 570 | route[:controller].should == 'flowers' |
|---|
| | 571 | route[:action].should == 'random' |
|---|
| | 572 | end |
|---|
| | 573 | |
|---|
| | 574 | it "should match GET to /flowers/random.xml" do |
|---|
| | 575 | index, route = Merb::Router.match(SimpleRequest.new(:path => '/flowers/random.xml', :method => :get), {}) |
|---|
| | 576 | route[:controller].should == 'flowers' |
|---|
| | 577 | route[:action].should == 'random' |
|---|
| | 578 | route[:format].should == 'xml' |
|---|
| | 579 | end |
|---|
| | 580 | |
|---|
| | 581 | end |
|---|
| | 582 | |
|---|
| | 583 | describe Merb::Router, "with resources using a member action { :pick => [:get] }" do |
|---|
| | 593 | |
|---|
| | 594 | it "should match GET to /flowers/2/pick" do |
|---|
| | 595 | index, route = Merb::Router.match(SimpleRequest.new(:path => '/flowers/2/pick', :method => :get), {}) |
|---|
| | 596 | route[:controller].should == 'flowers' |
|---|
| | 597 | route[:action].should == 'pick' |
|---|
| | 598 | route[:id].should == '2' |
|---|
| | 599 | end |
|---|
| | 600 | |
|---|
| | 601 | it "should not match POST to /flowers/2/pick" do |
|---|
| | 602 | index, route = Merb::Router.match(SimpleRequest.new(:path => '/flowers/2/pick', :method => :post), {}) |
|---|
| | 603 | route[:controller].should_not == 'flowers' |
|---|
| | 604 | route[:action].should_not == 'pick' |
|---|
| | 605 | route[:id].should_not == '2' |
|---|
| | 606 | end |
|---|
| | 607 | |
|---|
| | 608 | it "should not match PUT to /flowers/2/pick" do |
|---|
| | 609 | index, route = Merb::Router.match(SimpleRequest.new(:path => '/flowers/2/pick', :method => :put), {}) |
|---|
| | 610 | route[:controller].should_not == 'flowers' |
|---|
| | 611 | route[:action].should_not == 'pick' |
|---|
| | 612 | route[:id].should_not == '2' |
|---|
| | 613 | end |
|---|
| | 614 | |
|---|
| | 615 | it "should not match DELETE to /flowers/2/pick" do |
|---|
| | 616 | index, route = Merb::Router.match(SimpleRequest.new(:path => '/flowers/2/pick', :method => :delete), {}) |
|---|
| | 617 | route[:controller].should_not == 'flowers' |
|---|
| | 618 | route[:action].should_not == 'pick' |
|---|
| | 619 | route[:id].should_not == '2' |
|---|
| | 620 | end |
|---|
| | 621 | |
|---|
| | 622 | it "should match GET to /flowers/2/pick.xml" do |
|---|
| | 623 | index, route = Merb::Router.match(SimpleRequest.new(:path => '/flowers/2/pick.xml', :method => :get), {}) |
|---|
| | 624 | route[:controller].should == 'flowers' |
|---|
| | 625 | route[:action].should == 'pick' |
|---|
| | 626 | route[:id].should == '2' |
|---|
| | 627 | route[:format].should == 'xml' |
|---|
| | 628 | end |
|---|
| | 629 | |
|---|