sanitized_attributes 1.0.2 → 1.0.3
Sign up to get free protection for your applications and to get access to all the features.
- data/VERSION +1 -1
- data/spec/sanitized_attributes_spec.rb +13 -0
- metadata +3 -3
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
1.0.
|
1
|
+
1.0.3
|
@@ -27,6 +27,19 @@ describe "SanitizedAttributes" do
|
|
27
27
|
obj.orz.should == "Orz are not *many bubbles* like *campers*. Orz are just Orz. - Orz"
|
28
28
|
end
|
29
29
|
|
30
|
+
it "allows a default sanitizing profile to be set up" do
|
31
|
+
SanitizedAttributes.add_profile(:default, Sanitize::Config::BASIC)
|
32
|
+
@klass.module_eval do
|
33
|
+
sanitize_attribute :orz
|
34
|
+
end
|
35
|
+
obj = @klass.new
|
36
|
+
obj.orz = "<a>Orz are not *many bubbles* like <p/>*campers*. <p></p>Orz <b>are just</b> Orz. <p>- Orz</p>"
|
37
|
+
obj.orz.should == "<a rel=\"nofollow\">Orz are not *many bubbles* like <p></p>*campers*. <p></p>Orz <b>are just</b> Orz. <p>- Orz</p></a>"
|
38
|
+
SanitizedAttributes.add_profile(:default, Sanitize::Config::BASIC.merge(:no_empties => %w[p]))
|
39
|
+
obj.orz = "<a>Orz are not *many bubbles* like <p/>*campers*. <p></p>Orz <b>are just</b> Orz. <p>- Orz</p>"
|
40
|
+
obj.orz.should == "<a rel=\"nofollow\">Orz are not *many bubbles* like *campers*. Orz <b>are just</b> Orz. <p>- Orz</p></a>"
|
41
|
+
end
|
42
|
+
|
30
43
|
it "sanitizes attributes with custom options and profiles" do
|
31
44
|
@klass.module_eval do
|
32
45
|
sanitize_attribute :orz, :elements => %w[p], :no_empties => %w[p]
|
metadata
CHANGED
@@ -1,13 +1,13 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: sanitized_attributes
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
hash:
|
4
|
+
hash: 17
|
5
5
|
prerelease: false
|
6
6
|
segments:
|
7
7
|
- 1
|
8
8
|
- 0
|
9
|
-
-
|
10
|
-
version: 1.0.
|
9
|
+
- 3
|
10
|
+
version: 1.0.3
|
11
11
|
platform: ruby
|
12
12
|
authors:
|
13
13
|
- Matthew Boeh
|