Skip to content

Loading…

Introduce test on Error#full_message for attribute with underscores; Fix... #9864

Merged
merged 1 commit into from

3 participants

@vipulnsward
  1. Introduce test on Error#full_message for attribute with underscores
  2. Fix typo in test names
@senny
Ruby on Rails member

Why is the new test relevant? Was there a change in behavior regarding attributes with underscores? Is it to prevent regressions?

Also it would be great if you could shorten your commit message. Github does not like long commit messages. You can always do a short description on the first line, then a blank line and then add a detailed description.

@vipulnsward

About the comments: Will keep in mind the next time

While scanning through Error model, I found the tr(".","_") and humanize on the result in full_messages.

The behaviour for having _ in the name is different than having a .

Ex:
Model.nestedattr => Model nestedattr
but model_test maps to model_test itself

Test for previous behaviour is present the latter isn't, so added the test.

@senny
Ruby on Rails member

I see.

Regarding the commit message, you can easily update it by using git commit --amend or git rebase -i and then issue a force push on your branch fix_test_AR_v2. The PR on Github will reflect the changes automatically.

@vipulnsward

@senny updating in some time

@vipulnsward vipulnsward Add Error#full_message test; Fix typos
Introduce test on Error#full_message for attribute with underscores; Fix
some typos
24fee97
@vipulnsward

Fixed message

@rafaelfranca rafaelfranca merged commit ba012fa into rails:master
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Commits on Mar 22, 2013
  1. @vipulnsward

    Add Error#full_message test; Fix typos

    vipulnsward committed
    Introduce test on Error#full_message for attribute with underscores; Fix
    some typos
This page is out of date. Refresh to see the latest.
View
1 activemodel/test/cases/errors_test.rb
@@ -225,6 +225,7 @@ def test_has_key?
test 'full_message should return the given message with the attribute name included' do
person = Person.new
assert_equal "name can not be blank", person.errors.full_message(:name, "can not be blank")
+ assert_equal "name_test can not be blank", person.errors.full_message(:name_test, "can not be blank")
end
test 'should return a JSON hash representation of the errors' do
View
2 activerecord/test/cases/base_test.rb
@@ -1024,7 +1024,7 @@ def test_dont_clear_sequence_name_when_setting_explicitly
Joke.reset_sequence_name
end
- def test_dont_clear_inheritnce_column_when_setting_explicitly
+ def test_dont_clear_inheritance_column_when_setting_explicitly
Joke.inheritance_column = "my_type"
before_inherit = Joke.inheritance_column
View
2 activerecord/test/cases/nested_attributes_test.rb
@@ -806,7 +806,7 @@ def test_can_use_symbols_as_object_identifier
assert_nothing_raised(NoMethodError) { @pirate.save! }
end
- def test_numeric_colum_changes_from_zero_to_no_empty_string
+ def test_numeric_column_changes_from_zero_to_no_empty_string
Man.accepts_nested_attributes_for(:interests)
repair_validations(Interest) do
Something went wrong with that request. Please try again.