diff options
author | Arun Agrawal <arunagw@gmail.com> | 2013-10-27 23:07:10 +0100 |
---|---|---|
committer | Arun Agrawal <arunagw@gmail.com> | 2013-10-27 23:40:40 +0100 |
commit | 97ac5ed2a7812bc9b323de84a646165a311271d4 (patch) | |
tree | 527e65439e07db848d09c05dfc6dcedf1f3c485d | |
parent | 86f287e6cfc4181447d936d0d1c0336d944e7327 (diff) | |
download | rails-97ac5ed2a7812bc9b323de84a646165a311271d4.tar.gz rails-97ac5ed2a7812bc9b323de84a646165a311271d4.tar.bz2 rails-97ac5ed2a7812bc9b323de84a646165a311271d4.zip |
Fixed tests for app_generator
Added test for jbuilder and web-console inclusion.
Added README.rdoc for test default files
-rw-r--r-- | railties/lib/rails/generators/app_base.rb | 10 | ||||
-rw-r--r-- | railties/test/generators/app_generator_test.rb | 15 |
2 files changed, 18 insertions, 7 deletions
diff --git a/railties/lib/rails/generators/app_base.rb b/railties/lib/rails/generators/app_base.rb index a59a5ce1e0..9640f18aad 100644 --- a/railties/lib/rails/generators/app_base.rb +++ b/railties/lib/rails/generators/app_base.rb @@ -161,8 +161,8 @@ module Rails [GemfileEntry.path('rails', Rails::Generators::RAILS_DEV_PATH), GemfileEntry.github('arel', 'rails/arel')] elsif options.edge? - [GemfileEntry.path('rails', 'rails/rails'), - GemfileEntry.path('arel', 'rails/arel')] + [GemfileEntry.github('rails', 'rails/rails'), + GemfileEntry.github('arel', 'rails/arel')] else [GemfileEntry.version('rails', Rails::VERSION::STRING, @@ -201,7 +201,7 @@ module Rails return [] if options[:skip_sprockets] gems = [] - gemfile = if options.dev? || options.edge? + if options.dev? || options.edge? gems << GemfileEntry.github('sprockets-rails', 'rails/sprockets-rails', 'Use edge version of sprockets-rails') gems << GemfileEntry.github('sass-rails', 'rails/sass-rails', @@ -231,7 +231,7 @@ module Rails def sdoc_gemfile_entry comment = 'bundle exec rake doc:rails generates the API under doc/api.' - GemfileEntry.new('web-console', comment, nil, { :group => :doc, :require => false }) + GemfileEntry.new('sdoc', comment, nil, { :group => :doc, :require => false }) end def coffee_gemfile_entry @@ -259,7 +259,7 @@ module Rails def javascript_runtime_gemfile_entry comment = 'See https://github.com/sstephenson/execjs#readme for more supported runtimes' - runtime = if defined?(JRUBY_VERSION) + if defined?(JRUBY_VERSION) GemfileEntry.version 'therubyrhino', comment, nil else GemfileEntry.new 'therubyracer', comment, nil, { :platforms => :ruby }, true diff --git a/railties/test/generators/app_generator_test.rb b/railties/test/generators/app_generator_test.rb index 9b0c9ebf5b..39d4acb7b2 100644 --- a/railties/test/generators/app_generator_test.rb +++ b/railties/test/generators/app_generator_test.rb @@ -4,6 +4,7 @@ require 'generators/shared_generator_tests' DEFAULT_APP_FILES = %w( .gitignore + README.rdoc Gemfile Rakefile config.ru @@ -254,7 +255,7 @@ class AppGeneratorTest < Rails::Generators::TestCase if defined?(JRUBY_VERSION) assert_gem "therubyrhino" else - assert_file "Gemfile", /# gem\s+["']therubyracer["']+, platforms: :ruby$/ + assert_file "Gemfile", /# gem\s+["']therubyracer["']+, \s+platforms: :ruby$/ end end @@ -312,6 +313,16 @@ class AppGeneratorTest < Rails::Generators::TestCase end end + def test_inclusion_of_web_console + run_generator + assert_file "Gemfile", /gem 'web-console', \s+group: :development/ + end + + def test_inclusion_of_jbuilder + run_generator + assert_file "Gemfile", /gem 'jbuilder'/ + end + def test_inclusion_of_debugger run_generator assert_file "Gemfile", /# gem 'debugger'/ @@ -319,7 +330,7 @@ class AppGeneratorTest < Rails::Generators::TestCase def test_inclusion_of_lazy_loaded_sdoc run_generator - assert_file 'Gemfile', /gem 'sdoc', require: false/ + assert_file 'Gemfile', /gem 'sdoc', \s+group: :doc, require: false/ end def test_template_from_dir_pwd |