aboutsummaryrefslogtreecommitdiffstats
path: root/railties
diff options
context:
space:
mode:
Diffstat (limited to 'railties')
-rw-r--r--railties/lib/rails/generators/app_base.rb11
-rw-r--r--railties/test/railties/engine_test.rb28
2 files changed, 32 insertions, 7 deletions
diff --git a/railties/lib/rails/generators/app_base.rb b/railties/lib/rails/generators/app_base.rb
index 3b0791a453..a0a0f9ef66 100644
--- a/railties/lib/rails/generators/app_base.rb
+++ b/railties/lib/rails/generators/app_base.rb
@@ -185,14 +185,11 @@ module Rails
end
def bundle_command(command)
- say_status :run, "bundle #{command}"
+ require 'bundler'
+ require 'bundler/cli'
- # We use backticks and #print here instead of vanilla #system because it
- # is easier to silence stdout in the existing test suite this way. The
- # end-user gets the bundler commands called anyway.
- #
- # Thanks to James Tucker for the Gem tricks involved in this call.
- print `"#{Gem.ruby}" -rubygems "#{Gem.bin_path('bundler', 'bundle')}" #{command}`
+ say_status :run, "bundle #{command}"
+ Bundler::CLI.new.send(command)
end
def run_bundle
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