提交 e72a6f8d 编写于 作者: A Arun Agrawal

Test added for getting route segment values

上级 975fd566
......@@ -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
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册