Sha256: 067587c8ee767a76378e3313b2697d2b7f3c68e7639c0ee1ee0d162559eaf808

Contents?: true

Size: 1.34 KB

Versions: 12

Compression:

Stored size: 1.34 KB

Contents

require File.join(File.dirname(__FILE__), "..", "spec_helper")

describe "Recognizing requests for the default routes" do
  
  before :each do
    Merb::Router.prepare do
      default_routes
    end
  end
    
  it "should match /foo to the Foo controller and index action" do
    route_for("/foo").should have_route(:controller => "foo", :action => "index", :id => nil)
  end
  
  it "should match /foo/bar to the Foo controller and the bar action" do
    route_for("/foo/bar").should have_route(:controller => "foo", :action => "bar", :id => nil)
  end
  
  it "should match /foo/bar/12 to the Foo controller, the bar action, and id of 12" do
    route_for("/foo/bar/12").should have_route(:controller => "foo", :action => "bar", :id => "12")
  end
  
  it "should match /foo.xml to the Foo controller, index action, and xml format" do
    route_for("/foo.xml").should have_route(:controller => "foo", :action => "index", :format => "xml")
  end
  
  it "should match /foo.xml to the Foo controller, bar action, and xml format" do
    route_for("/foo/bar.xml").should have_route(:controller => "foo", :action => "bar", :format => "xml")
  end
  
  it "should match /foo.xml to the Foo controller, bar action, id 10, and xml format" do
    route_for("/foo/bar/10.xml").should have_route(:controller => "foo", :action => "bar", :id => "10", :format => "xml")
  end
  
end

Version data entries

12 entries across 6 versions & 1 rubygems

Version Path
merb-core-1.1.3 spec10/public/router/recognition/default_routes_spec.rb
merb-core-1.1.3 spec/public/router/recognition/default_routes_spec.rb
merb-core-1.1.2 spec10/public/router/recognition/default_routes_spec.rb
merb-core-1.1.2 spec/public/router/recognition/default_routes_spec.rb
merb-core-1.1.1 spec10/public/router/recognition/default_routes_spec.rb
merb-core-1.1.1 spec/public/router/recognition/default_routes_spec.rb
merb-core-1.1.0 spec/public/router/recognition/default_routes_spec.rb
merb-core-1.1.0 spec10/public/router/recognition/default_routes_spec.rb
merb-core-1.1.0.rc1 spec10/public/router/recognition/default_routes_spec.rb
merb-core-1.1.0.rc1 spec/public/router/recognition/default_routes_spec.rb
merb-core-1.1.0.pre spec/public/router/recognition/default_routes_spec.rb
merb-core-1.1.0.pre spec10/public/router/recognition/default_routes_spec.rb