sanitize_model_attributes 0.0.4 → 0.0.5
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 64b2e5b9b8da92accad375b1e726b3c9783d7cbb
|
4
|
+
data.tar.gz: f1142ba1bb9786886b9ea5a69c6d4892d0c7257d
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 1fa243a3749d09ce84992c856b40305c2b9f8f6746df543c4b692e5ea0deac428b53befe2e16a5ebd3befa21f5e1d8d307a90ec9d444b700b0a4f5103221a25d
|
7
|
+
data.tar.gz: 5109a7ae854884f5802498ce15e635e069ef53878f1668ab6e11240059189a7f207bb0033b9580416a81c6fcf8a4d4709ee76cd445dd0141cc2a1d4d2d43c676
|
@@ -2,21 +2,33 @@ require 'minitest/autorun'
|
|
2
2
|
require 'sanitize_model_attributes'
|
3
3
|
|
4
4
|
class TestString < Minitest::Test
|
5
|
-
def
|
6
|
-
klass = Class.new
|
7
|
-
klass.include SanitizeModelAttributes
|
8
|
-
|
9
|
-
assert klass.respond_to? :sanitize_attributes
|
10
|
-
assert klass.respond_to? :sanitize_model_attributes
|
11
|
-
|
12
|
-
klass.class_eval do
|
5
|
+
def setup
|
6
|
+
@klass = Class.new
|
7
|
+
@klass.include SanitizeModelAttributes
|
8
|
+
@klass.class_eval do
|
13
9
|
sanitize_attributes :name
|
14
10
|
sanitize_model_attributes :model_name
|
15
11
|
end
|
12
|
+
end
|
13
|
+
|
14
|
+
def test_to_respond
|
15
|
+
assert @klass.respond_to? :sanitize_attributes
|
16
|
+
assert @klass.respond_to? :sanitize_model_attributes
|
16
17
|
|
17
|
-
instance = klass.new
|
18
|
+
instance = @klass.new
|
18
19
|
|
19
20
|
assert instance.respond_to? :name=
|
20
21
|
assert instance.respond_to? :model_name=
|
21
22
|
end
|
23
|
+
|
24
|
+
def test_to_run
|
25
|
+
instance = @klass.new
|
26
|
+
|
27
|
+
def instance.write_attribute(name, value)
|
28
|
+
instance_variable_set("@#{name}".to_sym, value)
|
29
|
+
end
|
30
|
+
|
31
|
+
instance.name = '<strong>hogehoge</strong>'
|
32
|
+
assert_equal 'hogehoge', instance.instance_variable_get(:@name)
|
33
|
+
end
|
22
34
|
end
|