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
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
Rafael Mendonça França
e16110c4b8
Take care of whitespaces and changing the hash syntax
2013-02-04 09:59:22 -02:00
David
6e2cba1c8b
test for issue 8931
2013-02-02 13:00:52 +08:00
Attila Domokos
69b6129fd4
Adding the route_key and param_key tests
...
This way all the tests are testing the same fields
2013-01-22 22:13:43 -05:00
Carlos Antonio da Silva
203f787321
Merge pull request #8940 from adomokos/adding_tests_for_changed_attributes
...
Cleaning up ActiveModel::Dirty tests
2013-01-15 13:02:57 -08:00
Attila Domokos
63333e600f
Cleaning up ActiveModel::Dirty tests
...
* Clarifying what the #changed method returns
* Adding tests to describe what the #changed_attributes returns
* Updating test name based on pull request comment
* Moving the test lower in the file per pull request comment
2013-01-15 10:24:57 -05:00
Yves Senn
bc19c0d09c
test for ActiveModel::Conversion#to_partial_path and namespaced models
2013-01-14 21:17:22 +01:00
Attila Domokos
01434a5ee6
Adding tests for ActiveModel::Model
...
* Verifying persisted? is false when Model initialized
* Passing nil to Model should not blow up
* Changing test name to the one suggested in pull request comment
2013-01-12 20:04:24 -05:00
Attila Domokos
7171f9cc8f
Covering untested methods for ActiveModel::Errors
2013-01-10 21:41:35 -05:00
Rafael Mendonça França
5da4d5142a
Add active_support/testing/autorun
...
minitest/autorun load minitest/spec polluting the global namespace with
the DSL that we don't want on Rails
2012-12-31 13:57:24 -03:00
Rafael Mendonça França
9647d4b6f4
Add CHANGELOG entry for #8622
2012-12-26 19:22:38 -03:00
Rafael Mendonça França
78fd14c8de
Revert the change at ActiveModel::Errors#add_on_blank and fix in the
...
right place.
The EachValidator#validate already handle :allow_blank and :allow_nil,
correctly.
Closes #8622 .
Fix #8621 .
2012-12-26 18:55:47 -03:00
Colin Kelley
d4c30a0226
Tests and fix for validates_presence of :allow_nil, :allow_blank
...
Conflicts:
activemodel/lib/active_model/errors.rb
2012-12-26 18:19:27 -03:00
Akira Matsuda
08cf17d708
chmod -x from non-script files
2012-12-24 23:36:19 +09:00
Roberto Vasquez Angel
d72a07f1d1
Add ActiveModel::Validations::AbsenceValidator
, a validator to check the absence of attributes.
...
Add `ActiveModel::Errors#add_on_present` method. Adds error messages to present attributes.
2012-12-15 16:27:44 -05:00
Renato Mascarenhas
cc62ec1e8c
Actually test that ActiveModel::Errors#add defaults to :invalid.
2012-12-01 22:30:34 -02:00
Renato Mascarenhas
703b6387ee
Call full_messages
instead of to_a
in its spec.
2012-12-01 22:30:33 -02:00
Renato Mascarenhas
cf7ab6056a
Reset attributes should not report changes.
...
When resetting an attribute, you expect it to return to the state it was
before any changes. Namely, this fixes this unexpected behavior:
~~~ruby
model.name = "Bob"
model.reset_name!
model.name_changed? #=> true
~~~
2012-12-01 16:58:09 -02:00
Carlos Antonio da Silva
c2be9b0c3e
Simplify keys order test for as_json in Active Model
2012-11-30 10:21:24 -02:00
Rafael Mendonça França
ccecab3ba9
Remove observers and sweepers
...
They was extracted from a plugin.
See https://github.com/rails/rails-observers
[Rafael Mendonça França + Steve Klabnik]
2012-11-28 22:46:49 -02:00
Steve Klabnik
9504b44cf6
Specify type of singular association during serialization
...
When serialising a class, specify the type of any singular associations, if
necessary. Rails already correctly specifies the :type of any enumerable
association (e.g. a has_many association), but made no attempt to do so for
non-enumerables (e.g. a has_one association).
We must specify the :type of any STI association. A has_one
association to a class which uses single-table inheritance is an example of
this type of association.
Fixes #7471
2012-11-28 11:48:32 -08:00
Rafael Mendonça França
5658923daa
Merge pull request #7282 from xHire/validates_length_of_fix
...
Length validation handles correctly nil. Fix #7180
Conflicts:
activemodel/CHANGELOG.md
2012-11-26 18:44:07 -02:00
Carlos Antonio da Silva
26a3b70cc4
Merge pull request #8320 from senny/active_model_log_folder
...
Log output from activemodel's railtie_test directly to STDOUT.
There's no logging going on here, but since we initialize the app, the
logger is set and the folder is automatically created. With this change,
the default logger is not created, so there is no logging folder anymore.
Conflicts:
activemodel/test/cases/railtie_test.rb
2012-11-26 15:32:25 -02:00
Yves Senn
6fc83201db
log output from activemodel's railtie_test directly to STDOUT
...
after this patch, running the tests in activemodel will no longer
create an untracked log/ folder inside of activemodel
2012-11-26 17:23:20 +01:00
Michal Zima
ea76e9a312
Length validation handles correctly nil. Fix #7180
...
When nil or empty string are not allowed, they are not valid.
2012-11-26 12:34:32 +01:00
Carlos Antonio da Silva
3da1649828
Require active_model/railtie directly instead of rails/all
...
Use Class.new with a block instead of tap to configure it.
2012-11-26 09:19:57 -02:00