Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Test fix for 74e59ea #9942

Closed
wants to merge 1,522 commits into from
Closed

Test fix for 74e59ea #9942

wants to merge 1,522 commits into from

Conversation

fredwu
Copy link
Contributor

@fredwu fredwu commented Mar 27, 2013

This fixes the backport PR #9899 causing test failures on 1.8.7.

claudiob and others added 30 commits December 23, 2012 10:59
Conflicts:
	actionpack/CHANGELOG.md
	activerecord/CHANGELOG.md
	activesupport/CHANGELOG.md
* 3-2-sec:
  CVE-2012-5664 options hashes should only be extracted if there are extra parameters
  updating changelog
  updating the changelogs
  updating the changelog for the CVE
  Add release date of Rails 3.2.9 to documentation

Conflicts:
	actionmailer/CHANGELOG.md
	actionpack/CHANGELOG.md
	activemodel/CHANGELOG.md
	activerecord/CHANGELOG.md
	activeresource/CHANGELOG.md
	activesupport/CHANGELOG.md
	railties/CHANGELOG.md
Conflicts:

	railties/CHANGELOG.md
	railties/lib/rails/generators/test_unit/model/model_generator.rb
	railties/lib/rails/generators/test_unit/model/templates/fixtures.yml
	railties/test/generators/model_generator_test.rb
backport rails#8616, quote column names in generated fixture files
…k` options."

This reverts commit 93366c7.

REASON: This is backward incompatible. Also this behavior is documented
on the guides.
      1) Failure:
    test_head_created_with_image_png_content_type(RenderTest) [test/controller/render_test.rb:1238]:
    Expected: "image/png"
      Actual: "image/png; charset=utf-8"
…et_if_already_present

backport rails#8662, charset should not be appended for `head` responses
…nd_charset_if_already_present"

This reverts commit e48dc19, reversing
changes made to d38c8ca.
There was a few attempts at writing this guide, but we
never passed from the work in progress stage. In spite
of not being included in the table of contents, this
draft was still indexed by bots and showed up in searches.

Steve Klabnik has written "Working with JavaScript in Rails"
which is going to be released with Rails 4. So better get
rid of this altogether.
fix block.arity will raise nil error
* 3-2-stable:
  fix block.arity raise nil error when not given a block to "content_tag_for"
  removes the Ajax on Rails early draft
  Revert "Merge pull request rails#8665 from senny/8661_should_not_append_charset_if_already_present"
  backport rails#8662, charset should not be appended for `head` responses
  Revert "Fix `validates_presence_of` with `:allow_nil` or `:allow_blank` options."
  Fix `validates_presence_of` with `:allow_nil` or `:allow_blank` options.
  backport rails#8616, quote column names in generated fixture files
Fix format and wrong changelog entry
Backport rails#8701, do not append a second slash with `trailing_slash: true`

Closes rails#8700
Latest released tag was not fully merged into the stable branch (missed version bumping)
Merged latest released tag (v3.2.10) into the stable branch (3-2-stable)
update directory tree in the generated README in Rails 3.2

[ci skip]
This commit fixes a bug introduced in 96a13fc which breaks behaviour of
integer fields in 3.2.8.

In 3.2.8, setting the value of an integer field to a non-integer (eg.
Array, Hash, etc.) would default to 1 (true) :

    # 3.2.8
    p = Post.new
    p.category_id = [ 1, 2 ]
    p.category_id # => 1
    p.category_id = { 3 => 4 }
    p.category_id # => 1

In 3.2.9 and above, this will raise a NoMethodError :

    # 3.2.9
    p = Post.new
    p.category_id = [ 1, 2 ]

    NoMethodError: undefined method `to_i' for [1, 2]:Array

Whilst at first blush this appear to be sensible, it combines in bad
ways with scoping.

For example, it is common to use scopes to control access to data :

    @collection = Posts.where(:category_id => [ 1, 2 ])
    @new_post = @collection.new

In 3.2.8, this would work as expected, creating a new Post object
(albeit with @new_post.category_id = 1). However, in 3.2.9 this will
cause the NoMethodError to be raised as above.

It is difficult to avoid triggering this error without descoping before
calling .new, breaking any apps running on 3.2.8 that rely on this
behaviour.

