Rafael Mendonça França
06a00038ef
When applying changes or reseting changes create the right class
...
Before this patch after the changes are applied the changes can be only
accessed using string keys, but before symbols are also accepted.
After this change every state of the model will be consistent.
2014-01-20 22:58:14 -02:00
T.J. Schuck
72bb3fc297
Change all "can not"s to the correct "cannot".
2014-01-03 17:02:31 -05:00
Godfrey Chan
f3a8be3b8b
Merge pull request #13131 from gja/changed-accepts-values
...
Allows you to check if a field has changed to a particular value
2013-12-30 22:05:56 -08:00
Carlos Antonio da Silva
7530c82e82
Disable locale checks to avoid warnings in Active Model tests [ci skip]
...
Missed AMo when adding to the other components in
ae196e85ee7169700afac2eecdc276bc06b10b8d.
2013-12-23 17:51:07 -02:00
Akira Matsuda
a3ebe7f3a7
Unused classes in AMo tests
2013-12-19 18:31:11 +09:00
Tejas Dinkar
da2b05bb6b
Allows you to check if an attribute has changed to a particular value
...
model.name_changed?(from: "Pete", to: "Ringo")
2013-12-15 12:13:31 +05:30
Guillermo Iguaran
87e1e86640
Merge pull request #13273 from robertomiranda/test-remove-require
...
Remove require 'models/administrator', Administrator is not used in secure password test
2013-12-11 05:39:14 -08:00
robertomiranda
df7e5b69de
Remove require 'models/administrator', Administrator is not used in secure password test
2013-12-11 08:34:28 -05:00
Akira Matsuda
68db6bc431
Let validates_inclusion_of accept Time and DateTime ranges
...
fixes 4.0.0 regression introduced in 0317b93c17a46d7663a8c36edc26ad0ba3d75f85
2013-10-23 22:10:15 +09:00
T.J. Schuck
5d7b413d84
Use bcrypt's public cost attr, not internal constant
...
See:
- https://github.com/codahale/bcrypt-ruby/pull/63
- https://github.com/codahale/bcrypt-ruby/pull/64
- https://github.com/codahale/bcrypt-ruby/pull/65
2013-10-10 11:46:59 -04:00
Rafael Mendonça França
c48c111bb2
Merge pull request #8791 from griffinmyers/master
...
Updated DirtyModel's @changed_attributes hash to be symbol/string agnostic
Conflicts:
activemodel/CHANGELOG.md
2013-10-03 11:37:10 -03:00
Rafael Mendonça França
9aa1a3d853
Merge pull request #10816 from bogdan/less-dirty-dirty
...
Make AM::Dirty less dirty to plugin into AR or other library
2013-09-23 10:59:05 -03:00
Rajarshi Das
782d794c20
use assert_empty in activemodel conditional validation test cases
2013-09-10 17:26:39 +05:30
Rajarshi Das
e21a18bed0
fix actionview and activemodel test cases typos
2013-09-05 14:21:57 +05:30
Rajarshi Das
9f478deaab
remove unused instance variable
2013-08-23 16:04:08 +05:30
Guillermo Iguaran
99e33c03b7
Dont' check for any order in hash since we aren't sorting it and this is determinated only by the used interpreter
2013-08-18 16:40:21 -05:00
Guillermo Iguaran
c40111c346
Refactor serialization test for hash order
2013-08-18 09:04:09 -05:00
Gaurish Sharma
90c450f6cd
Avoid Skip in test, have a unified test for order
2013-08-09 15:27:21 +05:30
Gaurish Sharma
9f8116fb77
Add tests for ActiveModel::Serializers::JSON#as_json ordering
2013-08-09 04:32:00 +05:30
Max Shytikov
af1e3b7c48
fix tests
2013-07-30 20:03:57 +03:00
Vladimir Kiselev
3be0cdfa55
Fix secure_password password_confirmation validations
2013-07-24 03:14:15 +04:00
Vipul A M
404a61e19c
Remove redundant escapes from xml serialization test
2013-07-01 10:17:33 +05:30
Paul Nikitochkin
e63ba910ae
Remove deprecation warning from AttributeMethodsMatcher
2013-06-28 00:16:42 +03:00
Łukasz Strzałkowski
468939297d
Remove deprecated attr_protected/accessible
...
Rails 4.0 has removed attr_protected and attr_accessible feature in favor of Strong Parameters.
2013-06-27 20:38:30 +02:00
Carlos Antonio da Silva
61346d1b42
Merge pull request #10774 from chuckbergeron/validates-inclusion-of-accuracy-for-non-numeric-ranges
...
Greater accuracy for validates_inclusion_of on non-numeric ranges
Closes #10774 , fixes #10593
2013-06-25 21:48:41 -03:00
Fred Wu
85750d43fa
ActiveModel::Model inclusion chain backward compatibility
2013-06-20 12:16:17 +10:00
Fred Wu
0b502cb879
Fixes AciveModel::Model with no ancestors, fixes #11004
...
Signed-off-by: José Valim <jose.valim@plataformatec.com.br>
2013-06-19 17:16:04 +02:00
Fred Wu
e3dc10f133
Fixed ActiveModel::Model's inclusion chain
2013-06-19 11:25:10 +10:00
Andrey Koleshko
120f6e07f6
Stub logger for tests
2013-06-06 19:47:57 +03:00
Phil Calvin
5d93ef8f45
Fix regression in has_secure_password.
...
If the confirmation was blank, but the password wasn't, it would still save.
2013-05-30 11:18:43 -07:00
Charles Bergeron
0317b93c17
Use Range#cover? for Numeric ranges (tests via endpoints) and use Range#include? for non-numeric ranges
...
added changelog message
2013-05-27 23:54:25 -07:00
William Myers
0e655873d4
DirtyModel uses a hash to keep track of any changes made to attributes
...
of an instance. When using the attribute_will_change! method, you must
supply a string and not a symbol or the *_changed? method will break
(because it is looking for the attribute name as a string in the keys
of the underlying hash). To remedy this, I simply made the underlying
hash a HashWithIndifferentAccess so it won't matter if you supply
the attribute name as a symbol or string to attribute_will_change!.
2013-05-27 23:41:26 -04:00
Nick Sutterer
7d84c3a2f7
deprecate Validator#setup (to get rid of a respond_to call). validators do their setup in their constructor now.
2013-05-23 10:00:44 -03:00
Aaron Patterson
9fef7c8dc9
Merge pull request #10527 from zenspider/squishy_minitest5
...
Squishy minitest5
2013-05-16 13:41:54 -07:00
Aaron Patterson
23122ab2d4
callbacks are wrapped with lambdas
2013-05-10 10:13:21 -07:00
Ryan Davis
3073c53198
Updates to make rails 4 happy with minitest 5:
...
+ Namespace changes, overhaul of runners.
+ Internal ivar name changes
- Removed a logger globally applied to tests that spew everywhere?!?
+ Override Minitest#__run to sort tests by name.
+ Reworked testing isolation to work with the new cleaner architecture.
- Removed a bunch of tests that just test minitest straight up. I think these changes were all merged to minitest 4 a long time ago.
- Minor report output differences.
2013-05-06 17:38:45 -07:00
Patrick Robertson
eebb9ddf9b
Convert ActiveModel to 1.9 hash syntax.
...
I also attempted to fix other styleguide violations such as
{ a: :b } over {a: :b} and foo(b: 'bar') over foo( b: 'bar' ).
2013-05-01 18:01:46 -07:00
Carlos Antonio da Silva
3e47e193c6
Merge pull request #10286 from neerajdotname/fix-wrong-test-name-and-failure-message
...
fix wrong test description and failure message
2013-04-21 09:22:51 -07:00
Neeraj Singh
2242317fdd
fix wrong test description and failure message
2013-04-21 12:00:38 -04:00
Neeraj Singh
cf69d527fe
Added tests for if condition in Active Model callbacks
2013-04-21 11:34:12 -04:00
Anupam Choudhury
e000aa92dd
Removed unused setup
2013-04-09 20:57:55 +05:30
Carlos Antonio da Silva
09c55dcc5d
Review some tests from AMo::Errors to remove "should" usage
...
Also remove duplicated tests for Errors#as_json and minor improvements
in some tests.
2013-03-30 15:04:09 -03:00
Rafael Mendonça França
b8b3df0e63
Merge pull request #8527 from shockone/patch-1
...
Add a method full_messages_for to the Errors class
2013-03-25 09:04:25 -07:00
shock_one
ec1b715b0e
Add a method full_messages_for to the Errors class
2013-03-24 09:38:28 +02:00
Vipul A M
24fee97581
Add Error#full_message test; Fix typos
...
Introduce test on Error#full_message for attribute with underscores; Fix
some typos
2013-03-22 14:53:32 +05:30
Vipul A M
233737706c
fix some typos found in activemodel
2013-03-18 17:20:05 +05:30
Vipul A M
29dcf096b0
Small typos here and there.
2013-03-15 11:55:03 +05:30
Yves Senn
8c1687bbf8
has_secure_password
is not invalid when assigning empty Strings.
...
Closes #9535 .
With 692b3b6 the `password=` setter does no longer set blank passwords.
This triggered validation errors when assigning empty Strings to `password`
and `password_confirmation`.
This patch only sets the confirmation if it is not `blank?`.
2013-03-04 18:56:05 +01:00
Yves Senn
b501ee47fa
validates_confirmation_of
does not override writer methods.
2013-03-04 18:51:34 +01:00
Angelo capilleri
40c1ee8b7d
added more accurate test for add_on_empty
...
with the current tests, if delete the assignment of is_empty in add_on_empty method
the tests not fail. With this test, if we delete is_empty, the test fails
2013-02-19 18:48:37 +01:00