aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--actionmailer/test/log_subscriber_test.rb1
-rw-r--r--activerecord/activerecord.gemspec2
-rw-r--r--activerecord/lib/active_record/base.rb16
-rw-r--r--activerecord/lib/active_record/railties/databases.rake3
-rw-r--r--activerecord/test/cases/attribute_methods_test.rb8
-rw-r--r--activeresource/activeresource.gemspec2
-rw-r--r--activesupport/activesupport.gemspec2
-rw-r--r--railties/lib/rails/code_statistics.rb2
-rw-r--r--railties/lib/rails/generators/rails/plugin/USAGE13
-rw-r--r--railties/lib/rails/generators/rails/plugin/plugin_generator.rb54
-rw-r--r--railties/lib/rails/generators/rails/plugin/templates/MIT-LICENSE.tt20
-rw-r--r--railties/lib/rails/generators/rails/plugin/templates/README.tt13
-rw-r--r--railties/lib/rails/generators/rails/plugin/templates/Rakefile.tt23
-rw-r--r--railties/lib/rails/generators/rails/plugin/templates/init.rb1
-rw-r--r--railties/lib/rails/generators/rails/plugin/templates/install.rb1
-rw-r--r--railties/lib/rails/generators/rails/plugin/templates/lib/%file_name%.rb.tt1
-rw-r--r--railties/lib/rails/generators/rails/plugin/templates/lib/tasks/%file_name%_tasks.rake.tt4
-rw-r--r--railties/lib/rails/generators/rails/plugin/templates/uninstall.rb1
-rw-r--r--railties/lib/rails/generators/rails/plugin_new/templates/%name%.gemspec3
-rwxr-xr-xrailties/lib/rails/generators/rails/plugin_new/templates/Rakefile9
-rw-r--r--railties/lib/rails/generators/rails/plugin_new/templates/script/rails.tt1
-rw-r--r--railties/lib/rails/paths.rb33
-rw-r--r--railties/lib/rails/railtie/configuration.rb5
-rw-r--r--railties/lib/rails/tasks/assets.rake2
-rw-r--r--railties/lib/rails/tasks/documentation.rake8
-rw-r--r--railties/test/application/generators_test.rb6
-rw-r--r--railties/test/application/paths_test.rb2
-rw-r--r--railties/test/generators/generators_test_helper.rb2
-rw-r--r--railties/test/generators/plugin_generator_test.rb71
-rw-r--r--railties/test/generators/plugin_new_generator_test.rb16
-rw-r--r--railties/test/generators_test.rb7
-rw-r--r--railties/test/paths_test.rb53
32 files changed, 64 insertions, 321 deletions
diff --git a/actionmailer/test/log_subscriber_test.rb b/actionmailer/test/log_subscriber_test.rb
index 7d2e674a8c..5f52a1bd69 100644
--- a/actionmailer/test/log_subscriber_test.rb
+++ b/actionmailer/test/log_subscriber_test.rb
@@ -1,4 +1,5 @@
require "abstract_unit"
+require 'mailers/base_mailer'
require "active_support/log_subscriber/test_helper"
require "action_mailer/log_subscriber"
diff --git a/activerecord/activerecord.gemspec b/activerecord/activerecord.gemspec
index 43a1258c20..b7e23faa09 100644
--- a/activerecord/activerecord.gemspec
+++ b/activerecord/activerecord.gemspec
@@ -13,7 +13,7 @@ Gem::Specification.new do |s|
s.email = 'david@loudthinking.com'
s.homepage = 'http://www.rubyonrails.org'
- s.files = Dir['CHANGELOG', 'README.rdoc', 'examples/**/*', 'lib/**/*']
+ s.files = Dir['CHANGELOG', 'MIT-LICENSE', 'README.rdoc', 'examples/**/*', 'lib/**/*']
s.require_path = 'lib'
s.extra_rdoc_files = %w( README.rdoc )
diff --git a/activerecord/lib/active_record/base.rb b/activerecord/lib/active_record/base.rb
index f6a80b8bce..f74810720d 100644
--- a/activerecord/lib/active_record/base.rb
+++ b/activerecord/lib/active_record/base.rb
@@ -1857,12 +1857,16 @@ MSG
# Returns the contents of the record as a nicely formatted string.
def inspect
- attributes_as_nice_string = self.class.column_names.collect { |name|
- if has_attribute?(name)
- "#{name}: #{attribute_for_inspect(name)}"
- end
- }.compact.join(", ")
- "#<#{self.class} #{attributes_as_nice_string}>"
+ inspection = if @attributes
+ self.class.column_names.collect { |name|
+ if has_attribute?(name)
+ "#{name}: #{attribute_for_inspect(name)}"
+ end
+ }.compact.join(", ")
+ else
+ "not initialized"
+ end
+ "#<#{self.class} #{inspection}>"
end
protected
diff --git a/activerecord/lib/active_record/railties/databases.rake b/activerecord/lib/active_record/railties/databases.rake
index 2c7298e220..6f8f84d50b 100644
--- a/activerecord/lib/active_record/railties/databases.rake
+++ b/activerecord/lib/active_record/railties/databases.rake
@@ -481,8 +481,7 @@ db_namespace = namespace :db do
# desc "Creates a sessions migration for use with ActiveRecord::SessionStore"
task :create => :environment do
raise 'Task unavailable to this database (no migration support)' unless ActiveRecord::Base.connection.supports_migrations?
- require 'rails/generators'
- Rails::Generators.configure!
+ Rails.application.load_generators
require 'rails/generators/rails/session_migration/session_migration_generator'
Rails::Generators::SessionMigrationGenerator.start [ ENV['MIGRATION'] || 'add_sessions_table' ]
end
diff --git a/activerecord/test/cases/attribute_methods_test.rb b/activerecord/test/cases/attribute_methods_test.rb
index 5074ae50ab..54c4d4ae90 100644
--- a/activerecord/test/cases/attribute_methods_test.rb
+++ b/activerecord/test/cases/attribute_methods_test.rb
@@ -109,6 +109,14 @@ class AttributeMethodsTest < ActiveRecord::TestCase
assert_respond_to topic, :title
end
+ # IRB inspects the return value of "MyModel.allocate"
+ # by inspecting it.
+ def test_allocated_object_can_be_inspected
+ topic = Topic.allocate
+ assert_nothing_raised { topic.inspect }
+ assert topic.inspect, "#<Topic not initialized>"
+ end
+
def test_array_content
topic = Topic.new
topic.content = %w( one two three )
diff --git a/activeresource/activeresource.gemspec b/activeresource/activeresource.gemspec
index 400a0d851d..a8772ecf8c 100644
--- a/activeresource/activeresource.gemspec
+++ b/activeresource/activeresource.gemspec
@@ -13,7 +13,7 @@ Gem::Specification.new do |s|
s.email = 'david@loudthinking.com'
s.homepage = 'http://www.rubyonrails.org'
- s.files = Dir['CHANGELOG', 'README.rdoc', 'examples/**/*', 'lib/**/*']
+ s.files = Dir['CHANGELOG', 'MIT-LICENSE', 'README.rdoc', 'examples/**/*', 'lib/**/*']
s.require_path = 'lib'
s.extra_rdoc_files = %w( README.rdoc )
diff --git a/activesupport/activesupport.gemspec b/activesupport/activesupport.gemspec
index 738a10a18f..2ee6bb788a 100644
--- a/activesupport/activesupport.gemspec
+++ b/activesupport/activesupport.gemspec
@@ -13,7 +13,7 @@ Gem::Specification.new do |s|
s.email = 'david@loudthinking.com'
s.homepage = 'http://www.rubyonrails.org'
- s.files = Dir['CHANGELOG', 'README.rdoc', 'lib/**/*']
+ s.files = Dir['CHANGELOG', 'MIT-LICENSE', 'README.rdoc', 'lib/**/*']
s.require_path = 'lib'
s.add_dependency('i18n', '~> 0.6')
diff --git a/railties/lib/rails/code_statistics.rb b/railties/lib/rails/code_statistics.rb
index 40416dd83a..770c23ae41 100644
--- a/railties/lib/rails/code_statistics.rb
+++ b/railties/lib/rails/code_statistics.rb
@@ -104,4 +104,4 @@ class CodeStatistics #:nodoc:
puts " Code LOC: #{code} Test LOC: #{tests} Code to Test Ratio: 1:#{sprintf("%.1f", tests.to_f/code)}"
puts ""
end
- end
+end
diff --git a/railties/lib/rails/generators/rails/plugin/USAGE b/railties/lib/rails/generators/rails/plugin/USAGE
deleted file mode 100644
index 1bcfcf190d..0000000000
--- a/railties/lib/rails/generators/rails/plugin/USAGE
+++ /dev/null
@@ -1,13 +0,0 @@
-Description:
- Stubs out a new plugin at vendor/plugins. Pass the plugin name, either
- CamelCased or under_scored, as an argument.
-
-Example:
- `rails generate plugin BrowserFilters`
-
- creates a standard browser_filters plugin:
- vendor/plugins/browser_filters/README
- vendor/plugins/browser_filters/init.rb
- vendor/plugins/browser_filters/install.rb
- vendor/plugins/browser_filters/lib/browser_filters.rb
- vendor/plugins/browser_filters/test/browser_filters_test.rb
diff --git a/railties/lib/rails/generators/rails/plugin/plugin_generator.rb b/railties/lib/rails/generators/rails/plugin/plugin_generator.rb
deleted file mode 100644
index 97f681d826..0000000000
--- a/railties/lib/rails/generators/rails/plugin/plugin_generator.rb
+++ /dev/null
@@ -1,54 +0,0 @@
-
-require 'rails/generators/rails/generator/generator_generator'
-
-module Rails
- module Generators
- class PluginGenerator < NamedBase
- class_option :tasks, :desc => "When supplied creates tasks base files."
-
- def show_deprecation
- return unless behavior == :invoke
- message = "Plugin generator is deprecated, please use 'rails plugin new' command to generate plugin structure."
- ActiveSupport::Deprecation.warn message
- end
-
- check_class_collision
-
- def create_root_files
- directory '.', plugin_dir, :recursive => false
- end
-
- def create_lib_files
- directory 'lib', plugin_dir('lib'), :recursive => false
- end
-
- def create_tasks_files
- return unless options[:tasks]
- directory 'lib/tasks', plugin_dir('lib/tasks')
- end
-
- hook_for :generator do |generator|
- inside plugin_dir, :verbose => true do
- invoke generator, [ name ], :namespace => false
- end
- end
-
- hook_for :test_framework do |test_framework|
- inside plugin_dir, :verbose => true do
- invoke test_framework
- end
- end
-
- protected
-
- def plugin_dir(join=nil)
- if join
- File.join(plugin_dir, join)
- else
- "vendor/plugins/#{file_name}"
- end
- end
-
- end
- end
-end
diff --git a/railties/lib/rails/generators/rails/plugin/templates/MIT-LICENSE.tt b/railties/lib/rails/generators/rails/plugin/templates/MIT-LICENSE.tt
deleted file mode 100644
index 8717df053d..0000000000
--- a/railties/lib/rails/generators/rails/plugin/templates/MIT-LICENSE.tt
+++ /dev/null
@@ -1,20 +0,0 @@
-Copyright (c) <%= Date.today.year %> [name of plugin creator]
-
-Permission is hereby granted, free of charge, to any person obtaining
-a copy of this software and associated documentation files (the
-"Software"), to deal in the Software without restriction, including
-without limitation the rights to use, copy, modify, merge, publish,
-distribute, sublicense, and/or sell copies of the Software, and to
-permit persons to whom the Software is furnished to do so, subject to
-the following conditions:
-
-The above copyright notice and this permission notice shall be
-included in all copies or substantial portions of the Software.
-
-THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
-EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
-MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
-NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
-LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
-OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
-WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
diff --git a/railties/lib/rails/generators/rails/plugin/templates/README.tt b/railties/lib/rails/generators/rails/plugin/templates/README.tt
deleted file mode 100644
index 702db07cb1..0000000000
--- a/railties/lib/rails/generators/rails/plugin/templates/README.tt
+++ /dev/null
@@ -1,13 +0,0 @@
-<%= class_name %>
-<%= "=" * class_name.size %>
-
-Introduction goes here.
-
-
-Example
-=======
-
-Example goes here.
-
-
-Copyright (c) <%= Date.today.year %> [name of plugin creator], released under the MIT license
diff --git a/railties/lib/rails/generators/rails/plugin/templates/Rakefile.tt b/railties/lib/rails/generators/rails/plugin/templates/Rakefile.tt
deleted file mode 100644
index c5afe79b86..0000000000
--- a/railties/lib/rails/generators/rails/plugin/templates/Rakefile.tt
+++ /dev/null
@@ -1,23 +0,0 @@
-#!/usr/bin/env rake
-require 'rake/testtask'
-require 'rdoc/task'
-
-desc 'Default: run unit tests.'
-task :default => :test
-
-desc 'Test the <%= file_name %> plugin.'
-Rake::TestTask.new(:test) do |t|
- t.libs << 'lib'
- t.libs << 'test'
- t.pattern = 'test/**/*_test.rb'
- t.verbose = true
-end
-
-desc 'Generate documentation for the <%= file_name %> plugin.'
-RDoc::Task.new(:rdoc) do |rdoc|
- rdoc.rdoc_dir = 'rdoc'
- rdoc.title = '<%= class_name %>'
- rdoc.options << '--line-numbers' << '--inline-source'
- rdoc.rdoc_files.include('README')
- rdoc.rdoc_files.include('lib/**/*.rb')
-end
diff --git a/railties/lib/rails/generators/rails/plugin/templates/init.rb b/railties/lib/rails/generators/rails/plugin/templates/init.rb
deleted file mode 100644
index 3c19a743c9..0000000000
--- a/railties/lib/rails/generators/rails/plugin/templates/init.rb
+++ /dev/null
@@ -1 +0,0 @@
-# Include hook code here
diff --git a/railties/lib/rails/generators/rails/plugin/templates/install.rb b/railties/lib/rails/generators/rails/plugin/templates/install.rb
deleted file mode 100644
index f7732d3796..0000000000
--- a/railties/lib/rails/generators/rails/plugin/templates/install.rb
+++ /dev/null
@@ -1 +0,0 @@
-# Install hook code here
diff --git a/railties/lib/rails/generators/rails/plugin/templates/lib/%file_name%.rb.tt b/railties/lib/rails/generators/rails/plugin/templates/lib/%file_name%.rb.tt
deleted file mode 100644
index d8d908a959..0000000000
--- a/railties/lib/rails/generators/rails/plugin/templates/lib/%file_name%.rb.tt
+++ /dev/null
@@ -1 +0,0 @@
-# <%= class_name %>
diff --git a/railties/lib/rails/generators/rails/plugin/templates/lib/tasks/%file_name%_tasks.rake.tt b/railties/lib/rails/generators/rails/plugin/templates/lib/tasks/%file_name%_tasks.rake.tt
deleted file mode 100644
index 72920a9d3a..0000000000
--- a/railties/lib/rails/generators/rails/plugin/templates/lib/tasks/%file_name%_tasks.rake.tt
+++ /dev/null
@@ -1,4 +0,0 @@
-# desc "Explaining what the task does"
-# task :<%= file_name %> do
-# # Task goes here
-# end
diff --git a/railties/lib/rails/generators/rails/plugin/templates/uninstall.rb b/railties/lib/rails/generators/rails/plugin/templates/uninstall.rb
deleted file mode 100644
index 9738333463..0000000000
--- a/railties/lib/rails/generators/rails/plugin/templates/uninstall.rb
+++ /dev/null
@@ -1 +0,0 @@
-# Uninstall hook code here
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 15299ddb9f..56b06829d8 100644
--- a/railties/lib/rails/generators/rails/plugin_new/templates/%name%.gemspec
+++ b/railties/lib/rails/generators/rails/plugin_new/templates/%name%.gemspec
@@ -5,5 +5,8 @@ Gem::Specification.new do |s|
s.summary = "Insert <%= camelized %> summary."
s.description = "Insert <%= camelized %> description."
s.files = Dir["{app,config,lib}/**/*"] + ["MIT-LICENSE", "Rakefile", "README.rdoc"]
+<% unless options.skip_test_unit? -%>
+ s.test_files = Dir["test/**/*"]
+<% end -%>
s.version = "0.0.1"
end
diff --git a/railties/lib/rails/generators/rails/plugin_new/templates/Rakefile b/railties/lib/rails/generators/rails/plugin_new/templates/Rakefile
index 1bf9c8c831..b28a842731 100755
--- a/railties/lib/rails/generators/rails/plugin_new/templates/Rakefile
+++ b/railties/lib/rails/generators/rails/plugin_new/templates/Rakefile
@@ -4,8 +4,13 @@ begin
rescue LoadError
puts 'You must `gem install bundler` and `bundle install` to run rake tasks'
end
-
-require 'rdoc/task'
+begin
+ require 'rdoc/task'
+rescue LoadError
+ require 'rdoc/rdoc'
+ require 'rake/rdoctask'
+ RDoc::Task = Rake::RDocTask
+end
RDoc::Task.new(:rdoc) do |rdoc|
rdoc.rdoc_dir = 'rdoc'
diff --git a/railties/lib/rails/generators/rails/plugin_new/templates/script/rails.tt b/railties/lib/rails/generators/rails/plugin_new/templates/script/rails.tt
index ebd5a77dd5..65d82abf6d 100644
--- a/railties/lib/rails/generators/rails/plugin_new/templates/script/rails.tt
+++ b/railties/lib/rails/generators/rails/plugin_new/templates/script/rails.tt
@@ -1,4 +1,3 @@
-#!/usr/bin/env ruby
# This command will automatically be run when you run "rails" with Rails 3 gems installed from the root of your application.
ENGINE_PATH = File.expand_path('../..', __FILE__)
diff --git a/railties/lib/rails/paths.rb b/railties/lib/rails/paths.rb
index 5d217dcb10..09ff0ef378 100644
--- a/railties/lib/rails/paths.rb
+++ b/railties/lib/rails/paths.rb
@@ -2,29 +2,11 @@ require 'set'
module Rails
module Paths
- module PathParent #:nodoc:
- def method_missing(id, *args)
- match = id.to_s.match(/^(.*)=$/)
- full = [@current, $1 || id].compact.join("/")
-
- ActiveSupport::Deprecation.warn 'config.paths.app.controller API is deprecated in ' <<
- 'favor of config.paths["app/controller"] API.'
-
- if match || args.any?
- @root[full] = Path.new(@root, full, *args)
- elsif path = @root[full]
- path
- else
- super
- end
- end
- end
-
# This object is an extended hash that behaves as root of the Rails::Paths system.
# It allows you to collect information about how you want to structure your application
# paths by a Hash like API. It requires you to give a physical path on initialization.
#
- # root = Root.new
+ # root = Root.new "/rails"
# root.add "app/controllers", :eager_load => true
#
# The command above creates a new root object and add "app/controllers" as a path.
@@ -54,8 +36,7 @@ module Rails
#
# Finally, the Path object also provides a few helpers:
#
- # root = Root.new
- # root.path = "/rails"
+ # root = Root.new "/rails"
# root.add "app/controllers"
#
# root["app/controllers"].expanded # => ["/rails/app/controllers"]
@@ -63,11 +44,10 @@ module Rails
#
# Check the Path documentation for more information.
class Root < ::Hash
- include PathParent
attr_accessor :path
def initialize(path)
- raise if path.is_a?(Array)
+ raise "Argument should be a String of the physical root path" if path.is_a?(Array)
@current = nil
@path = path
@root = self
@@ -121,8 +101,6 @@ module Rails
end
class Path < Array
- include PathParent
-
attr_reader :path
attr_accessor :glob
@@ -194,11 +172,6 @@ module Rails
expanded.select { |f| File.exists?(f) }
end
- def paths
- ActiveSupport::Deprecation.warn "paths is deprecated. Please call expand instead."
- expanded
- end
-
alias to_a expanded
end
end
diff --git a/railties/lib/rails/railtie/configuration.rb b/railties/lib/rails/railtie/configuration.rb
index bfd2a73aeb..f888684117 100644
--- a/railties/lib/rails/railtie/configuration.rb
+++ b/railties/lib/rails/railtie/configuration.rb
@@ -26,11 +26,6 @@ module Rails
@@app_generators
end
- def generators(&block) #:nodoc
- ActiveSupport::Deprecation.warn "config.generators in Rails::Railtie is deprecated. Please use config.app_generators instead."
- app_generators(&block)
- end
-
# First configurable block to run. Called before any initializers are run.
def before_configuration(&block)
ActiveSupport.on_load(:before_configuration, :yield => true, &block)
diff --git a/railties/lib/rails/tasks/assets.rake b/railties/lib/rails/tasks/assets.rake
index 158df31749..5d2f02af13 100644
--- a/railties/lib/rails/tasks/assets.rake
+++ b/railties/lib/rails/tasks/assets.rake
@@ -2,7 +2,7 @@ namespace :assets do
desc "Compile all the assets named in config.assets.precompile"
task :precompile => :environment do
# Give assets access to asset_path
- ActionView::Helpers::SprocketsHelper
+ Sprockets::Helpers::RailsHelper
assets = Rails.application.config.assets.precompile
Rails.application.assets.precompile(*assets)
diff --git a/railties/lib/rails/tasks/documentation.rake b/railties/lib/rails/tasks/documentation.rake
index c8b4040151..79255d1f56 100644
--- a/railties/lib/rails/tasks/documentation.rake
+++ b/railties/lib/rails/tasks/documentation.rake
@@ -1,4 +1,10 @@
-require 'rdoc/task'
+begin
+ require 'rdoc/task'
+rescue LoadError
+ require 'rdoc/rdoc'
+ require 'rake/rdoctask'
+ RDoc::Task = Rake::RDocTask
+end
# Monkey-patch to remove redoc'ing and clobber descriptions to cut down on rake -T noise
class RDocTaskWithoutDescriptions < RDoc::Task
diff --git a/railties/test/application/generators_test.rb b/railties/test/application/generators_test.rb
index 8b840fffd0..1ca9515335 100644
--- a/railties/test/application/generators_test.rb
+++ b/railties/test/application/generators_test.rb
@@ -68,8 +68,7 @@ module ApplicationTests
# Initialize the application
require "#{app_path}/config/environment"
- require "rails/generators"
- Rails::Generators.configure!
+ Rails.application.load_generators
assert_equal :rspec, Rails::Generators.options[:rails][:test_framework]
assert_equal "-w", Rails::Generators.aliases[:rails][:test_framework]
@@ -84,8 +83,7 @@ module ApplicationTests
# Initialize the application
require "#{app_path}/config/environment"
- require "rails/generators"
- Rails::Generators.configure!
+ Rails.application.load_generators
assert_equal Thor::Base.shell, Thor::Shell::Basic
end
diff --git a/railties/test/application/paths_test.rb b/railties/test/application/paths_test.rb
index b1ff6e9cb1..03e0247556 100644
--- a/railties/test/application/paths_test.rb
+++ b/railties/test/application/paths_test.rb
@@ -61,7 +61,7 @@ module ApplicationTests
end
test "environments has a glob equal to the current environment" do
- assert_equal "#{Rails.env}.rb", @paths.config.environments.glob
+ assert_equal "#{Rails.env}.rb", @paths["config/environments"].glob
end
test "load path includes each of the paths in config.paths as long as the directories exist" do
diff --git a/railties/test/generators/generators_test_helper.rb b/railties/test/generators/generators_test_helper.rb
index 91ab648297..7fdd54fc30 100644
--- a/railties/test/generators/generators_test_helper.rb
+++ b/railties/test/generators/generators_test_helper.rb
@@ -12,7 +12,7 @@ Rails.application.config.generators.templates = [File.join(Rails.root, "lib", "t
# Call configure to load the settings from
# Rails.application.config.generators to Rails::Generators
-Rails::Generators.configure!(Rails.application.config.generators)
+Rails.application.load_generators
require 'active_record'
require 'action_dispatch'
diff --git a/railties/test/generators/plugin_generator_test.rb b/railties/test/generators/plugin_generator_test.rb
deleted file mode 100644
index 5c0774ddbd..0000000000
--- a/railties/test/generators/plugin_generator_test.rb
+++ /dev/null
@@ -1,71 +0,0 @@
-require 'generators/generators_test_helper'
-require 'rails/generators/rails/plugin/plugin_generator'
-
-class PluginGeneratorTest < Rails::Generators::TestCase
- include GeneratorsTestHelper
- arguments %w(plugin_fu)
-
- def test_plugin_skeleton_is_created
- silence(:stderr) { run_generator }
- year = Date.today.year
-
- %w(
- vendor/plugins
- vendor/plugins/plugin_fu
- vendor/plugins/plugin_fu/init.rb
- vendor/plugins/plugin_fu/install.rb
- vendor/plugins/plugin_fu/uninstall.rb
- vendor/plugins/plugin_fu/lib
- vendor/plugins/plugin_fu/lib/plugin_fu.rb
- vendor/plugins/plugin_fu/Rakefile
- ).each{ |path| assert_file path }
-
- %w(
- vendor/plugins/plugin_fu/README
- ).each{ |path| assert_file path, /PluginFu/ }
-
- %w(
- vendor/plugins/plugin_fu/README
- vendor/plugins/plugin_fu/MIT-LICENSE
- ).each{ |path| assert_file path, /#{year}/ }
- end
-
- def test_check_class_collision
- content = capture(:stderr){ run_generator ["object"] }
- assert_match(/The name 'Object' is either already used in your application or reserved/, content)
- end
-
- def test_invokes_default_test_framework
- silence(:stderr) { run_generator }
- assert_file "vendor/plugins/plugin_fu/test/plugin_fu_test.rb", /class PluginFuTest < ActiveSupport::TestCase/
- assert_file "vendor/plugins/plugin_fu/test/test_helper.rb"
- end
-
- def test_logs_if_the_test_framework_cannot_be_found
- content = nil
- silence(:stderr) { content = run_generator ["plugin_fu", "--test-framework=rspec"] }
- assert_match(/rspec \[not found\]/, content)
- end
-
- def test_creates_tasks_if_required
- silence(:stderr) { run_generator ["plugin_fu", "--tasks"] }
- assert_file "vendor/plugins/plugin_fu/lib/tasks/plugin_fu_tasks.rake"
- end
-
- def test_creates_generator_if_required
- silence(:stderr) { run_generator ["plugin_fu", "--generator"] }
- assert_file "vendor/plugins/plugin_fu/lib/generators/templates"
- assert_file "vendor/plugins/plugin_fu/lib/generators/plugin_fu_generator.rb",
- /class PluginFuGenerator < Rails::Generators::NamedBase/
- end
-
- def test_plugin_generator_on_revoke
- silence(:stderr) { run_generator }
- run_generator ["plugin_fu"], :behavior => :revoke
- end
-
- def test_deprecation
- output = capture(:stderr) { run_generator }
- assert_match(/Plugin generator is deprecated, please use 'rails plugin new' command to generate plugin structure./, output)
- end
-end
diff --git a/railties/test/generators/plugin_new_generator_test.rb b/railties/test/generators/plugin_new_generator_test.rb
index 5ffc2501cd..b93e33f61a 100644
--- a/railties/test/generators/plugin_new_generator_test.rb
+++ b/railties/test/generators/plugin_new_generator_test.rb
@@ -173,16 +173,22 @@ class PluginNewGeneratorTest < Rails::Generators::TestCase
run_generator
assert_file "bukkits.gemspec", /s.name = "bukkits"/
assert_file "bukkits.gemspec", /s.files = Dir\["\{app,config,lib\}\/\*\*\/\*"\]/
+ assert_file "bukkits.gemspec", /s.test_files = Dir\["test\/\*\*\/\*"\]/
assert_file "bukkits.gemspec", /s.version = "0.0.1"/
end
+ def test_shebang
+ run_generator
+ assert_file "script/rails", /#!\/usr\/bin\/env ruby/
+ 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"
@@ -190,6 +196,14 @@ class PluginNewGeneratorTest < Rails::Generators::TestCase
assert_no_file "test"
end
+ def test_skipping_test_unit
+ run_generator [destination_root, "--skip-test-unit"]
+ assert_no_file "test"
+ assert_file "bukkits.gemspec" do |contents|
+ assert_no_match /s.test_files = Dir\["test\/\*\*\/\*"\]/, contents
+ end
+ end
+
def test_skipping_gemspec
run_generator [destination_root, "--skip-gemspec"]
assert_no_file "bukkits.gemspec"
diff --git a/railties/test/generators_test.rb b/railties/test/generators_test.rb
index 1264ac7764..301ae80bcf 100644
--- a/railties/test/generators_test.rb
+++ b/railties/test/generators_test.rb
@@ -185,13 +185,6 @@ class GeneratorsTest < Rails::Generators::TestCase
Rails::Generators.subclasses.delete(WithOptionsGenerator)
end
- def test_load_generators_from_railties
- Rails::Generators::ModelGenerator.expects(:start).with(["Account"], {})
- Rails::Generators.send(:remove_instance_variable, :@generators_from_railties)
- Rails.application.expects(:load_generators)
- Rails::Generators.invoke("model", ["Account"])
- end
-
def test_rails_root_templates
template = File.join(Rails.root, "lib", "templates", "active_record", "model", "model.rb")
diff --git a/railties/test/paths_test.rb b/railties/test/paths_test.rb
index 6e4e3446b3..c0f3887263 100644
--- a/railties/test/paths_test.rb
+++ b/railties/test/paths_test.rb
@@ -227,57 +227,4 @@ class PathsTest < ActiveSupport::TestCase
assert @root["app"].autoload?
assert_equal ["/app"], @root.autoload_paths
end
-
- # Deprecated API tests
-
- test "reading a root level path with assignment" do
- @root.add "app"
- assert_deprecated do
- assert_equal ["/foo/bar/app"], @root.app.to_a
- end
- end
-
- test "creating a root level path with assignment" do
- assert_deprecated do
- @root.app = "/foo/bar"
- end
- assert_equal ["/foo/bar"], @root["app"].to_a
- end
-
- test "creating a root level path without assignment" do
- assert_deprecated do
- @root.app "/foo/bar"
- end
- assert_equal ["/foo/bar"], @root["app"].to_a
- end
-
- test "reading a nested level path with assignment" do
- @root.add "app"
- @root.add "app/model"
- assert_deprecated do
- assert_equal ["/foo/bar/app/model"], @root.app.model.to_a
- end
- end
-
- test "creating a nested level path with assignment" do
- @root.add "app"
- assert_deprecated do
- @root.app.model = "/foo/bar"
- end
- assert_equal ["/foo/bar"], @root["app/model"].to_a
- end
-
- test "creating a nested level path without assignment" do
- @root.add "app"
- assert_deprecated do
- @root.app.model "/foo/bar"
- end
- assert_equal ["/foo/bar"], @root["app/model"].to_a
- end
-
- test "trying to access a path that does not exist raises NoMethodError" do
- assert_deprecated do
- assert_raises(NoMethodError) { @root.app }
- end
- end
end