Skip to content
This repository
Browse code

Merge branch 'master' into i18n

  • Loading branch information...
commit 9dac5547ad65e82a6fbb6a6243ab5c95d9c44db0 2 parents a6e05b1 + c0dd0ce
Jeremy Kemper jeremy authored
12 actionmailer/test/mail_render_test.rb
@@ -20,13 +20,13 @@ def rxml_template(recipient)
20 20 subject "rendering rxml template"
21 21 from "tester@example.com"
22 22 end
23   -
  23 +
24 24 def included_subtemplate(recipient)
25 25 recipients recipient
26 26 subject "Including another template in the one being rendered"
27 27 from "tester@example.com"
28 28 end
29   -
  29 +
30 30 def included_old_subtemplate(recipient)
31 31 recipients recipient
32 32 subject "Including another template in the one being rendered"
@@ -83,17 +83,11 @@ def test_rxml_template
83 83 mail = RenderMailer.deliver_rxml_template(@recipient)
84 84 assert_equal "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<test/>", mail.body.strip
85 85 end
86   -
  86 +
87 87 def test_included_subtemplate
88 88 mail = RenderMailer.deliver_included_subtemplate(@recipient)
89 89 assert_equal "Hey Ho, let's go!", mail.body.strip
90 90 end
91   -
92   - def test_deprecated_old_subtemplate
93   - assert_raises ActionView::ActionViewError do
94   - RenderMailer.deliver_included_old_subtemplate(@recipient)
95   - end
96   - end
97 91 end
98 92
99 93 class FirstSecondHelperTest < Test::Unit::TestCase
2  actionpack/lib/action_view/partials.rb
@@ -156,7 +156,7 @@ def render_partial(options = {}) #:nodoc:
156 156 local_assigns.merge!(builder_partial_path.to_sym => partial_path)
157 157 render_partial(:partial => builder_partial_path, :object => options[:object], :locals => local_assigns)
158 158 when Array, ActiveRecord::Associations::AssociationCollection, ActiveRecord::NamedScope::Scope
159   - partial_path.any? ? render_partial(:collection => partial_path, :locals => local_assigns) : ""
  159 + render_partial_collection(options.except(:partial).merge(:collection => partial_path))
