loofah 0.2.1 → 0.2.2

Sign up to get free protection for your applications and to get access to all the features.

Potentially problematic release.


This version of loofah might be problematic. Click here for more details.

data.tar.gz.sig CHANGED
@@ -1,2 +1,4 @@
1
- P=w ���9e2��3[#�ft������$����1�.����<t�&dă\,����+v��/���SFZ��},��h�#�:��5�����I��Ȟ`���h�^/�������m����4A+�-��;�l��a����Ϊ��+�O+pU@?=&=W�#ܳIW���;�w^ÍU�
2
- H(�� ^5Us,@��e��\t>�s}�*$�p^-6���c�b�S|U0���cT�mJU�� ��H��N^�E��
1
+ zL&����3V���(y|5�+�k�7��<�Aae*<dIw���M�x�hLQF ��1�מ�.naa���
2
+ K���� �@'��8_j��ޗ ��w�!�٫���|�T[[nd
3
+ 2�H��<YQ�Nl|U�Ap:�Z2���ZH����;V�L�H�و��q%R����n����c�feFO
4
+ s譸8p��AƇ���yƺS�ef����$� ��m��J�ǸvLೢN�j�gV:�����*G,�þ�
@@ -1,5 +1,12 @@
1
1
  = Changelog
2
2
 
3
+ == 0.2.2 (2009-09-30)
4
+
5
+ Enhancements:
6
+
7
+ * ActiveRecord extension scrubs fields in a before_validation callback
8
+ (was previously in a before_save)
9
+
3
10
  == 0.2.1 (2009-09-19)
4
11
 
5
12
  Enhancements:
@@ -64,7 +64,7 @@ OR
64
64
 
65
65
  # app/model/post.rb
66
66
  class Post < ActiveRecord::Base
67
- html_fragment :body, :scrub => :prune # scrubs 'body' in a before_save
67
+ html_fragment :body, :scrub => :prune # scrubs 'body' in a before_validation
68
68
  end
69
69
 
70
70
  == REQUIREMENTS
@@ -161,7 +161,7 @@ require 'loofah/deprecated'
161
161
  #
162
162
  module Loofah
163
163
  # The version of Loofah you are using
164
- VERSION = '0.2.1'
164
+ VERSION = '0.2.2'
165
165
 
166
166
  # The minimum required version of Nokogiri
167
167
  REQUIRED_NOKOGIRI_VERSION = '1.3.3'
@@ -1,6 +1,6 @@
1
1
  module Loofah
2
2
  #
3
- # Loofah can scrub ActiveRecord attributes in a before_save callback:
3
+ # Loofah can scrub ActiveRecord attributes in a before_validation callback:
4
4
  #
5
5
  # # in environment.rb
6
6
  # Rails::Initializer.run do |config|
@@ -15,7 +15,7 @@ module Loofah
15
15
  #
16
16
  # # app/model/post.rb
17
17
  # class Post < ActiveRecord::Base
18
- # html_fragment :body, :scrub => :prune # scrubs 'body' in a before_save
18
+ # html_fragment :body, :scrub => :prune # scrubs 'body' in a before_validation
19
19
  # end
20
20
  #
21
21
  module ActiveRecordExtension
@@ -25,7 +25,7 @@ module Loofah
25
25
  #
26
26
  def html_fragment(attr, options={})
27
27
  raise ArgumentError, "html_fragment requires :scrub option" unless method = options[:scrub]
28
- before_save do |record|
28
+ before_validation do |record|
29
29
  record[attr] = Loofah.scrub_fragment(record[attr], method).to_s
30
30
  end
31
31
  end
@@ -36,7 +36,7 @@ module Loofah
36
36
  #
37
37
  def html_document(attr, options={})
38
38
  raise ArgumentError, "html_document requires :scrub option" unless method = options[:scrub]
39
- before_save do |record|
39
+ before_validation do |record|
40
40
  record[attr] = Loofah.scrub_document(record[attr], method).to_s
41
41
  end
42
42
  end
@@ -27,7 +27,7 @@ module Loofah
27
27
 
28
28
  private
29
29
 
30
- def warn_once(message)
30
+ def warn_once(message) # :nodoc:
31
31
  @aooga ||= {}
32
32
  unless @aooga.key?(message)
33
33
  warn message unless @aooga[message]
@@ -25,11 +25,11 @@ class TestActiveRecord < Test::Unit::TestCase
25
25
  should "scrub the specified field" do
26
26
  Loofah.expects(:scrub_fragment).with(HTML_STRING, :prune).once
27
27
  Loofah.expects(:scrub_fragment).with(PLAIN_TEXT, :prune).never
28
- @post.save
28
+ @post.valid?
29
29
  end
30
30
 
31
31
  should "generate strings" do
32
- @post.save
32
+ @post.valid?
33
33
  assert_equal String, @post.html_string.class
34
34
  assert_equal HTML_STRING, @post.html_string
35
35
  end
@@ -44,11 +44,11 @@ class TestActiveRecord < Test::Unit::TestCase
44
44
  should "scrub the specified field, but not other fields" do
45
45
  Loofah.expects(:scrub_document).with(HTML_STRING, :strip).once
46
46
  Loofah.expects(:scrub_document).with(PLAIN_TEXT, :strip).never
47
- @post.save
47
+ @post.valid?
48
48
  end
49
49
 
50
50
  should "generate strings" do
51
- @post.save
51
+ @post.valid?
52
52
  assert_equal String, @post.html_string.class
53
53
  end
54
54
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: loofah
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.1
4
+ version: 0.2.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Mike Dalessio
@@ -31,7 +31,7 @@ cert_chain:
31
31
  FlqnTjy13J3nD30uxy9a1g==
32
32
  -----END CERTIFICATE-----
33
33
 
34
- date: 2009-08-19 00:00:00 -04:00
34
+ date: 2009-08-30 00:00:00 -04:00
35
35
  default_executable:
36
36
  dependencies:
37
37
  - !ruby/object:Gem::Dependency
metadata.gz.sig CHANGED
Binary file