diff options
author | Piotr Sarnacki <drogus@gmail.com> | 2012-05-16 04:46:26 -0700 |
---|---|---|
committer | Piotr Sarnacki <drogus@gmail.com> | 2012-08-31 20:52:29 +0200 |
commit | 62fa173bd9117cf2bc93c01984b8decfcc78accb (patch) | |
tree | 5cd4ebb8c3e27a9d8266fd9b1769b27a0e7d6939 /railties/test/isolation | |
parent | 7fc4b4681b83b86d5871f0726460ea808bd76f1b (diff) | |
download | rails-62fa173bd9117cf2bc93c01984b8decfcc78accb.tar.gz rails-62fa173bd9117cf2bc93c01984b8decfcc78accb.tar.bz2 rails-62fa173bd9117cf2bc93c01984b8decfcc78accb.zip |
Don't use Gemfile in test application in railties
Option to run `bundle install` after generating new appplication was
added recently to rails. Since introduction, it contained a subtle bug
that caused it to use `Gemfile` from current directory (if it exists)
rather than from generated directory. This also accidentaly caused
railties tests to work without any problems - after generating test app
it just used `Gemfile` from the repository, rather than the one in
generated app. After fixing the bug mentioned above, this of course
broke. The easiest way to bypass that is to not generate a `Gemfile` for
test application - with such setup Bundler will just use first available
`Gemfile` in one of the parent directories.
Diffstat (limited to 'railties/test/isolation')
-rw-r--r-- | railties/test/isolation/abstract_unit.rb | 10 |
1 files changed, 5 insertions, 5 deletions
diff --git a/railties/test/isolation/abstract_unit.rb b/railties/test/isolation/abstract_unit.rb index 37839a1c54..07a7faa3af 100644 --- a/railties/test/isolation/abstract_unit.rb +++ b/railties/test/isolation/abstract_unit.rb @@ -8,7 +8,7 @@ # Rails booted up. require 'fileutils' -require 'bundler/setup' +require 'bundler/setup' unless defined?(Bundler) require 'minitest/autorun' require 'active_support/test_case' @@ -105,8 +105,9 @@ module TestHelpers end end - unless options[:gemfile] - File.delete"#{app_path}/Gemfile" + gemfile_path = "#{app_path}/Gemfile" + if options[:gemfile].blank? && File.exist?(gemfile_path) + File.delete gemfile_path end routes = File.read("#{app_path}/config/routes.rb") @@ -281,8 +282,7 @@ Module.new do environment = File.expand_path('../../../../load_paths', __FILE__) require_environment = "-r #{environment}" - `#{Gem.ruby} #{require_environment} #{RAILS_FRAMEWORK_ROOT}/railties/bin/rails new #{app_template_path}` - + `#{Gem.ruby} #{require_environment} #{RAILS_FRAMEWORK_ROOT}/railties/bin/rails new #{app_template_path} --skip-gemfile` File.open("#{app_template_path}/config/boot.rb", 'w') do |f| f.puts "require '#{environment}'" f.puts "require 'rails/all'" |