aboutsummaryrefslogtreecommitdiffstats
path: root/activejob/test
diff options
context:
space:
mode:
authorFaraz Yashar <faraz.yashar@gmail.com>2015-06-28 14:58:01 -0400
committerFaraz Yashar <faraz.yashar@gmail.com>2015-06-28 14:58:01 -0400
commitfd8122a87859ef191ca849dc6a1141beef0b4cee (patch)
treeca35bd20ba7cad212181ac7e40c4f55406cd524b /activejob/test
parentaba43b7da1f45465fc3753225e5c73046342d4ec (diff)
downloadrails-fd8122a87859ef191ca849dc6a1141beef0b4cee.tar.gz
rails-fd8122a87859ef191ca849dc6a1141beef0b4cee.tar.bz2
rails-fd8122a87859ef191ca849dc6a1141beef0b4cee.zip
Improve error message when serializing unsaved records for jobs
Diffstat (limited to 'activejob/test')
-rw-r--r--activejob/test/cases/argument_serialization_test.rb7
1 files changed, 7 insertions, 0 deletions
diff --git a/activejob/test/cases/argument_serialization_test.rb b/activejob/test/cases/argument_serialization_test.rb
index 8b9b62190f..933972a52b 100644
--- a/activejob/test/cases/argument_serialization_test.rb
+++ b/activejob/test/cases/argument_serialization_test.rb
@@ -88,6 +88,13 @@ class ArgumentSerializationTest < ActiveSupport::TestCase
assert_equal "Job with argument: 2", JobBuffer.last_value
end
+ test 'raises a friendly SerializationError for records without ids' do
+ err = assert_raises ActiveJob::SerializationError do
+ ActiveJob::Arguments.serialize [Person.new(nil)]
+ end
+ assert_match 'Unable to serialize Person without an id.', err.message
+ end
+
private
def assert_arguments_unchanged(*args)
assert_arguments_roundtrip args