160 160 else
161 161 object = partial_path
162 162 render_partial(
10 actionpack/test/activerecord/render_partial_with_record_identification_test.rb
@@ -39,6 +39,11 @@ def render_with_record_collection
39 39 @developers = Developer.find(:all)
40 40 render :partial => @developers
41 41 end
  42 +
  43 + def render_with_record_collection_and_spacer_template
  44 + @developer = Developer.find(1)
  45 + render :partial => @developer.projects, :spacer_template => 'test/partial_only'
  46 + end
42 47 end
43 48
44 49 class RenderPartialWithRecordIdentificationTest < ActiveRecordTestCase
@@ -81,6 +86,11 @@ def test_render_with_record_collection
81 86 assert_equal 'DavidJamisfixture_3fixture_4fixture_5fixture_6fixture_7fixture_8fixture_9fixture_10Jamis', @response.body
82 87 end
83 88
  89 + def test_render_with_record_collection_and_spacer_template
  90 + get :render_with_record_collection_and_spacer_template
  91 + assert_equal 'Active Recordonly partialActive Controller', @response.body
  92 + end
  93 +
84 94 def test_rendering_partial_with_has_one_association
85 95 mascot = Company.find(1).mascot
86 96 get :render_with_has_one_association
4 actionpack/test/template/render_test.rb
@@ -95,6 +95,10 @@ def test_render_partial_with_nil_collection_should_return_nil
95 95 assert_nil @view.render(:partial => "test/customer", :collection => nil)
96 96 end
97 97
  98 + def test_render_partial_with_empty_array_should_return_nil
  99 + assert_nil @view.render(:partial => [])
  100 + end
  101 +
98 102 # TODO: The reason for this test is unclear, improve documentation
99 103 def test_render_partial_and_fallback_to_layout
100 104 assert_equal "Before (Josh)\n\nAfter", @view.render(:partial => "test/layout_for_partial", :locals => { :name => "Josh" })
7 activerecord/lib/active_record/connection_adapters/abstract/schema_definitions.rb
@@ -443,9 +443,10 @@ def #{column_type}(*args)
443 443
444 444 # Appends <tt>:datetime</tt> columns <tt>:created_at</tt> and
445 445 # <tt>:updated_at</tt> to the table.
446   - def timestamps
447   - column(:created_at, :datetime)
448   - column(:updated_at, :datetime)
  446 + def timestamps(*args)
  447 + options = args.extract_options!
  448 + column(:created_at, :datetime, options)
  449 + column(:updated_at, :datetime, options)
449 450 end
450 451
451 452 def references(*args)
6 activerecord/lib/active_record/connection_adapters/postgresql_adapter.rb
@@ -534,13 +534,13 @@ def create_database(name, options = {})
534 534 option_string = options.symbolize_keys.sum do |key, value|
535 535 case key
536 536 when :owner
537   - " OWNER = '#{value}'"
  537 + " OWNER = \"#{value}\""
538 538 when :template
539   - " TEMPLATE = #{value}"
  539 + " TEMPLATE = \"#{value}\""
540 540 when :encoding
541 541 " ENCODING = '#{value}'"
542 542 when :tablespace
543   - " TABLESPACE = #{value}"
  543 + " TABLESPACE = \"#{value}\""
544 544 when :connection_limit
545 545 " CONNECTION LIMIT = #{value}"
546 546 else
2  activerecord/test/cases/associations/has_and_belongs_to_many_associations_test.rb
@@ -452,7 +452,7 @@ def test_find_in_association_with_custom_finder_sql
452 452
453 453 def test_find_in_association_with_custom_finder_sql_and_multiple_interpolations
454 454 # interpolate once:
455   - assert_equal [developers(:david), developers(:poor_jamis), developers(:jamis)], projects(:active_record).developers_with_finder_sql, "first interpolation"
  455 + assert_equal [developers(:david), developers(:jamis), developers(:poor_jamis)], projects(:active_record).developers_with_finder_sql, "first interpolation"
456 456 # interpolate again, for a different project id
457 457 assert_equal [developers(:david)], projects(:action_controller).developers_with_finder_sql, "second interpolation"
458 458 end
37 activerecord/test/cases/migration_test.rb
@@ -237,6 +237,39 @@ def test_create_table_with_force_true_does_not_drop_nonexisting_table
237 237 end
238 238 end
239 239
  240 + def test_create_table_with_timestamps_should_create_datetime_columns
  241 + table_name = :testings
  242 +
  243 + Person.connection.create_table table_name do |t|
  244 + t.timestamps
  245 + end
  246 + created_columns = Person.connection.columns(table_name)
  247 +
  248 + created_at_column = created_columns.detect {|c| c.name == 'created_at' }
  249 + updated_at_column = created_columns.detect {|c| c.name == 'updated_at' }
  250 +
  251 + assert created_at_column.null
  252 + assert updated_at_column.null
  253 + ensure
  254 + Person.connection.drop_table table_name rescue nil
  255 + end
  256 +
  257 + def test_create_table_with_timestamps_should_create_datetime_columns_with_options
  258 + table_name = :testings
  259 +
  260 + Person.connection.create_table table_name do |t|
  261 + t.timestamps :null => false
  262 + end
  263 + created_columns = Person.connection.columns(table_name)
  264 +
  265 + created_at_column = created_columns.detect {|c| c.name == 'created_at' }
  266 + updated_at_column = created_columns.detect {|c| c.name == 'updated_at' }
  267 +
  268 + assert !created_at_column.null
  269 + assert !updated_at_column.null
  270 + ensure
  271 + Person.connection.drop_table table_name rescue nil
  272 + end
240 273
241 274 # SQL Server, Sybase, and SQLite3 will not allow you to add a NOT NULL
242 275 # column to a table without a default value.
@@ -1192,8 +1225,8 @@ def test_belongs_to_works_like_references
1192 1225
1193 1226 def test_timestamps_creates_updated_at_and_created_at
1194 1227 with_new_table do |t|
1195   - t.expects(:column).with(:created_at, :datetime)
1196   - t.expects(:column).with(:updated_at, :datetime)
  1228 + t.expects(:column).with(:created_at, :datetime, kind_of(Hash))
  1229 + t.expects(:column).with(:updated_at, :datetime, kind_of(Hash))
1197 1230 t.timestamps
1198 1231 end
1199 1232 end
2  activerecord/test/models/project.rb
@@ -7,7 +7,7 @@ class Project < ActiveRecord::Base
7 7 has_and_belongs_to_many :developers_named_david, :class_name => "Developer", :conditions => "name = 'David'", :uniq => true
8 8 has_and_belongs_to_many :developers_named_david_with_hash_conditions, :class_name => "Developer", :conditions => { :name => 'David' }, :uniq => true
9 9 has_and_belongs_to_many :salaried_developers, :class_name => "Developer", :conditions => "salary > 0"
10   - has_and_belongs_to_many :developers_with_finder_sql, :class_name => "Developer", :finder_sql => 'SELECT t.*, j.* FROM developers_projects j, developers t WHERE t.id = j.developer_id AND j.project_id = #{id}'
  10 + has_and_belongs_to_many :developers_with_finder_sql, :class_name => "Developer", :finder_sql => 'SELECT t.*, j.* FROM developers_projects j, developers t WHERE t.id = j.developer_id AND j.project_id = #{id} ORDER BY t.id'
11 11 has_and_belongs_to_many :developers_by_sql, :class_name => "Developer", :delete_sql => "DELETE FROM developers_projects WHERE project_id = \#{id} AND developer_id = \#{record.id}"
12 12 has_and_belongs_to_many :developers_with_callbacks, :class_name => "Developer", :before_add => Proc.new {|o, r| o.developers_log << "before_adding#{r.id || '<new>'}"},
13 13 :after_add => Proc.new {|o, r| o.developers_log << "after_adding#{r.id || '<new>'}"},
2  activesupport/lib/active_support/inflector.rb
@@ -173,7 +173,7 @@ def camelize(lower_case_and_underscored_word, first_letter_in_uppercase = true)
173 173 if first_letter_in_uppercase
174 174 lower_case_and_underscored_word.to_s.gsub(/\/(.?)/) { "::#{$1.upcase}" }.gsub(/(?:^|_)(.)/) { $1.upcase }
175 175 else
176   - lower_case_and_underscored_word.first + camelize(lower_case_and_underscored_word)[1..-1]
  176 + lower_case_and_underscored_word.first.downcase + camelize(lower_case_and_underscored_word)[1..-1]
177 177 end
178 178 end
179 179
4 activesupport/test/core_ext/string_ext_test.rb
@@ -32,6 +32,10 @@ def test_camelize
32 32 end
33 33 end
34 34
  35 + def test_camelize_lower
  36 + assert_equal('capital', 'Capital'.camelize(:lower))
  37 + end
  38 +
35 39 def test_underscore
36 40 CamelToUnderscore.each do |camel, underscore|
37 41 assert_equal(underscore, camel.underscore)
4 activesupport/test/inflector_test.rb
@@ -46,6 +46,10 @@ def test_camelize
46 46 end
47 47 end
48 48
  49 + def test_camelize_with_lower_downcases_the_first_letter
  50 + assert_equal('capital', ActiveSupport::Inflector.camelize('Capital', false))
  51 + end
  52 +
49 53 def test_underscore
50 54 CamelToUnderscore.each do |camel, underscore|
51 55 assert_equal(underscore, ActiveSupport::Inflector.underscore(camel))
2  railties/lib/initializer.rb
@@ -356,7 +356,7 @@ def load_application_classes
356 356 if configuration.cache_classes
357 357 configuration.eager_load_paths.each do |load_path|
358 358 matcher = /\A#{Regexp.escape(load_path)}(.*)\.rb\Z/
359   - Dir.glob("#{load_path}/**/*.rb").each do |file|
  359 + Dir.glob("#{load_path}/**/*.rb").sort.each do |file|
360 360 require_dependency file.sub(matcher, '\1')
361 361 end
362 362 end
1  railties/lib/tasks/documentation.rake
@@ -62,6 +62,7 @@ namespace :doc do
62 62 options << "-o doc/plugins/#{plugin}"
63 63 options << "--title '#{plugin.titlecase} Plugin Documentation'"
64 64 options << '--line-numbers' << '--inline-source'
  65 + options << '--charset' << 'utf-8'
65 66 options << '-T html'
66 67
67 68 files.include("#{plugin_base}/lib/**/*.rb")
3  railties/test/fixtures/eager/zoo.rb
... ... @@ -0,0 +1,3 @@
  1 +class Zoo
  2 + include ReptileHouse
  3 +end
2  railties/test/fixtures/eager/zoo/reptile_house.rb
... ... @@ -0,0 +1,2 @@
  1 +module Zoo::ReptileHouse
  2 +end
18 railties/test/initializer_test.rb
@@ -30,6 +30,24 @@ def test_load_environment_with_constant
30 30
31 31 end
32 32
  33 +class Initializer_eager_loading_Test < Test::Unit::TestCase
  34 + def setup
  35 + @config = ConfigurationMock.new("")
  36 + @config.cache_classes = true
  37 + @config.load_paths = [File.expand_path(File.dirname(__FILE__) + "/fixtures/eager")]
  38 + @config.eager_load_paths = [File.expand_path(File.dirname(__FILE__) + "/fixtures/eager")]
  39 + @initializer = Rails::Initializer.new(@config)
  40 + @initializer.set_load_path
  41 + @initializer.set_autoload_paths
  42 + end
  43 +
  44 + def test_eager_loading_loads_parent_classes_before_children
  45 + assert_nothing_raised do
  46 + @initializer.load_application_classes
  47 + end
  48 + end
  49 +end
  50 +
33 51 uses_mocha 'Initializer after_initialize' do
34 52 class Initializer_after_initialize_with_blocks_environment_Test < Test::Unit::TestCase
35 53 def setup

0 comments on commit 9dac554

Please sign in to comment.
Something went wrong with that request. Please try again.