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: bc0574877c0a1ab3a3ac743d5263eda56a66748e
4
- data.tar.gz: 3eab358067dfb1bf2cf175c4a496704f23b018ab
3
+ metadata.gz: 64b2e5b9b8da92accad375b1e726b3c9783d7cbb
4
+ data.tar.gz: f1142ba1bb9786886b9ea5a69c6d4892d0c7257d
5
5
  SHA512:
6
- metadata.gz: 80005ad476407d81722cfe1c6c895589ad1d6fba1724e6f9a70be06e9bb8e69f9b77ebba1f494bf6364967fea28265a13276d2ac06198b7985ab1d229e243ac0
7
- data.tar.gz: ee4ac12d6fa577978def554d5781e14bea4857e7c39d819189278716e3584940d36f7702939eb838e2b924f0bc0d791494f6fbc0c12e60d14378592f79eb13b5
6
+ metadata.gz: 1fa243a3749d09ce84992c856b40305c2b9f8f6746df543c4b692e5ea0deac428b53befe2e16a5ebd3befa21f5e1d8d307a90ec9d444b700b0a4f5103221a25d
7
+ data.tar.gz: 5109a7ae854884f5802498ce15e635e069ef53878f1668ab6e11240059189a7f207bb0033b9580416a81c6fcf8a4d4709ee76cd445dd0141cc2a1d4d2d43c676
@@ -1,3 +1,3 @@
1
1
  module SanitizeModelAttributes
2
- VERSION = "0.0.4"
2
+ VERSION = "0.0.5"
3
3
  end
@@ -1,4 +1,5 @@
1
1
  require 'sanitize_model_attributes/version'
2
+ require 'sanitize'
2
3
 
3
4
  module SanitizeModelAttributes
4
5
  def self.included(base)
@@ -2,21 +2,33 @@ require 'minitest/autorun'
2
2
  require 'sanitize_model_attributes'
3
3
 
4
4
  class TestString < Minitest::Test
5
- def test_to_respond
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
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: sanitize_model_attributes
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.4
4
+ version: 0.0.5
5
5
  platform: ruby
6
6
  authors:
7
7
  - Takashi CHIBA