diff options
-rw-r--r-- | railties/lib/rails/generators/rails/app/templates/Gemfile | 6 | ||||
-rw-r--r-- | railties/test/generators/app_generator_test.rb | 11 |
2 files changed, 12 insertions, 5 deletions
diff --git a/railties/lib/rails/generators/rails/app/templates/Gemfile b/railties/lib/rails/generators/rails/app/templates/Gemfile index abe8c1556c..3966c0f70d 100644 --- a/railties/lib/rails/generators/rails/app/templates/Gemfile +++ b/railties/lib/rails/generators/rails/app/templates/Gemfile @@ -1,9 +1,9 @@ # Gemfile is where you list all of your application's dependencies # -gem "rails", "<%= Rails::VERSION::STRING %>" +<%= "# " if options.freeze? %>gem "rails", "<%= Rails::VERSION::STRING %>" # # Bundling edge rails: -# gem "rails", "<%= Rails::VERSION::STRING %>", :git => "git://github.com/rails/rails.git" +<%= "# " unless options.freeze? %>gem "rails", "<%= Rails::VERSION::STRING %>", :git => "git://github.com/rails/rails.git" # Specify gemcutter as a gem source # source "http://gemcutter.org" @@ -18,4 +18,4 @@ gem "rails", "<%= Rails::VERSION::STRING %>" # gem "rspec", :only => :test # only :test do # gem "webrat" -# end
\ No newline at end of file +# end diff --git a/railties/test/generators/app_generator_test.rb b/railties/test/generators/app_generator_test.rb index 5d6a9f6de9..20f2a24e6d 100644 --- a/railties/test/generators/app_generator_test.rb +++ b/railties/test/generators/app_generator_test.rb @@ -114,11 +114,18 @@ class AppGeneratorTest < GeneratorsTestCase generator(:freeze => true, :database => "sqlite3").expects(:run). with("rake rails:freeze:edge", :verbose => false) silence(:stdout){ generator.invoke } - assert_file 'config/environment.rb', /# RAILS_GEM_VERSION/ + + assert_file 'Gemfile' do |content| + flag = %(gem "rails", "#{Rails::VERSION::STRING}", :git => "git://github.com/rails/rails.git") + assert_match /^#{Regexp.escape(flag)}$/, content + + flag = %(# gem "rails", "#{Rails::VERSION::STRING}") + assert_match /^#{Regexp.escape(flag)}$/, content + end end def test_template_from_dir_pwd - FileUtils.cd(RAILS_ROOT) + FileUtils.cd(Rails.root) assert_match /It works from file!/, run_generator(["-m", "lib/template.rb"]) end |