aboutsummaryrefslogtreecommitdiffstats
path: root/railties
diff options
context:
space:
mode:
Diffstat (limited to 'railties')
-rw-r--r--railties/lib/rails/generators/rails/app/templates/config/application.rb11
-rw-r--r--railties/lib/rails/generators/rails/plugin_new/plugin_new_generator.rb2
-rw-r--r--railties/lib/rails/generators/rails/plugin_new/templates/%name%.gemspec2
-rw-r--r--railties/test/application/initializers/notifications_test.rb2
-rw-r--r--railties/test/application/rack/logger_test.rb6
-rw-r--r--railties/test/application/rake_test.rb18
-rw-r--r--railties/test/generators/plugin_new_generator_test.rb14
7 files changed, 29 insertions, 26 deletions
diff --git a/railties/lib/rails/generators/rails/app/templates/config/application.rb b/railties/lib/rails/generators/rails/app/templates/config/application.rb
index 8ff80c6fd3..a097c77391 100644
--- a/railties/lib/rails/generators/rails/app/templates/config/application.rb
+++ b/railties/lib/rails/generators/rails/app/templates/config/application.rb
@@ -39,17 +39,6 @@ module <%= app_const_base %>
# config.i18n.load_path += Dir[Rails.root.join('my', 'locales', '*.{rb,yml}').to_s]
# config.i18n.default_locale = :de
- # Please note that JavaScript expansions are *ignored altogether* if the asset
- # pipeline is enabled (see config.assets.enabled below). Put your defaults in
- # app/assets/javascripts/application.js in that case.
- #
- # JavaScript files you want as :defaults (application.js is always included).
-<% if options[:skip_javascript] -%>
- # config.action_view.javascript_expansions[:defaults] = %w()
-<% else -%>
- # config.action_view.javascript_expansions[:defaults] = %w(prototype prototype_ujs)
-<% end -%>
-
# Configure the default encoding used in templates for Ruby 1.9.
config.encoding = "utf-8"
diff --git a/railties/lib/rails/generators/rails/plugin_new/plugin_new_generator.rb b/railties/lib/rails/generators/rails/plugin_new/plugin_new_generator.rb
index 9ddb3cae33..4967d1793c 100644
--- a/railties/lib/rails/generators/rails/plugin_new/plugin_new_generator.rb
+++ b/railties/lib/rails/generators/rails/plugin_new/plugin_new_generator.rb
@@ -202,7 +202,7 @@ task :default => :test
end
def create_test_dummy_files
- return if options[:skip_test_unit]
+ return if options[:skip_test_unit] && options[:dummy_path] == 'test/dummy'
create_dummy_app
end
diff --git a/railties/lib/rails/generators/rails/plugin_new/templates/%name%.gemspec b/railties/lib/rails/generators/rails/plugin_new/templates/%name%.gemspec
index 3d9bfb22c7..15299ddb9f 100644
--- a/railties/lib/rails/generators/rails/plugin_new/templates/%name%.gemspec
+++ b/railties/lib/rails/generators/rails/plugin_new/templates/%name%.gemspec
@@ -4,6 +4,6 @@ Gem::Specification.new do |s|
s.name = "<%= name %>"
s.summary = "Insert <%= camelized %> summary."
s.description = "Insert <%= camelized %> description."
- s.files = Dir["lib/**/*"] + ["MIT-LICENSE", "Rakefile", "README.rdoc"]
+ s.files = Dir["{app,config,lib}/**/*"] + ["MIT-LICENSE", "Rakefile", "README.rdoc"]
s.version = "0.0.1"
end
diff --git a/railties/test/application/initializers/notifications_test.rb b/railties/test/application/initializers/notifications_test.rb
index 7e035be764..c87433db0d 100644
--- a/railties/test/application/initializers/notifications_test.rb
+++ b/railties/test/application/initializers/notifications_test.rb
@@ -33,7 +33,7 @@ module ApplicationTests
wait
assert_equal 1, logger.logged(:debug).size
- assert_match /SHOW tables/, logger.logged(:debug).last
+ assert_match(/SHOW tables/, logger.logged(:debug).last)
end
end
end
diff --git a/railties/test/application/rack/logger_test.rb b/railties/test/application/rack/logger_test.rb
index a29244357c..715af5c642 100644
--- a/railties/test/application/rack/logger_test.rb
+++ b/railties/test/application/rack/logger_test.rb
@@ -21,19 +21,19 @@ module ApplicationTests
test "logger logs proper HTTP verb and path" do
get "/blah"
wait
- assert_match /^Started GET "\/blah"/, logs[0]
+ assert_match(/^Started GET "\/blah"/, logs[0])
end
test "logger logs HTTP verb override" do
post "/", {:_method => 'put'}
wait
- assert_match /^Started PUT "\/"/, logs[0]
+ assert_match(/^Started PUT "\/"/, logs[0])
end
test "logger logs HEAD requests" do
post "/", {:_method => 'head'}
wait
- assert_match /^Started HEAD "\/"/, logs[0]
+ assert_match(/^Started HEAD "\/"/, logs[0])
end
end
end
diff --git a/railties/test/application/rake_test.rb b/railties/test/application/rake_test.rb
index d77c2d14ab..ab36ace5e5 100644
--- a/railties/test/application/rake_test.rb
+++ b/railties/test/application/rake_test.rb
@@ -31,7 +31,7 @@ module ApplicationTests
AppTemplate::Application.initialize!
RUBY
- assert_match "SuperMiddleware", Dir.chdir(app_path){ `rake middleware` }
+ assert_match("SuperMiddleware", Dir.chdir(app_path){ `rake middleware` })
end
def test_initializers_are_executed_in_rake_tasks
@@ -93,16 +93,16 @@ module ApplicationTests
end
output = Dir.chdir(app_path){ `rake db:migrate` }
- assert_match /create_table\(:users\)/, output
- assert_match /CreateUsers: migrated/, output
- assert_match /add_column\(:users, :email, :string\)/, output
- assert_match /AddEmailToUsers: migrated/, output
+ assert_match(/create_table\(:users\)/, output)
+ assert_match(/CreateUsers: migrated/, output)
+ assert_match(/add_column\(:users, :email, :string\)/, output)
+ assert_match(/AddEmailToUsers: migrated/, output)
output = Dir.chdir(app_path){ `rake db:rollback STEP=2` }
- assert_match /drop_table\("users"\)/, output
- assert_match /CreateUsers: reverted/, output
- assert_match /remove_column\("users", :email\)/, output
- assert_match /AddEmailToUsers: reverted/, output
+ assert_match(/drop_table\("users"\)/, output)
+ assert_match(/CreateUsers: reverted/, output)
+ assert_match(/remove_column\("users", :email\)/, output)
+ assert_match(/AddEmailToUsers: reverted/, output)
end
def test_loading_specific_fixtures
diff --git a/railties/test/generators/plugin_new_generator_test.rb b/railties/test/generators/plugin_new_generator_test.rb
index 297ac5d238..5ffc2501cd 100644
--- a/railties/test/generators/plugin_new_generator_test.rb
+++ b/railties/test/generators/plugin_new_generator_test.rb
@@ -169,12 +169,26 @@ class PluginNewGeneratorTest < Rails::Generators::TestCase
assert_file "app/views/layouts/bukkits/application.html.erb", /<title>Bukkits<\/title>/
end
+ def test_creating_gemspec
+ run_generator
+ assert_file "bukkits.gemspec", /s.name = "bukkits"/
+ assert_file "bukkits.gemspec", /s.files = Dir\["\{app,config,lib\}\/\*\*\/\*"\]/
+ assert_file "bukkits.gemspec", /s.version = "0.0.1"/
+ end
+
def test_passing_dummy_path_as_a_parameter
run_generator [destination_root, "--dummy_path", "spec/dummy"]
assert_file "spec/dummy"
assert_file "spec/dummy/config/application.rb"
assert_no_file "test/dummy"
end
+
+ def test_creating_dummy_without_tests_but_with_dummy_path
+ run_generator [destination_root, "--dummy_path", "spec/dummy", "--skip-test-unit"]
+ assert_file "spec/dummy"
+ assert_file "spec/dummy/config/application.rb"
+ assert_no_file "test"
+ end
def test_skipping_gemspec
run_generator [destination_root, "--skip-gemspec"]