Commit Graph

1513 Commits

Author SHA1 Message Date
Kuldeep Aggarwal
869a90512f use allow_blank option instead 2014-09-14 00:19:33 +05:30
Godfrey Chan
2b41343c34 Default to sorting user's test cases for now
Goals:

1. Default to :random for newly generated applications
2. Default to :sorted for existing applications with a warning
3. Only show the warning once
4. Only show the warning if the app actually uses AS::TestCase

Fixes #16769
2014-09-08 05:32:16 -07:00
Matthew Draper
7025d7769d For now, we will keep sorting the tests.
This reverts commits e969c928463e329fd6529ac59cad96385c538ffb and
bd2b3fbe54e750ba97469a7896e8d143d6dfd465.
2014-09-05 23:33:27 +09:30
Rafael Mendonça França
703a2e8da1 Remove example file
This documentation should be in the guides.

Closes #16691
2014-09-04 14:06:40 -03:00
Matthew Draper
2f52f96988 Leave all our tests as order_dependent! for now
We're seeing too many failures to believe otherwise.

This reverts commits bc116a55ca3dd9f63a1f1ca7ade3623885adcc57,
cbde413df3839e06dd14e3c220e9800af91e83ab,
bf0a67931dd8e58f6f878b9510ae818ae1f29a3a, and
2440933fe2c27b27bcafcd9019717800db2641aa.
2014-09-02 23:55:34 +09:30
Robin Dupret
84c0f73c8d Refer to the library name instead of the constant
When we are loading a component and we want to know its version, we are
actually not speaking about the constant but the library itself.

[ci skip]

[Godfrey Chan & Xavier Noria]
2014-08-30 11:58:23 +02:00
David Heinemeier Hansson
7475b43cdb Merge branch 'master' of github.com:rails/rails 2014-08-29 14:54:08 -07:00
Akira Matsuda
b23365fe5c Move model definition to test/models for test order indenendency 2014-08-28 16:56:53 +09:00
Akira Matsuda
bd2b3fbe54 No need to sort tests
Dir.glob result must be already sorted anyway
2014-08-28 14:41:00 +09:00
Yves Senn
bf44481524 Merge pull request #16661 from edogawaconan/doc-fix
Update documentation to match change in #5942 [ci skip]
2014-08-27 11:34:47 +02:00
Eileen M. Uchitelle
9fb16627a2 Merge pull request #16689 from ankit1910/improve-english
[ci skip] make assert messages consistent
2014-08-25 19:37:10 -04:00
Yukio Mizuta
097ca3f1f8 Use ActiveSupport::Concern instead of the traditinal way 2014-08-25 11:06:06 -07:00
ankit1910
5284f98d79 [ci skip] make assert messages consistent 2014-08-25 22:07:27 +05:30
edogawaconan
e57ad6dc03 Update documentation to match change in #5942 [ci skip] 2014-08-24 00:04:07 +09:00
Attila Domokos
1079bb6d7d Using each_with_object instead of reduce
This way no new object allocation is taking place. Thanks @jeremy for
the suggestion!
2014-08-22 08:08:12 -05:00
Attila Domokos
36895bd90f Replacing an each with reduce
The functionality has not changed, but the code is more elegant by
using `reduce` instead of `each`.

This way no accumulator needs to be declared, no explicit return is
needed.
2014-08-21 23:13:37 -05:00
David Heinemeier Hansson
6a23bf0f4c Preparing for 4.2.0.beta1 release 2014-08-19 19:32:51 -07:00
Rafael Mendonça França
306dc1a499 Check attributes passed to create_with and where
If the request parameters are passed to create_with and where they can
be used to do mass assignment when used in combination with
Relation#create.

Fixes CVE-2014-3514

Conflicts:
	activerecord/lib/active_record/relation/query_methods.rb
2014-08-18 14:07:37 -03:00
Rafael Mendonça França
8742bc9d5e No need to check model_name anymore 2014-08-17 23:02:27 -03:00
Rafael Mendonça França
d2d809868c Merge pull request #15889 from carnesmedia/model-name
Use #model_name on instances instead of classes
2014-08-17 23:01:13 -03:00
Godfrey Chan
008f3da383 Don't expose these new APIs yet (added in 877ea78 / #16189)
WARNING: don't use them! They might change or go away between future beta/RC/
patch releases!

Also added a CHANGELOG entry for this.
2014-08-16 23:09:10 -07:00
Sean Griffin
877ea784e4 Implement _was and changes for in-place mutations of AR attributes 2014-08-16 23:08:41 -07:00
Akira Matsuda
bc116a55ca AM, AP, AV, and AMo tests are already order_independent! 2014-08-13 21:25:10 +09:00
Rafael Mendonça França
e81f3c210e Nobody sucks so nobody should call this awful method name 2014-08-12 10:51:41 -03:00
Akira Matsuda
6ffb29d24e users_dont_suck_but_only_we_suck_and_only_our_tests_are_order_dependent!
Calling ActiveSupport::TestCase.i_suck_and_my_tests_are_order_dependent! in AS::TestCase makes
everyone's tests order dependent, which should never be done by the framework.
2014-08-12 19:37:04 +09:00
Carlos Antonio da Silva
9a0e0594ab Fix typo [ci skip] 2014-08-07 09:17:23 -03:00
Yevhene Shemet
f8dcb365df Allow password to contain spaces only. 2014-08-06 22:11:06 +03:00
Carlos Antonio da Silva
28f6b895c6 Call public methods rather than class_eval'ing 2014-08-05 08:18:39 -03:00
Rafael Mendonça França
74c31ac5fe Merge pull request #15959 from aditya-kapoor/remove-unneeded-cases
remove unneeded test model for ActiveModel test cases.
2014-07-29 18:08:07 -03:00
Chun-wei Kuo
524f7b494a Fix example code of EachValidator [ci skip]
We have to specify the `:title` option to really use the
`TitleValidator` defined above.
2014-07-28 18:35:28 +08:00
Rafael Mendonça França
08754f12e6 Merge branch 'rm-remove-mocha'
Conflicts:
	actionpack/test/abstract_unit.rb
