aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAaron Patterson <aaron.patterson@gmail.com>2014-01-13 16:16:19 -0800
committerAaron Patterson <aaron.patterson@gmail.com>2014-01-13 16:16:19 -0800
commitbf48af53600e3e535cc4d0cfe9654c40023a7f70 (patch)
tree94db1f852c79c75d100f627615c2ba9cb8d440ec
parentaec4aa1702753f29ae79787c743f6f047ad9a80d (diff)
parentf1764a2de17bba07bad3ec0d88de152d8279d3bb (diff)
downloadrails-bf48af53600e3e535cc4d0cfe9654c40023a7f70.tar.gz
rails-bf48af53600e3e535cc4d0cfe9654c40023a7f70.tar.bz2
rails-bf48af53600e3e535cc4d0cfe9654c40023a7f70.zip
Merge branch 'master' into set_binds
* master: (24 commits) unscope should remove bind values associated with the where reverse_order_value= is not private, so no need to send avoid more dynamic symbols no need to to_sym recover from test runs that leave the database in a bad state updates screenshot data [ci skip] "serie" => "series" revises a few things in the getting started guide [ci skip] Favor canonical environment variables for secrets removed extra comma [ci skip] Only lookup `config.log_level` for stdlib `::Logger`. Closes #11665. Updated Changelog to reflect removal of :dependent => :restrict standardize on jruby_skip & rbx_skip fix bug in becomes! when changing from base to subclass. Closes #13272. highlight http://localhost:3000 in README.md. Closes #13643. [ci skip] doc proc/lambda arg on inclusion validation. Closes #13689. [ci skip] Skip Spring App Generator tests on JRuby fixes a typo in a CHANGELOG upgrade SDoc fixes the Gemfile generator templates ... Conflicts: activerecord/test/cases/hot_compatibility_test.rb
-rw-r--r--Gemfile2
-rw-r--r--README.md3
-rw-r--r--actionmailer/lib/action_mailer/base.rb2
-rw-r--r--actionmailer/test/abstract_unit.rb9
-rw-r--r--actionpack/test/abstract_unit.rb9
-rw-r--r--actionpack/test/dispatch/static_test.rb4
-rw-r--r--actionview/test/abstract_unit.rb8
-rw-r--r--actionview/test/template/form_collections_helper_test.rb4
-rw-r--r--activemodel/lib/active_model/validations/inclusion.rb3
-rw-r--r--activerecord/CHANGELOG.md6
-rw-r--r--activerecord/lib/active_record/enum.rb3
-rw-r--r--activerecord/lib/active_record/persistence.rb6
-rw-r--r--activerecord/lib/active_record/relation/query_methods.rb10
-rw-r--r--activerecord/test/cases/enum_test.rb4
-rw-r--r--activerecord/test/cases/hot_compatibility_test.rb2
-rw-r--r--activerecord/test/cases/inheritance_test.rb11
-rw-r--r--activerecord/test/cases/relations_test.rb9
-rw-r--r--activesupport/lib/active_support/core_ext/range/each.rb3
-rw-r--r--activesupport/lib/active_support/core_ext/string/output_safety.rb24
-rw-r--r--activesupport/test/abstract_unit.rb2
-rw-r--r--activesupport/test/core_ext/range_ext_test.rb4
-rw-r--r--guides/assets/images/getting_started/rails_welcome.jpgbin0 -> 293182 bytes
-rw-r--r--guides/assets/images/getting_started/rails_welcome.pngbin50433 -> 0 bytes
-rw-r--r--guides/code/getting_started/Gemfile41
-rw-r--r--guides/code/getting_started/Gemfile.lock138
-rw-r--r--guides/source/getting_started.md83
-rw-r--r--guides/source/upgrading_ruby_on_rails.md4
-rw-r--r--railties/CHANGELOG.md13
-rw-r--r--railties/lib/rails/application/bootstrap.rb6
-rw-r--r--railties/lib/rails/generators/app_base.rb2
-rw-r--r--railties/lib/rails/generators/rails/app/templates/Gemfile6
-rw-r--r--railties/lib/rails/generators/rails/app/templates/config/secrets.yml2
-rw-r--r--railties/lib/rails/generators/rails/plugin/templates/Gemfile6
-rw-r--r--railties/lib/rails/generators/testing/behaviour.rb16
-rw-r--r--railties/test/abstract_unit.rb9
-rw-r--r--railties/test/application/configuration_test.rb15
-rw-r--r--railties/test/generators/app_generator_test.rb6
-rw-r--r--railties/test/isolation/abstract_unit.rb4
38 files changed, 291 insertions, 188 deletions
diff --git a/Gemfile b/Gemfile
index ebc4312f64..88f3686e95 100644
--- a/Gemfile
+++ b/Gemfile
@@ -18,7 +18,7 @@ gem 'coffee-rails', '~> 4.0.0'
gem 'uglifier', '>= 1.3.0', require: false
group :doc do
- gem 'sdoc'
+ gem 'sdoc', '~> 0.4.0'
gem 'redcarpet', '~> 2.2.2', platforms: :ruby
gem 'w3c_validators'
gem 'kindlerb'
diff --git a/README.md b/README.md
index 5a68a166be..fcdcc2d87c 100644
--- a/README.md
+++ b/README.md
@@ -59,7 +59,8 @@ independently outside Rails.
Run with `--help` or `-h` for options.
-4. Using a browser, go to http://localhost:3000 and you'll see: "Welcome aboard: You're riding Ruby on Rails!"
+4. Using a browser, go to `http://localhost:3000` and you'll see:
+"Welcome aboard: You're riding Ruby on Rails!"
5. Follow the guidelines to start developing your application. You may find
the following resources handy:
diff --git a/actionmailer/lib/action_mailer/base.rb b/actionmailer/lib/action_mailer/base.rb
index 275f657f8a..a30e3e65da 100644
--- a/actionmailer/lib/action_mailer/base.rb
+++ b/actionmailer/lib/action_mailer/base.rb
@@ -674,7 +674,7 @@ module ActionMailer
# For example:
#
# class Notifier < ActionMailer::Base
- # default from: 'no-reply@test.lindsaar.net',
+ # default from: 'no-reply@test.lindsaar.net'
#
# def welcome
# mail(to: 'mikel@test.lindsaar.net')
diff --git a/actionmailer/test/abstract_unit.rb b/actionmailer/test/abstract_unit.rb
index cf790c7487..93d16f491d 100644
--- a/actionmailer/test/abstract_unit.rb
+++ b/actionmailer/test/abstract_unit.rb
@@ -62,3 +62,12 @@ end
def restore_delivery_method
ActionMailer::Base.delivery_method = @old_delivery_method
end
+
+# Skips the current run on Rubinius using Minitest::Assertions#skip
+def rubinius_skip(message = '')
+ skip message if RUBY_ENGINE == 'rbx'
+end
+# Skips the current run on JRuby using Minitest::Assertions#skip
+def jruby_skip(message = '')
+ skip message if defined?(JRUBY_VERSION)
+end
diff --git a/actionpack/test/abstract_unit.rb b/actionpack/test/abstract_unit.rb
index 37e993b4e5..03a4741f42 100644
--- a/actionpack/test/abstract_unit.rb
+++ b/actionpack/test/abstract_unit.rb
@@ -351,3 +351,12 @@ module Backoffice
class ImagesController < ResourcesController; end
end
end
+
+# Skips the current run on Rubinius using Minitest::Assertions#skip
+def rubinius_skip(message = '')
+ skip message if RUBY_ENGINE == 'rbx'
+end
+# Skips the current run on JRuby using Minitest::Assertions#skip
+def jruby_skip(message = '')
+ skip message if defined?(JRUBY_VERSION)
+end
diff --git a/actionpack/test/dispatch/static_test.rb b/actionpack/test/dispatch/static_test.rb
index d83461e52f..5bd1806b21 100644
--- a/actionpack/test/dispatch/static_test.rb
+++ b/actionpack/test/dispatch/static_test.rb
@@ -37,10 +37,8 @@ module StaticTests
end
def test_served_static_file_with_non_english_filename
- if RUBY_ENGINE == 'jruby '
- skip "Stop skipping if following bug gets fixed: " \
+ jruby_skip "Stop skipping if following bug gets fixed: " \
"http://jira.codehaus.org/browse/JRUBY-7192"
- end
assert_html "means hello in Japanese\n", get("/foo/#{Rack::Utils.escape("こんにちは.html")}")
end
diff --git a/actionview/test/abstract_unit.rb b/actionview/test/abstract_unit.rb
index 9928da4774..9eae3a4fbd 100644
--- a/actionview/test/abstract_unit.rb
+++ b/actionview/test/abstract_unit.rb
@@ -331,3 +331,11 @@ module ActionDispatch
end
end
+# Skips the current run on Rubinius using Minitest::Assertions#skip
+def rubinius_skip(message = '')
+ skip message if RUBY_ENGINE == 'rbx'
+end
+# Skips the current run on JRuby using Minitest::Assertions#skip
+def jruby_skip(message = '')
+ skip message if defined?(JRUBY_VERSION)
+end
diff --git a/actionview/test/template/form_collections_helper_test.rb b/actionview/test/template/form_collections_helper_test.rb
index 7a62b9d907..18632465db 100644
--- a/actionview/test/template/form_collections_helper_test.rb
+++ b/actionview/test/template/form_collections_helper_test.rb
@@ -182,7 +182,7 @@ class FormCollectionsHelperTest < ActionView::TestCase
end
# COLLECTION CHECK BOXES
- test 'collection check boxes accepts a collection and generate a serie of checkboxes for value method' do
+ test 'collection check boxes accepts a collection and generate a series of checkboxes for value method' do
collection = [Category.new(1, 'Category 1'), Category.new(2, 'Category 2')]
with_collection_check_boxes :user, :category_ids, collection, :id, :name
@@ -204,7 +204,7 @@ class FormCollectionsHelperTest < ActionView::TestCase
assert_select "input[type=hidden][name='user[other_category_ids][]'][value=]", :count => 1
end
- test 'collection check boxes accepts a collection and generate a serie of checkboxes with labels for label method' do
+ test 'collection check boxes accepts a collection and generate a series of checkboxes with labels for label method' do
collection = [Category.new(1, 'Category 1'), Category.new(2, 'Category 2')]
with_collection_check_boxes :user, :category_ids, collection, :id, :name
diff --git a/activemodel/lib/active_model/validations/inclusion.rb b/activemodel/lib/active_model/validations/inclusion.rb
index 24337614c5..b344095807 100644
--- a/activemodel/lib/active_model/validations/inclusion.rb
+++ b/activemodel/lib/active_model/validations/inclusion.rb
@@ -29,7 +29,8 @@ module ActiveModel
# * <tt>:in</tt> - An enumerable object of available items. This can be
# supplied as a proc, lambda or symbol which returns an enumerable. If the
# enumerable is a numerical range the test is performed with <tt>Range#cover?</tt>,
- # otherwise with <tt>include?</tt>.
+ # otherwise with <tt>include?</tt>. When using a proc or lambda the instance
+ # under validation is passed as an argument.
# * <tt>:within</tt> - A synonym(or alias) for <tt>:in</tt>
# * <tt>:message</tt> - Specifies a custom error message (default is: "is
# not included in the list").
diff --git a/activerecord/CHANGELOG.md b/activerecord/CHANGELOG.md
index d9f8ee7097..f57158f38e 100644
--- a/activerecord/CHANGELOG.md
+++ b/activerecord/CHANGELOG.md
@@ -1,3 +1,9 @@
+* Fix bug in `becomes!` when changing from the base model to a STI sub-class.
+
+ Fixes #13272.
+
+ *the-web-dev*, *Yves Senn*
+
* Currently Active Record can be configured via the environment variable
`DATABASE_URL` or by manually injecting a hash of values which is what Rails does,
reading in `database.yml` and setting Active Record appropriately. Active Record
diff --git a/activerecord/lib/active_record/enum.rb b/activerecord/lib/active_record/enum.rb
index 9ad718a02a..d1bc785bee 100644
--- a/activerecord/lib/active_record/enum.rb
+++ b/activerecord/lib/active_record/enum.rb
@@ -87,6 +87,9 @@ module ActiveRecord
# def status() STATUS.key self[:status] end
define_method(name) { enum_values.key self[name] }
+ # def status_before_type_cast() STATUS.key self[:status] end
+ define_method("#{name}_before_type_cast") { enum_values.key self[name] }
+
pairs = values.respond_to?(:each_pair) ? values.each_pair : values.each_with_index
pairs.each do |value, i|
enum_values[value] = i
diff --git a/activerecord/lib/active_record/persistence.rb b/activerecord/lib/active_record/persistence.rb
index 4669c072a1..460fbdb3f8 100644
--- a/activerecord/lib/active_record/persistence.rb
+++ b/activerecord/lib/active_record/persistence.rb
@@ -196,7 +196,11 @@ module ActiveRecord
# share the same set of attributes.
def becomes!(klass)
became = becomes(klass)
- became.public_send("#{klass.inheritance_column}=", klass.sti_name) unless self.class.descends_from_active_record?
+ sti_type = nil
+ if !klass.descends_from_active_record?
+ sti_type = klass.sti_name
+ end
+ became.public_send("#{klass.inheritance_column}=", sti_type)
became
end
diff --git a/activerecord/lib/active_record/relation/query_methods.rb b/activerecord/lib/active_record/relation/query_methods.rb
index 7571208a88..0f5fe7ea51 100644
--- a/activerecord/lib/active_record/relation/query_methods.rb
+++ b/activerecord/lib/active_record/relation/query_methods.rb
@@ -858,11 +858,11 @@ module ActiveRecord
end
single_val_method = Relation::SINGLE_VALUE_METHODS.include?(scope)
- unscope_code = :"#{scope}_value#{'s' unless single_val_method}="
+ unscope_code = "#{scope}_value#{'s' unless single_val_method}="
case scope
when :order
- self.send(:reverse_order_value=, false)
+ self.reverse_order_value = false
result = []
else
result = [] unless single_val_method
@@ -872,17 +872,19 @@ module ActiveRecord
end
def where_unscoping(target_value)
- target_value_sym = target_value.to_sym
+ target_value = target_value.to_s
where_values.reject! do |rel|
case rel
when Arel::Nodes::In, Arel::Nodes::NotIn, Arel::Nodes::Equality, Arel::Nodes::NotEqual
subrelation = (rel.left.kind_of?(Arel::Attributes::Attribute) ? rel.left : rel.right)
- subrelation.name.to_sym == target_value_sym
+ subrelation.name == target_value
else
raise "unscope(where: #{target_value.inspect}) failed: unscoping #{rel.class} is unimplemented."
end
end
+
+ bind_values.reject! { |col,_| col.name == target_value }
end
def custom_join_ast(table, joins)
diff --git a/activerecord/test/cases/enum_test.rb b/activerecord/test/cases/enum_test.rb
index c09e58fbf1..0075df8b8d 100644
--- a/activerecord/test/cases/enum_test.rb
+++ b/activerecord/test/cases/enum_test.rb
@@ -88,4 +88,8 @@ class EnumTest < ActiveRecord::TestCase
assert Book.written.create.written?
assert Book.read.create.read?
end
+
+ test "_before_type_cast returns the enum label (required for form fields)" do
+ assert_equal "proposed", @book.status_before_type_cast
+ end
end
diff --git a/activerecord/test/cases/hot_compatibility_test.rb b/activerecord/test/cases/hot_compatibility_test.rb
index e671979bcf..367d04a154 100644
--- a/activerecord/test/cases/hot_compatibility_test.rb
+++ b/activerecord/test/cases/hot_compatibility_test.rb
@@ -5,7 +5,7 @@ class HotCompatibilityTest < ActiveRecord::TestCase
setup do
@klass = Class.new(ActiveRecord::Base) do
- connection.create_table :hot_compatibilities, :force => true do |t|
+ connection.create_table :hot_compatibilities, force: true do |t|
t.string :foo
t.string :bar
end
diff --git a/activerecord/test/cases/inheritance_test.rb b/activerecord/test/cases/inheritance_test.rb
index cb0d374ef7..7fd7d42354 100644
--- a/activerecord/test/cases/inheritance_test.rb
+++ b/activerecord/test/cases/inheritance_test.rb
@@ -128,6 +128,17 @@ class InheritanceTest < ActiveRecord::TestCase
assert_kind_of Cabbage, cabbage
end
+ def test_alt_becomes_bang_resets_inheritance_type_column
+ vegetable = Vegetable.create!(name: "Red Pepper")
+ assert_nil vegetable.custom_type
+
+ cabbage = vegetable.becomes!(Cabbage)
+ assert_equal "Cabbage", cabbage.custom_type
+
+ vegetable = cabbage.becomes!(Vegetable)
+ assert_nil cabbage.custom_type
+ end
+
def test_inheritance_find_all
companies = Company.all.merge!(:order => 'id').to_a
assert_kind_of Firm, companies[0], "37signals should be a firm"
diff --git a/activerecord/test/cases/relations_test.rb b/activerecord/test/cases/relations_test.rb
index 031da8e6d6..a0896f7f8d 100644
--- a/activerecord/test/cases/relations_test.rb
+++ b/activerecord/test/cases/relations_test.rb
@@ -1524,6 +1524,15 @@ class RelationTest < ActiveRecord::TestCase
assert merged.to_sql.include?("bbq")
end
+ def test_unscope_removes_binds
+ left = Post.where(id: Arel::Nodes::BindParam.new('?'))
+ column = Post.columns_hash['id']
+ left.bind_values += [[column, 20]]
+
+ relation = left.unscope(where: :id)
+ assert_equal [], relation.bind_values
+ end
+
def test_merging_removes_rhs_bind_parameters
left = Post.where(id: Arel::Nodes::BindParam.new('?'))
column = Post.columns_hash['id']
diff --git a/activesupport/lib/active_support/core_ext/range/each.rb b/activesupport/lib/active_support/core_ext/range/each.rb
index d51ea2e944..ecef78f55f 100644
--- a/activesupport/lib/active_support/core_ext/range/each.rb
+++ b/activesupport/lib/active_support/core_ext/range/each.rb
@@ -1,5 +1,4 @@
require 'active_support/core_ext/module/aliasing'
-require 'active_support/core_ext/object/acts_like'
class Range #:nodoc:
@@ -17,7 +16,7 @@ class Range #:nodoc:
private
def ensure_iteration_allowed
- if first.acts_like?(:time)
+ if first.is_a?(Time)
raise TypeError, "can't iterate from #{first.class}"
end
end
diff --git a/activesupport/lib/active_support/core_ext/string/output_safety.rb b/activesupport/lib/active_support/core_ext/string/output_safety.rb
index 1b20507c0b..eb02b6a442 100644
--- a/activesupport/lib/active_support/core_ext/string/output_safety.rb
+++ b/activesupport/lib/active_support/core_ext/string/output_safety.rb
@@ -70,9 +70,20 @@ class ERB
# them inside a script tag to avoid XSS vulnerability:
#
# <script>
- # var currentUser = <%= json_escape current_user.to_json %>;
+ # var currentUser = <%= raw json_escape(current_user.to_json) %>;
# </script>
#
+ # It is necessary to +raw+ the result of +json_escape+, so that quotation marks
+ # don't get converted to <tt>&quot;</tt> entities. +json_escape+ doesn't
+ # automatically flag the result as HTML safe, since the raw value is unsafe to
+ # use inside HTML attributes.
+ #
+ # If you need to output JSON elsewhere in your HTML, you can just do something
+ # like this, as any unsafe characters (including quotation marks) will be
+ # automatically escaped for you:
+ #
+ # <div data-user-info="<%= current_user.to_json %>">...</div>
+ #
# WARNING: this helper only works with valid JSON. Using this on non-JSON values
# will open up serious XSS vulnerabilities. For example, if you replace the
# +current_user.to_json+ in the example above with user input instead, the browser
@@ -88,17 +99,6 @@ class ERB
# is recommended that you always apply this helper (other libraries, such as the
# JSON gem, do not provide this kind of protection by default; also some gems
# might override +to_json+ to bypass Active Support's encoder).
- #
- # The output of this helper method is marked as HTML safe so that you can directly
- # include it inside a <tt><script></tt> tag as shown above.
- #
- # However, it is NOT safe to use the output of this inside an HTML attribute,
- # because quotation marks are not escaped. Doing so might break your page's layout.
- # If you intend to use this inside an HTML attribute, you should use the
- # +html_escape+ helper (or its +h+ alias) instead:
- #
- # <div data-user-info="<%= h current_user.to_json %>">...</div>
- #
def json_escape(s)
result = s.to_s.gsub(JSON_ESCAPE_REGEXP, JSON_ESCAPE)
s.html_safe? ? result.html_safe : result
diff --git a/activesupport/test/abstract_unit.rb b/activesupport/test/abstract_unit.rb
index 1dfa3833f0..0b393e0c7a 100644
--- a/activesupport/test/abstract_unit.rb
+++ b/activesupport/test/abstract_unit.rb
@@ -34,5 +34,5 @@ end
# Skips the current run on JRuby using Minitest::Assertions#skip
def jruby_skip(message = '')
- skip message if RUBY_ENGINE == 'jruby'
+ skip message if defined?(JRUBY_VERSION)
end
diff --git a/activesupport/test/core_ext/range_ext_test.rb b/activesupport/test/core_ext/range_ext_test.rb
index 6d6afc85c4..150e6b65fb 100644
--- a/activesupport/test/core_ext/range_ext_test.rb
+++ b/activesupport/test/core_ext/range_ext_test.rb
@@ -112,4 +112,8 @@ class RangeTest < ActiveSupport::TestCase
end
end
+ def test_date_time_with_each
+ datetime = DateTime.now
+ assert ((datetime - 1.hour)..datetime).each {}
+ end
end
diff --git a/guides/assets/images/getting_started/rails_welcome.jpg b/guides/assets/images/getting_started/rails_welcome.jpg
new file mode 100644
index 0000000000..65a44cdfe5
--- /dev/null
+++ b/guides/assets/images/getting_started/rails_welcome.jpg
Binary files differ
diff --git a/guides/assets/images/getting_started/rails_welcome.png b/guides/assets/images/getting_started/rails_welcome.png
deleted file mode 100644
index 569dd846a8..0000000000
--- a/guides/assets/images/getting_started/rails_welcome.png
+++ /dev/null
Binary files differ
diff --git a/guides/code/getting_started/Gemfile b/guides/code/getting_started/Gemfile
index d573488bdb..a2155c43b9 100644
--- a/guides/code/getting_started/Gemfile
+++ b/guides/code/getting_started/Gemfile
@@ -1,43 +1,40 @@
source 'https://rubygems.org'
-gem 'rails', '4.0.0'
+# Bundle edge Rails instead: gem 'rails', github: 'rails/rails'
+gem 'rails', '4.1.0'
# Use sqlite3 as the database for Active Record
gem 'sqlite3'
-
# Use SCSS for stylesheets
-gem 'sass-rails'
-
+gem 'sass-rails', '~> 4.0.1'
+# Use Uglifier as compressor for JavaScript assets
+gem 'uglifier', '>= 1.3.0'
# Use CoffeeScript for .js.coffee assets and views
-gem 'coffee-rails'
-
+gem 'coffee-rails', '~> 4.0.0'
# See https://github.com/sstephenson/execjs#readme for more supported runtimes
-# gem 'therubyracer', platforms: :ruby
-
-# Use Uglifier as compressor for JavaScript assets
-gem 'uglifier', '>= 1.0.3'
+# gem 'therubyracer', platforms: :ruby
+# Use jquery as the JavaScript library
gem 'jquery-rails'
-
# Turbolinks makes following links in your web application faster. Read more: https://github.com/rails/turbolinks
gem 'turbolinks'
-
-group :doc do
- # bundle exec rake doc:rails generates the API under doc/api.
- gem 'sdoc', require: false
-end
-
# Build JSON APIs with ease. Read more: https://github.com/rails/jbuilder
gem 'jbuilder', '~> 2.0'
+# bundle exec rake doc:rails generates the API under doc/api.
+gem 'sdoc', '~> 0.4.0', group: :doc
-# To use ActiveModel has_secure_password
+# Spring speeds up development by keeping your application running in the background. Read more: https://github.com/jonleighton/spring
+gem 'spring', group: :development
+
+# Use ActiveModel has_secure_password
# gem 'bcrypt-ruby', '~> 3.1.2'
# Use unicorn as the app server
# gem 'unicorn'
-# Deploy with Capistrano
-# gem 'capistrano', group: :development
+# Use Capistrano for deployment
+# gem 'capistrano-rails', group: :development
+
+# Use debugger
+# gem 'debugger', group: [:development, :test]
-# To use debugger
-# gem 'debugger'
diff --git a/guides/code/getting_started/Gemfile.lock b/guides/code/getting_started/Gemfile.lock
index 1c30ac5d75..a2ab76c908 100644
--- a/guides/code/getting_started/Gemfile.lock
+++ b/guides/code/getting_started/Gemfile.lock
@@ -1,120 +1,126 @@
GEM
remote: https://rubygems.org/
specs:
- actionmailer (4.0.0)
- actionpack (= 4.0.0)
- mail (~> 2.5.3)
- actionpack (4.0.0)
- activesupport (= 4.0.0)
- builder (~> 3.1.0)
- erubis (~> 2.7.0)
+ actionmailer (4.1.0)
+ actionpack (= 4.1.0)
+ actionview (= 4.1.0)
+ mail (~> 2.5.4)
+ actionpack (4.1.0)
+ actionview (= 4.1.0)
+ activesupport (= 4.1.0)
rack (~> 1.5.2)
rack-test (~> 0.6.2)
- activemodel (4.0.0)
- activesupport (= 4.0.0)
- builder (~> 3.1.0)
- activerecord (4.0.0)
- activemodel (= 4.0.0)
- activerecord-deprecated_finders (~> 1.0.2)
- activesupport (= 4.0.0)
- arel (~> 4.0.0)
- activerecord-deprecated_finders (1.0.3)
- activesupport (4.0.0)
- i18n (~> 0.6, >= 0.6.4)
- minitest (~> 4.2)
- multi_json (~> 1.3)
+ actionview (4.1.0)
+ activesupport (= 4.1.0)
+ builder (~> 3.1)
+ erubis (~> 2.7.0)
+ activemodel (4.1.0)
+ activesupport (= 4.1.0)
+ builder (~> 3.1)
+ activerecord (4.1.0)
+ activemodel (= 4.1.0)
+ activesupport (= 4.1.0)
+ arel (~> 5.0.0)
+ activesupport (4.1.0)
+ i18n (~> 0.6, >= 0.6.9)
+ json (~> 1.7, >= 1.7.7)
+ minitest (~> 5.1)
thread_safe (~> 0.1)
- tzinfo (~> 0.3.37)
- arel (4.0.0)
- atomic (1.1.10)
- builder (3.1.4)
- coffee-rails (4.0.0)
+ tzinfo (~> 1.1)
+ arel (5.0.0)
+ atomic (1.1.14)
+ builder (3.2.2)
+ coffee-rails (4.0.1)
coffee-script (>= 2.2.0)
- railties (>= 4.0.0.beta, < 5.0)
+ railties (>= 4.0.0, < 5.0)
coffee-script (2.2.0)
coffee-script-source
execjs
coffee-script-source (1.6.3)
erubis (2.7.0)
- execjs (1.4.0)
- multi_json (~> 1.0)
+ execjs (2.0.2)
hike (1.2.3)
- i18n (0.6.4)
- jbuilder (2.0.0)
+ i18n (0.6.9)
+ jbuilder (2.0.2)
activesupport (>= 3.0.0)
multi_json (>= 1.2.0)
- jquery-rails (3.0.2)
+ jquery-rails (3.0.4)
railties (>= 3.0, < 5.0)
thor (>= 0.14, < 2.0)
- json (1.8.0)
+ json (1.8.1)
mail (2.5.4)
mime-types (~> 1.16)
treetop (~> 1.4.8)
- mime-types (1.23)
- minitest (4.7.5)
- multi_json (1.7.7)
+ mime-types (1.25.1)
+ minitest (5.2.1)
+ multi_json (1.8.4)
polyglot (0.3.3)
rack (1.5.2)
rack-test (0.6.2)
rack (>= 1.0)
- rails (4.0.0)
- actionmailer (= 4.0.0)
- actionpack (= 4.0.0)
- activerecord (= 4.0.0)
- activesupport (= 4.0.0)
+ rails (4.1.0)
+ actionmailer (= 4.1.0)
+ actionpack (= 4.1.0)
+ actionview (= 4.1.0)
+ activemodel (= 4.1.0)
+ activerecord (= 4.1.0)
+ activesupport (= 4.1.0)
bundler (>= 1.3.0, < 2.0)
- railties (= 4.0.0)
+ railties (= 4.1.0)
sprockets-rails (~> 2.0.0)
- railties (4.0.0)
- actionpack (= 4.0.0)
- activesupport (= 4.0.0)
+ railties (4.1.0)
+ actionpack (= 4.1.0)
+ activesupport (= 4.1.0)
rake (>= 0.8.7)
thor (>= 0.18.1, < 2.0)
- rake (10.1.0)
- rdoc (3.12.2)
+ rake (10.1.1)
+ rdoc (4.1.1)
json (~> 1.4)
- sass (3.2.9)
- sass-rails (4.0.0)
- railties (>= 4.0.0.beta, < 5.0)
+ sass (3.2.13)
+ sass-rails (4.0.1)
+ railties (>= 4.0.0, < 5.0)
sass (>= 3.1.10)
sprockets-rails (~> 2.0.0)
- sdoc (0.3.20)
- json (>= 1.1.3)
- rdoc (~> 3.10)
- sprockets (2.10.0)
+ sdoc (0.4.0)
+ json (~> 1.8)
+ rdoc (~> 4.0, < 5.0)
+ spring (1.0.0)
+ sprockets (2.10.1)
hike (~> 1.2)
multi_json (~> 1.0)
rack (~> 1.0)
tilt (~> 1.1, != 1.3.0)
- sprockets-rails (2.0.0)
+ sprockets-rails (2.0.1)
actionpack (>= 3.0)
activesupport (>= 3.0)
sprockets (~> 2.8)
- sqlite3 (1.3.7)
+ sqlite3 (1.3.8)
thor (0.18.1)
- thread_safe (0.1.0)
+ thread_safe (0.1.3)
atomic
tilt (1.4.1)
- treetop (1.4.14)
+ treetop (1.4.15)
polyglot
polyglot (>= 0.3.1)
- turbolinks (1.2.0)
+ turbolinks (2.2.0)
coffee-rails
- tzinfo (0.3.37)
- uglifier (2.1.1)
+ tzinfo (1.1.0)
+ thread_safe (~> 0.1)
+ uglifier (2.4.0)
execjs (>= 0.3.0)
- multi_json (~> 1.0, >= 1.0.2)
+ json (>= 1.8.0)
PLATFORMS
ruby
DEPENDENCIES
- coffee-rails
+ coffee-rails (~> 4.0.0)
jbuilder (~> 2.0)
jquery-rails
- rails (= 4.0.0)
- sass-rails
- sdoc
+ rails (= 4.1.0)
+ sass-rails (~> 4.0.1)
+ sdoc (~> 0.4.0)
+ spring
sqlite3
turbolinks
- uglifier (>= 1.0.3)
+ uglifier (>= 1.3.0)
diff --git a/guides/source/getting_started.md b/guides/source/getting_started.md
index fca6d41a1b..ebc56cba58 100644
--- a/guides/source/getting_started.md
+++ b/guides/source/getting_started.md
@@ -106,7 +106,7 @@ run the following:
$ rails --version
```
-If it says something like "Rails 4.0.0", you are ready to continue.
+If it says something like "Rails 4.1.0", you are ready to continue.
### Creating the Blog Application
@@ -123,42 +123,40 @@ rights to create files, and type:
$ rails new blog
```
-This will create a Rails application called Blog in a directory called blog and
+This will create a Rails application called Blog in a `blog` directory and
install the gem dependencies that are already mentioned in `Gemfile` using
`bundle install`.
TIP: You can see all of the command line options that the Rails application
builder accepts by running `rails new -h`.
-After you create the blog application, switch to its folder to continue work
-directly in that application:
+After you create the blog application, switch to its folder:
```bash
$ cd blog
```
-The `rails new blog` command we ran above created a folder in your working
-directory called `blog`. The `blog` directory has a number of auto-generated
-files and folders that make up the structure of a Rails application. Most of the
-work in this tutorial will happen in the `app/` folder, but here's a basic
-rundown on the function of each of the files and folders that Rails created by default:
+The `blog` directory has a number of auto-generated files and folders that make
+up the structure of a Rails application. Most of the work in this tutorial will
+happen in the `app` folder, but here's a basic rundown on the function of each
+of the files and folders that Rails created by default:
| File/Folder | Purpose |
| ----------- | ------- |
-|app/|Contains the controllers, models, views, helpers, mailers and assets for your application. You'll focus on this folder for the remainder of this guide.|
-|bin/|Contains the rails script that starts your app and can contain other scripts you use to deploy or run your application.|
-|config/|Configure your application's runtime rules, routes, database, and more. This is covered in more detail in [Configuring Rails Applications](configuring.html)|
+|app|Contains the controllers, models, views, helpers, mailers and assets for your application. You'll focus on this folder for the remainder of this guide.|
+|bin|Contains the rails script that starts your app and can contain other scripts you use to deploy or run your application.|
+|config/|Configure your application's routes, database, and more. This is covered in more detail in [Configuring Rails Applications](configuring.html).|
|config.ru|Rack configuration for Rack based servers used to start the application.|
-|db/|Contains your current database schema, as well as the database migrations.|
-|Gemfile<br>Gemfile.lock|These files allow you to specify what gem dependencies are needed for your Rails application. These files are used by the Bundler gem. For more information about Bundler, see [the Bundler website](http://gembundler.com) |
-|lib/|Extended modules for your application.|
-|log/|Application log files.|
-|public/|The only folder seen to the world as-is. Contains the static files and compiled assets.|
+|db|Contains your current database schema, as well as the database migrations.|
+|Gemfile<br>Gemfile.lock|These files allow you to specify what gem dependencies are needed for your Rails application. These files are used by the Bundler gem. For more information about Bundler, see [the Bundler website](http://gembundler.com).|
+|lib|Extended modules for your application.|
+|log|Application log files.|
+|public|The only folder seen by the world as-is. Contains static files and compiled assets.|
|Rakefile|This file locates and loads tasks that can be run from the command line. The task definitions are defined throughout the components of Rails. Rather than changing Rakefile, you should add your own tasks by adding files to the lib/tasks directory of your application.|
|README.rdoc|This is a brief instruction manual for your application. You should edit this file to tell others what your application does, how to set it up, and so on.|
-|test/|Unit tests, fixtures, and other test apparatus. These are covered in [Testing Rails Applications](testing.html)|
-|tmp/|Temporary files (like cache, pid and session files)|
-|vendor/|A place for all third-party code. In a typical Rails application, this includes Ruby Gems and the Rails source code (if you optionally install it into your project).|
+|test|Unit tests, fixtures, and other test apparatus. These are covered in [Testing Rails Applications](testing.html).|
+|tmp|Temporary files (like cache, pid, and session files).|
+|vendor|A place for all third-party code. In a typical Rails application this includes vendored gems.|
Hello, Rails!
-------------
@@ -170,7 +168,7 @@ get your Rails application server running.
You actually have a functional Rails application already. To see it, you need to
start a web server on your development machine. You can do this by running the
-following in the root directory of your rails application:
+following in the `blog` directory:
```bash
$ rails server
@@ -179,16 +177,17 @@ $ rails server
TIP: Compiling CoffeeScript to JavaScript requires a JavaScript runtime and the
absence of a runtime will give you an `execjs` error. Usually Mac OS X and
Windows come with a JavaScript runtime installed. Rails adds the `therubyracer`
-gem to Gemfile in a commented line for new apps and you can uncomment if you
-need it. `therubyrhino` is the recommended runtime for JRuby users and is added
-by default to Gemfile in apps generated under JRuby. You can investigate about
-all the supported runtimes at [ExecJS](https://github.com/sstephenson/execjs#readme).
+gem to the generated `Gemfile` in a commented line for new apps and you can
+uncomment if you need it. `therubyrhino` is the recommended runtime for JRuby
+users and is added by default to the `Gemfile` in apps generated under JRuby.
+You can investigate about all the supported runtimes at
+[ExecJS](https://github.com/sstephenson/execjs#readme).
-This will fire up WEBrick, a webserver built into Ruby by default. To see your
-application in action, open a browser window and navigate to <http://localhost:3000>.
-You should see the Rails default information page:
+This will fire up WEBrick, a web server distributed with Ruby by default. To see
+your application in action, open a browser window and navigate to
+<http://localhost:3000>. You should see the Rails default information page:
-![Welcome Aboard screenshot](images/getting_started/rails_welcome.png)
+![Welcome aboard screenshot](images/getting_started/rails_welcome.jpg)
TIP: To stop the web server, hit Ctrl+C in the terminal window where it's
running. To verify the server has stopped you should see your command prompt
@@ -197,7 +196,7 @@ dollar sign `$`. In development mode, Rails does not generally require you to
restart the server; changes you make in files will be automatically picked up by
the server.
-The "Welcome Aboard" page is the _smoke test_ for a new Rails application: it
+The "Welcome aboard" page is the _smoke test_ for a new Rails application: it
makes sure that you have your software configured correctly enough to serve a
page. You can also click on the _About your application's environment_ link to
see a summary of your application's environment.
@@ -216,8 +215,9 @@ it to a view.
A view's purpose is to display this information in a human readable format. An
important distinction to make is that it is the _controller_, not the view,
where information is collected. The view should just display that information.
-By default, view templates are written in a language called ERB (Embedded Ruby)
-which is converted by the request cycle in Rails before being sent to the user.
+By default, view templates are written in a language called eRuby (Embedded
+Ruby) which is processed by the request cycle in Rails before being sent to the
+user.
To create a new controller, you will need to run the "controller" generator and
tell it you want a controller called "welcome" with an action called "index",
@@ -262,23 +262,25 @@ of code:
### Setting the Application Home Page
Now that we have made the controller and view, we need to tell Rails when we
-want `Hello, Rails!` to show up. In our case, we want it to show up when we
+want "Hello, Rails!" to show up. In our case, we want it to show up when we
navigate to the root URL of our site, <http://localhost:3000>. At the moment,
-"Welcome Aboard" is occupying that spot.
+"Welcome aboard" is occupying that spot.
Next, you have to tell Rails where your actual home page is located.
Open the file `config/routes.rb` in your editor.
```ruby
-Blog::Application.routes.draw do
+Rails.application.routes.draw do
get "welcome/index"
# The priority is based upon order of creation:
# first created -> highest priority.
- # ...
+ #
# You can have the root of your site routed with "root"
# root "welcome#index"
+ #
+ # ...
```
This is your application's _routing file_ which holds entries in a special DSL
@@ -289,17 +291,18 @@ to a specific controller and action. Find the line beginning with `root` and
uncomment it. It should look something like the following:
```ruby
-root "welcome#index"
+root 'welcome#index'
```
-The `root "welcome#index"` tells Rails to map requests to the root of the
+`root 'welcome#index'` tells Rails to map requests to the root of the
application to the welcome controller's index action and `get "welcome/index"`
tells Rails to map requests to <http://localhost:3000/welcome/index> to the
welcome controller's index action. This was created earlier when you ran the
controller generator (`rails generate controller welcome index`).
-If you navigate to <http://localhost:3000> in your browser, you'll see the
-`Hello, Rails!` message you put into `app/views/welcome/index.html.erb`,
+Launch the web server again if you stopped it to generate the controller (`rails
+server`) and navigate to <http://localhost:3000> in your browser. You'll see the
+"Hello, Rails!" message you put into `app/views/welcome/index.html.erb`,
indicating that this new route is indeed going to `WelcomeController`'s `index`
action and is rendering the view correctly.
diff --git a/guides/source/upgrading_ruby_on_rails.md b/guides/source/upgrading_ruby_on_rails.md
index bca1d36ab7..72a4bb4c2d 100644
--- a/guides/source/upgrading_ruby_on_rails.md
+++ b/guides/source/upgrading_ruby_on_rails.md
@@ -614,6 +614,10 @@ config.active_record.mass_assignment_sanitizer = :strict
Rails 3.2 deprecates `vendor/plugins` and Rails 4.0 will remove them completely. While it's not strictly necessary as part of a Rails 3.2 upgrade, you can start replacing any plugins by extracting them to gems and adding them to your Gemfile. If you choose not to make them gems, you can move them into, say, `lib/my_plugin/*` and add an appropriate initializer in `config/initializers/my_plugin.rb`.
+### Active Record
+
+Option `:dependent => :restrict` has been removed from `belongs_to`. If you want to prevent deleting the object if there are any associated objects, you can set `:dependent => :destroy` and return `false` after checking for existence of association from any of the associated object's destroy callbacks.
+
Upgrading from Rails 3.0 to Rails 3.1
-------------------------------------
diff --git a/railties/CHANGELOG.md b/railties/CHANGELOG.md
index 21887c32fe..83747470bf 100644
--- a/railties/CHANGELOG.md
+++ b/railties/CHANGELOG.md
@@ -1,4 +1,15 @@
-* `test_help.rb` now automatically checks/maintains your test datbase
+* Only lookup `config.log_level` for stdlib `::Logger` instances.
+ Assign it as is for third party loggers like `Log4r::Logger`.
+
+ Fixes #13421.
+
+ *Yves Senn*
+
+* The `Gemfile` of new applications depends on SDoc ~> 0.4.0.
+
+ *Xavier Noria*
+
+* `test_help.rb` now automatically checks/maintains your test database
schema. (Use `config.active_record.maintain_test_schema = false` to
disable.)
diff --git a/railties/lib/rails/application/bootstrap.rb b/railties/lib/rails/application/bootstrap.rb
index a26d41c0cf..33bcab1e57 100644
--- a/railties/lib/rails/application/bootstrap.rb
+++ b/railties/lib/rails/application/bootstrap.rb
@@ -53,7 +53,11 @@ INFO
logger
end
- Rails.logger.level = ActiveSupport::Logger.const_get(config.log_level.to_s.upcase)
+ if ::Logger === Rails.logger
+ Rails.logger.level = ActiveSupport::Logger.const_get(config.log_level.to_s.upcase)
+ else
+ Rails.logger.level = config.log_level
+ end
end
# Initialize cache early in the stack so railties can make use of it.
diff --git a/railties/lib/rails/generators/app_base.rb b/railties/lib/rails/generators/app_base.rb
index 4988602aea..1b50569c9e 100644
--- a/railties/lib/rails/generators/app_base.rb
+++ b/railties/lib/rails/generators/app_base.rb
@@ -352,7 +352,7 @@ module Rails
def sdoc_gemfile_entry
comment = 'bundle exec rake doc:rails generates the API under doc/api.'
- GemfileEntry.new('sdoc', nil, comment, { group: :doc, require: false })
+ GemfileEntry.new('sdoc', '~> 0.4.0', comment, group: :doc)
end
def coffee_gemfile_entry
diff --git a/railties/lib/rails/generators/rails/app/templates/Gemfile b/railties/lib/rails/generators/rails/app/templates/Gemfile
index 68bd62d4b1..6d017e187d 100644
--- a/railties/lib/rails/generators/rails/app/templates/Gemfile
+++ b/railties/lib/rails/generators/rails/app/templates/Gemfile
@@ -6,12 +6,10 @@ source 'https://rubygems.org'
# <%= gem.comment %>
<% end -%>
-<%= gem.commented_out ? '# ' : '' %>gem '<%= gem.name %>'<% if gem.version -%>
-, '<%= gem.version %>'
-<% elsif gem.options.any? -%>
+<%= gem.commented_out ? '# ' : '' %>gem '<%= gem.name %>'<%= %(, '#{gem.version}') if gem.version -%>
+<% if gem.options.any? -%>
,<%= gem.padding(max_width) %><%= gem.options.map { |k,v|
"#{k}: #{v.inspect}" }.join(', ') %>
-<% else %>
<% end -%>
<% end -%>
diff --git a/railties/lib/rails/generators/rails/app/templates/config/secrets.yml b/railties/lib/rails/generators/rails/app/templates/config/secrets.yml
index 6e2c45e119..b2669a0f79 100644
--- a/railties/lib/rails/generators/rails/app/templates/config/secrets.yml
+++ b/railties/lib/rails/generators/rails/app/templates/config/secrets.yml
@@ -19,4 +19,4 @@ test:
# Do not keep production secrets in the repository,
# instead read values from the environment.
production:
- secret_key_base: <%%= ENV["RAILS_SECRET_KEY_BASE"] %>
+ secret_key_base: <%%= ENV["SECRET_KEY_BASE"] %>
diff --git a/railties/lib/rails/generators/rails/plugin/templates/Gemfile b/railties/lib/rails/generators/rails/plugin/templates/Gemfile
index 88ec4e6354..f0a832f783 100644
--- a/railties/lib/rails/generators/rails/plugin/templates/Gemfile
+++ b/railties/lib/rails/generators/rails/plugin/templates/Gemfile
@@ -29,12 +29,10 @@ end
# <%= gem.comment %>
<% end -%>
-<%= gem.commented_out ? '# ' : '' %>gem '<%= gem.name %>'<% if gem.version -%>
-, '<%= gem.version %>'
-<% elsif gem.options.any? -%>
+<%= gem.commented_out ? '# ' : '' %>gem '<%= gem.name %>'<%= %(, '#{gem.version}') if gem.version -%>
+<% if gem.options.any? -%>
,<%= gem.padding(max_width) %><%= gem.options.map { |k,v|
"#{k}: #{v.inspect}" }.join(', ') %>
-<% else %>
<% end -%>
<% end -%>
diff --git a/railties/lib/rails/generators/testing/behaviour.rb b/railties/lib/rails/generators/testing/behaviour.rb
index 8e9028a3fb..7576eba6e0 100644
--- a/railties/lib/rails/generators/testing/behaviour.rb
+++ b/railties/lib/rails/generators/testing/behaviour.rb
@@ -61,11 +61,9 @@ module Rails
# You can provide a configuration hash as second argument. This method returns the output
# printed by the generator.
def run_generator(args=self.default_arguments, config={})
- without_thor_debug do
- capture(:stdout) do
- args += ['--skip-bundle'] unless args.include? '--dev'
- self.generator_class.start(args, config.reverse_merge(destination_root: destination_root))
- end
+ capture(:stdout) do
+ args += ['--skip-bundle'] unless args.include? '--dev'
+ self.generator_class.start(args, config.reverse_merge(destination_root: destination_root))
end
end
@@ -102,14 +100,6 @@ module Rails
dirname, file_name = File.dirname(absolute), File.basename(absolute).sub(/\.rb$/, '')
Dir.glob("#{dirname}/[0-9]*_*.rb").grep(/\d+_#{file_name}.rb$/).first
end
-
- # TODO: remove this once Bundler 1.5.2 is released
- def without_thor_debug # :nodoc:
- thor_debug, ENV['THOR_DEBUG'] = ENV['THOR_DEBUG'], nil
- yield
- ensure
- ENV['THOR_DEBUG'] = thor_debug
- end
end
end
end
diff --git a/railties/test/abstract_unit.rb b/railties/test/abstract_unit.rb
index ade08d3f5a..9ccc286b4e 100644
--- a/railties/test/abstract_unit.rb
+++ b/railties/test/abstract_unit.rb
@@ -17,3 +17,12 @@ module TestApp
secrets.secret_key_base = 'b3c631c314c0bbca50c1b2843150fe33'
end
end
+
+# Skips the current run on Rubinius using Minitest::Assertions#skip
+def rubinius_skip(message = '')
+ skip message if RUBY_ENGINE == 'rbx'
+end
+# Skips the current run on JRuby using Minitest::Assertions#skip
+def jruby_skip(message = '')
+ skip message if defined?(JRUBY_VERSION)
+end
diff --git a/railties/test/application/configuration_test.rb b/railties/test/application/configuration_test.rb
index 6158c416d7..02d8b2c91d 100644
--- a/railties/test/application/configuration_test.rb
+++ b/railties/test/application/configuration_test.rb
@@ -754,7 +754,7 @@ module ApplicationTests
end
end
- test "config.log_level with custom logger" do
+ test "lookup config.log_level with custom logger (stdlib Logger)" do
make_basic_app do |app|
app.config.logger = Logger.new(STDOUT)
app.config.log_level = :info
@@ -762,6 +762,19 @@ module ApplicationTests
assert_equal Logger::INFO, Rails.logger.level
end
+ test "assign log_level as is with custom logger (third party logger)" do
+ logger_class = Class.new do
+ attr_accessor :level
+ end
+ logger_instance = logger_class.new
+ make_basic_app do |app|
+ app.config.logger = logger_instance
+ app.config.log_level = :info
+ end
+ assert_equal logger_instance, Rails.logger
+ assert_equal :info, Rails.logger.level
+ end
+
test "respond_to? accepts include_private" do
make_basic_app
diff --git a/railties/test/generators/app_generator_test.rb b/railties/test/generators/app_generator_test.rb
index be109cc598..8246e76607 100644
--- a/railties/test/generators/app_generator_test.rb
+++ b/railties/test/generators/app_generator_test.rb
@@ -390,9 +390,9 @@ class AppGeneratorTest < Rails::Generators::TestCase
end
end
- def test_inclusion_of_lazy_loaded_sdoc
+ def test_inclusion_of_doc
run_generator
- assert_file 'Gemfile', /gem 'sdoc', \s+group: :doc, require: false/
+ assert_file 'Gemfile', /gem 'sdoc',\s+'~> 0.4.0',\s+group: :doc/
end
def test_template_from_dir_pwd
@@ -458,12 +458,14 @@ class AppGeneratorTest < Rails::Generators::TestCase
end
def test_spring_binstubs
+ jruby_skip "spring doesn't run on JRuby"
generator.stubs(:bundle_command).with('install')
generator.expects(:bundle_command).with('exec spring binstub --all').once
quietly { generator.invoke_all }
end
def test_spring_no_fork
+ jruby_skip "spring doesn't run on JRuby"
Process.stubs(:respond_to?).with(:fork).returns(false)
run_generator
diff --git a/railties/test/isolation/abstract_unit.rb b/railties/test/isolation/abstract_unit.rb
index a1f1973563..6c50911666 100644
--- a/railties/test/isolation/abstract_unit.rb
+++ b/railties/test/isolation/abstract_unit.rb
@@ -93,8 +93,8 @@ module TestHelpers
# Build an application by invoking the generator and going through the whole stack.
def build_app(options = {})
@prev_rails_env = ENV['RAILS_ENV']
- ENV['RAILS_ENV'] = 'development'
- ENV['RAILS_SECRET_KEY_BASE'] ||= SecureRandom.hex(16)
+ ENV['RAILS_ENV'] = "development"
+ ENV['SECRET_KEY_BASE'] ||= SecureRandom.hex(16)
FileUtils.rm_rf(app_path)
FileUtils.cp_r(app_template_path, app_path)