This patch deviates from 3.2.8 in that it does not retain the somewhat
spurious behaviour of setting the attribute to 1. Instead, it explicitly
sets these invalid values to nil :

    p = Post.new
    p.category_id = [ 1, 2 ]
    p.category_id # => nil

This also fixes the situation where a scope using an array will
"pollute" any newly instantiated records.

    @new_post = @collection.new
    @new_post.category_id # => nil

Finally, 3.2.8 exhibited a behaviour where setting an object to an
integer field caused it to be coerced to "1". This has not been
retained, as it is spurious and surprising in the same way that setting
Arrays and Heshes was :

    c = Category.find(6)
    p = Post.new

    # 3.2.8
    p.category_id = c
    p.category_id # => 1

    # This patch
    p.category_id = c
    p.category_id # => nil

This commit includes explicit test cases that expose the original issue
with calling new on a scope that uses an Array. As this is a common
situation, an explicit test case is the best way to prevent regressions
in the future.

It also updates and separates existing tests to be explicit about the
situation that is being tested (eg. AR objects vs. other objects vs.
non-integers)
Fix undefined method `to_i' introduced since 3.2.8
claudiob and others added 28 commits March 18, 2013 14:51
Set "March 18, 2013" as the release date for 3.2.13
…o-changelogs

Add release dates to documentation [ci skip]
Moral of the story: One must be careful about lazily initializing
instance variables when subclassing.

I would like to draw your attention to rails#4652 where
the reader will see that there appears to be some kind of initialization issue
in rails.

The source of this issue is that:
1) Engine#env_config contains "@env_config ||= ..."
2) Application#env_config contains "@env_config ||= ..."
3) Threads are in the picture
4) Thread A calls Application#env_config, which super's to Engine#env_config
5) After Engine#env_config returns but before Application#env_config sets @env_config again, Thread B begins running
6) Thread B calls Application#env_config
7) Thread B finds @env_config to contain a value (the one set by Engine#env_config) and returns it
8) Thread B blows up because key set by Application#env_config are there.
9) People report bugs with puma, thin, rainbows, webrick, etc
10) Evan becomes tired of seeing these bugs
11) Evan pours himself a stiff drink, puts on Top Gear(tm), and begins debugging
12) Evan finds the source of the bug
13) Evan authors a PR
14) RIGHT NOW.

The bug is fixed by simply using a different ivar name in the methods.
Alternately, Engine#env_config could just return a new Hash each time, not memoizing into @env_config.

I bid you adieu.
Change @env_config to @app_env_config
This patch resets the postgres search path in the structure.sql after
the structure is dumped in order to find schema_migrations table when
multiples schemas are used.

Fixes rails#945
Reset postgreSQL search path in db:test:clone_structure.
The PR rails#8756 uses Sprockets for resolving files that already exists on disk, for those files their extensions don't need to be rewritten.

Fixes rails#9803
Exception.result is nil when attempting a query after PostgreSQL
disconnect, resulting in new exception:
NoMethodError: undefined method `error_field' for nil:NilClass
Fix missing action_missing

Conflicts:
	actionpack/CHANGELOG.md

Conflicts:
	actionpack/test/controller/base_test.rb

Fixes rails#9799
* 3-2-stable:
  Merge pull request rails#9802 from newsline/fix-broken-action-missing
  Remove bad changelog entry from AR [ci skip]
  Wrong exception is occured when raising no translatable exception
  Don't crash exception translation w/ nil result attribute.

Conflicts:
	actionpack/CHANGELOG.md
Pathname doesn't respond to to_path
Closes rails#9806.

As the `through_options` always contained `{:order=>nil}` the second time,
the preloader ran, the association was always reset. This patch only
adds the `:order` to the `through_options` if it is set.
do not reset associations when preloading twice.
df36c5f - Fix assert_template assertion with :layout option
4bd05a7 - Fix assert_template :layout => nil assertion
0d19a08 - Improve assert_template layout checking
…eraitance_column_to_3_2_stable

[Backport to 3-2-stable] Don't reset inheritance_column when setting explicitly.
@fredwu
Copy link
Contributor Author

fredwu commented Mar 27, 2013

Oops, wrong branch sorry.

@fredwu fredwu closed this Mar 27, 2013
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet