File tree Expand file tree Collapse file tree 2 files changed +16
-2
lines changed Expand file tree Collapse file tree 2 files changed +16
-2
lines changed Original file line number Diff line number Diff line change @@ -145,10 +145,16 @@ def serialize_cast_value(value)
145
145
end
146
146
147
147
test "duping does not eagerly type cast if we have not yet type cast" do
148
- @type . define_singleton_method ( :deserialize ) { flunk }
149
- attribute = Attribute . from_database ( nil , "a value" , @type )
148
+ deserialize_called = false
149
+ deserialize_called_with = nil
150
+ @type . define_singleton_method ( :deserialize ) do |value |
151
+ deserialize_called_with = value
152
+ deserialize_called = true
153
+ end
154
+ attribute = Attribute . from_database ( nil , "my_attribute_value" , @type )
150
155
151
156
attribute . dup
157
+ assert_not deserialize_called , "deserialize should not have been called, but was called with #{ deserialize_called_with } "
152
158
end
153
159
154
160
class MyType
Original file line number Diff line number Diff line change 16
16
class ActiveModel ::TestCase < ActiveSupport ::TestCase
17
17
include ActiveSupport ::Testing ::MethodCallAssertions
18
18
19
+ class AssertionlessTest < StandardError ; end
20
+
21
+ def after_teardown
22
+ super
23
+
24
+ raise AssertionlessTest , "No assertions made." if passed? && assertions . zero?
25
+ end
26
+
19
27
private
20
28
# Skips the current run on JRuby using Minitest::Assertions#skip
21
29
def jruby_skip ( message = "" )
You can’t perform that action at this time.
0 commit comments