Changeset 7572
- Timestamp:
- 09/22/07 19:20:06 (1 year ago)
- Files:
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
trunk/actionmailer/test/fixtures/test_mailer/signed_up_with_url.erb
r6180 r7572 1 1 Hello there, 2 2 3 Mr. <%= @recipient %>. Please see our greeting at <%= @welcome_url %> 3 Mr. <%= @recipient %>. Please see our greeting at <%= @welcome_url %> <%= welcome_url %> trunk/actionmailer/test/url_test.rb
r5081 r7572 2 2 3 3 class TestMailer < ActionMailer::Base 4 5 default_url_options[:host] = 'www.basecamphq.com' 6 4 7 def signed_up_with_url(recipient) 5 8 @recipients = recipient … … 48 51 ActionController::Routing::Routes.draw do |map| 49 52 map.connect ':controller/:action/:id' 53 map.welcome 'welcome', :controller=>"foo", :action=>"bar" 50 54 end 51 55 … … 53 57 expected.to = @recipient 54 58 expected.subject = "[Signed up] Welcome #{@recipient}" 55 expected.body = "Hello there, \n\nMr. #{@recipient}. Please see our greeting at http://example.com/welcome/greeting "59 expected.body = "Hello there, \n\nMr. #{@recipient}. Please see our greeting at http://example.com/welcome/greeting http://www.basecamphq.com/welcome" 56 60 expected.from = "system@loudthinking.com" 57 61 expected.date = Time.local(2004, 12, 12) trunk/actionpack/lib/action_controller/routing_optimisation.rb
r7501 r7572 42 42 end 43 43 44 # Temporarily disabled :url optimisation pending proper solution to 45 # Issues around request.host etc. 44 46 def applicable? 45 true47 kind != :url 46 48 end 47 49 end … … 77 79 # 'divider segment' for '/' but we have assertions to ensure that 78 80 # we don't include the trailing slashes, so skip them. 79 ( (route.segments.size == 1 && kind == :path)? route.segments : route.segments[0..-2]).each do |segment|81 (route.segments.size == 1 ? route.segments : route.segments[0..-2]).each do |segment| 80 82 if segment.is_a?(DynamicSegment) 81 83 elements << segment.interpolation_chunk("args[#{idx}].to_param") … … 106 108 # can't use this optimisation on routes without any segments 107 109 def applicable? 108 route.segment_keys.size > 0110 super && route.segment_keys.size > 0 109 111 end 110 112 end trunk/actionpack/test/controller/routing_test.rb
r7501 r7572 170 170 rs.add_named_route :home, '', :controller => 'content', :action => 'list' 171 171 x = setup_for_named_route 172 assert_equal("http://named.route.test ",172 assert_equal("http://named.route.test/", 173 173 x.send(:home_url)) 174 174 end … … 190 190 191 191 def test_named_route_with_nested_controller 192 rs.add_named_route :users, ' /admin/user', :controller => '/admin/user', :action => 'index'192 rs.add_named_route :users, 'admin/user', :controller => 'admin/user', :action => 'index' 193 193 x = setup_for_named_route 194 194 assert_equal("http://named.route.test/admin/user", … … 202 202 x = setup_for_named_route 203 203 x.expects(:url_for).never 204 x.send(:users_url)204 # x.send(:users_url) 205 205 x.send(:users_path) 206 x.send(:user_url, 2, :foo=>"bar")206 # x.send(:user_url, 2, :foo=>"bar") 207 207 x.send(:user_path, 3, :bar=>"foo") 208 208 end … … 226 226 end 227 227 x = setup_for_named_route 228 assert_equal("http://named.route.test ", x.send(:root_url))228 assert_equal("http://named.route.test/", x.send(:root_url)) 229 229 assert_equal("/", x.send(:root_path)) 230 230 end … … 486 486 487 487 x = setup_for_named_route 488 assert_equal("http://named.route.test ",488 assert_equal("http://named.route.test/", 489 489 x.send(:home_url)) 490 490 end