diff options
author | prakash <prakash@punchh.com> | 2015-08-18 11:39:52 +0530 |
---|---|---|
committer | prakash <prakash@punchh.com> | 2015-08-18 11:39:52 +0530 |
commit | 820726704d2b2b4ba040b7ab54f9f626b622247e (patch) | |
tree | ec58f2df583daf838099cf11e3a1fd66e5501ec0 | |
parent | 88a1800526855edfc42209d4960b48550212fd8f (diff) | |
download | rails-820726704d2b2b4ba040b7ab54f9f626b622247e.tar.gz rails-820726704d2b2b4ba040b7ab54f9f626b622247e.tar.bz2 rails-820726704d2b2b4ba040b7ab54f9f626b622247e.zip |
Correct error message in Standard American english and add a test case for the same.
-rw-r--r-- | activerecord/lib/active_record/associations/preloader.rb | 2 | ||||
-rw-r--r-- | activerecord/test/cases/preloader_test.rb | 13 |
2 files changed, 14 insertions, 1 deletions
diff --git a/activerecord/lib/active_record/associations/preloader.rb b/activerecord/lib/active_record/associations/preloader.rb index 6ecc741195..3992a240b9 100644 --- a/activerecord/lib/active_record/associations/preloader.rb +++ b/activerecord/lib/active_record/associations/preloader.rb @@ -116,7 +116,7 @@ module ActiveRecord when String preloaders_for_one(association.to_sym, records, scope) else - raise ArgumentError, "#{association.inspect} was not recognised for preload" + raise ArgumentError, "#{association.inspect} was not recognized for preload" end end diff --git a/activerecord/test/cases/preloader_test.rb b/activerecord/test/cases/preloader_test.rb new file mode 100644 index 0000000000..12f4c75764 --- /dev/null +++ b/activerecord/test/cases/preloader_test.rb @@ -0,0 +1,13 @@ +require 'cases/helper' +require 'models/car' + +class AssociationsTest < ActiveRecord::TestCase + fixtures :cars + + def test_preload_with_exception + exception = assert_raises(ArgumentError) do + Car.preload(10).to_a + end + assert_equal('10 was not recognized for preload', exception.message) + end +end |