blob: 72f5779dfb3241d71a4dcc72123482a4b30f4cda (
plain) (
blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
|
# frozen_string_literal: true
require "cases/helper"
require "active_model/type"
module ActiveModel
module Type
class ImmutableStringTest < ActiveModel::TestCase
test "cast strings are frozen" do
s = "foo"
type = Type::ImmutableString.new
assert_equal true, type.cast(s).frozen?
end
test "immutable strings are not duped coming out" do
s = "foo"
type = Type::ImmutableString.new
assert_same s, type.cast(s)
assert_same s, type.deserialize(s)
end
end
end
end
|