Sha256: 2ec1aaf60e8668c1f52085a184f848b10692cba4e4247c0f4ddf8413d3c6b729
Contents?: true
Size: 1.87 KB
Versions: 33
Compression:
Stored size: 1.87 KB
Contents
require File.join(File.dirname(__FILE__), '..', '..', 'test_helper') class RouteToMatcherTest < ActionController::TestCase # :nodoc: context "given a controller with a defined route" do setup do @controller = define_controller('Examples').new define_routes do |map| map.connect 'examples/:id', :controller => 'examples', :action => 'example' end end should "accept routing the correct path to the correct parameters" do assert_accepts route(:get, '/examples/1'). to(:action => 'example', :id => '1'), @controller end should "accept a symbol controller" do assert_accepts route(:get, '/examples/1'). to(:controller => :examples, :action => 'example', :id => '1'), self end should "accept a symbol action" do assert_accepts route(:get, '/examples/1'). to(:action => :example, :id => '1'), @controller end should "accept a non-string parameter" do assert_accepts route(:get, '/examples/1'). to(:action => 'example', :id => 1), @controller end should "reject an undefined route" do assert_rejects route(:get, '/bad_route').to(:var => 'value'), @controller end should "reject a route for another controller" do @other = define_controller('Other').new assert_rejects route(:get, '/examples/1'). to(:action => 'example', :id => '1'), @other end should "reject a route for different parameters" do assert_rejects route(:get, '/examples/1'). to(:action => 'other', :id => '1'), @controller end end end
Version data entries
33 entries across 33 versions & 8 rubygems