diff options
author | Arun Agrawal <arun@fromjaipur.com> | 2011-05-13 08:12:06 +0530 |
---|---|---|
committer | Arun Agrawal <arun@fromjaipur.com> | 2011-05-13 08:12:06 +0530 |
commit | e72a6f8d9132f1159cfba69cabcfeb6776bc7d48 (patch) | |
tree | 20c9cd863c05ccacc93b618b520ac81ce310b364 /railties | |
parent | 975fd5669d3f76063b0e28b8feb8df9f2e93a065 (diff) | |
download | rails-e72a6f8d9132f1159cfba69cabcfeb6776bc7d48.tar.gz rails-e72a6f8d9132f1159cfba69cabcfeb6776bc7d48.tar.bz2 rails-e72a6f8d9132f1159cfba69cabcfeb6776bc7d48.zip |
Test added for getting route segment values
Diffstat (limited to 'railties')
-rw-r--r-- | railties/test/railties/engine_test.rb | 28 |
1 files changed, 28 insertions, 0 deletions
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 |