From e72a6f8d9132f1159cfba69cabcfeb6776bc7d48 Mon Sep 17 00:00:00 2001 From: Arun Agrawal Date: Fri, 13 May 2011 08:12:06 +0530 Subject: Test added for getting route segment values --- railties/test/railties/engine_test.rb | 28 ++++++++++++++++++++++++++++ 1 file changed, 28 insertions(+) (limited to 'railties') diff --git a/railties/test/railties/engine_test.rb b/railties/test/railties/engine_test.rb index 0c588ba773..b5b21f9ebe 100644 --- a/railties/test/railties/engine_test.rb +++ b/railties/test/railties/engine_test.rb @@ -93,6 +93,34 @@ module RailtiesTest assert_equal "HELLO WORLD", last_response.body end + test "pass the value of the segment" do + controller "foo", <<-RUBY + class FooController < ActionController::Base + def index + render :text => params[:username] + end + end + RUBY + + @plugin.write "config/routes.rb", <<-RUBY + Bukkits::Engine.routes.draw do + root :to => "foo#index" + end + RUBY + + app_file "config/routes.rb", <<-RUBY + Rails.application.routes.draw do + mount(Bukkits::Engine => "/:username") + end + RUBY + + boot_rails + + get("/arunagw") + assert_equal "arunagw", last_response.body + + end + test "it provides routes as default endpoint" do @plugin.write "lib/bukkits.rb", <<-RUBY class Bukkits -- cgit v1.2.3