Permalink
Browse files

Fixed tests for app_generator

Added test for jbuilder and web-console inclusion.

Added README.rdoc for test default files
  • Loading branch information...
1 parent 86f287e commit 97ac5ed2a7812bc9b323de84a646165a311271d4 @arunagw arunagw committed Oct 27, 2013
Showing with 18 additions and 7 deletions.
  1. +5 −5 railties/lib/rails/generators/app_base.rb
  2. +13 −2 railties/test/generators/app_generator_test.rb
@@ -161,8 +161,8 @@ def rails_gemfile_entry
[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 @@ def assets_gemfile_entry
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 @@ def webconsole_gemfile_entry
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 @@ def javascript_gemfile_entry
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
@@ -4,6 +4,7 @@
DEFAULT_APP_FILES = %w(
.gitignore
+ README.rdoc
Gemfile
Rakefile
config.ru
@@ -254,7 +255,7 @@ def test_inclusion_of_javascript_runtime
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,14 +313,24 @@ def test_javascript_is_skipped_if_required
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'/
end
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

0 comments on commit 97ac5ed

Please sign in to comment.