Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Test added for getting route segment values

  • Loading branch information...
commit e72a6f8d9132f1159cfba69cabcfeb6776bc7d48 1 parent 975fd56
@arunagw authored
Showing with 28 additions and 0 deletions.
  1. +28 −0 railties/test/railties/engine_test.rb
View
28 railties/test/railties/engine_test.rb
@@ -93,6 +93,34 @@ class Engine < ::Rails::Engine
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
Please sign in to comment.
Something went wrong with that request. Please try again.