2014-07-19 18:17:13 -03:00
Rafael Mendonça França
fd6aaaa0c3 Stop requiring mocha automatically
We are planning to remove mocha from our test suite because of
performance problems. To make this possible we should stop require mocha
on ActionSupport::TestCase.

This should not affect applications since users still need to add mocha
to Gemfile and this already load mocha.

Added FIXME notes to place that still need mocha removal
2014-07-19 17:35:12 -03:00
Aaron Patterson
be9f868cb6 %i doesn't work on 1.9 2014-07-17 16:08:38 -07:00
Matthew Draper
e213b37fc1 Merge pull request #16210 from sonnym/assert_valid_keys_in_validate
Check for valid options in validate method
2014-07-18 07:10:49 +09:30
sonnym
0950d409b0 check for valid options in validate method
This change prevents a certain class of user error which results when
mistakenly using the `validate` class method instead of the `validates`
class method.

Only apply when all arguments are symbols, because some validations use
the `validate` method and pass in additional options, namely the
`LenghValidator` via the `ActiveMode::Validations::validates_with`
method.
2014-07-17 17:32:28 -04:00
Rafael Mendonça França
1a300b6748 Make restore_attributes public
Also make it accept a list of attributes to be changed. This will make
possible to restore only a subset of the changed attributes.

Closes #16203
2014-07-17 14:55:28 -03:00
Rafael Mendonça França
41fb06fa47 Deprecate reset_#{attribute} in favor of restore_#{attribute}.
These methods may cause confusion with the `reset_changes` that
behaves differently
of them.

Also rename undo_changes to restore_changes to match this new set of
methods.
2014-07-15 18:09:38 -03:00
Rafael Mendonça França
66d0a01535 Deprecate ActiveModel::Dirty#reset_changes in favor of #clear_changes_information
This method name is causing confusion with the `reset_#{attribute}`
methods. While `reset_name` set the value of the name attribute for the
previous value the `reset_changes` only discard the changes and previous
changes.
2014-07-15 16:04:31 -03:00
Santosh Wadghule
c890f4f8b2 [ci skip] Little bit doc code improvement. 2014-07-14 10:09:14 +05:30
Godfrey Chan
9eb15ed6a0 Only automatically include validations when enabled
This is a follow up to #16024.
2014-07-02 15:07:57 -07:00
Aditya Kapoor
7b1a42c057 automatically include ActiveModel::Validations when include ActiveModel::SecurePassword 2014-07-03 02:51:12 +05:30
Sean Griffin
fa03fa7735 Silence warning emitted in tests
The instance method `model_name` was being defined multiple times,
causing a redefinition warning.
2014-07-01 07:46:56 -06:00
Rafael Mendonça França
dc67d3d2a1 Rename rollback_changes to undo_changes
To avoid overload with database rollback
2014-06-30 16:55:01 -03:00
Rafael Mendonça França
b34f7c1706 Add CHANGELOG entry for #14861 and document private methods on the API 2014-06-30 15:41:41 -03:00
Rafael Mendonça França
bada1d3ed6 Merge pull request #14861 from igor04/dirty-rollback
Added rollback method to ActiveModel::Dirty
2014-06-30 15:37:06 -03:00
Aditya Kapoor
94b6207910 remove unneeded test model for ActiveModel test cases. 2014-06-28 22:27:06 +05:30
Sean Griffin
36a38973a3 We are talking about the libraries, not the constants 2014-06-27 13:10:58 -06:00
Sean Griffin
e04c4c0820 Note that _will_change! is no longer needed for AR instances
Leave the note for `ActiveModel`, since it can't yet detect mutations
(hopefully we can change this in time for 4.2). However, we now detect
mutations on all supported types in `ActiveRecord`, so we can note that
`_will_change!` is no longer needed there.
2014-06-27 13:07:25 -06:00
Rafael Mendonça França
6099b643e6 Merge pull request #15834 from rmehner/allow_proc_and_symbol_for_only_integer
Allow proc and symbol as values for `only_integer` of `NumericalityValidator`
2014-06-26 07:03:31 -03:00
Amiel Martin
6b0e834a19 Use #model_name on instances instead of classes
This allows rails code to be more confdent when asking for a model name, instead of having to ask for the class.

Rails core discussion here: https://groups.google.com/forum/#!topic/rubyonrails-core/ThSaXw9y1F8
2014-06-24 17:20:24 -07:00