snatch 1.0.0 → 1.0.1
Sign up to get free protection for your applications and to get access to all the features.
- data/VERSION +1 -1
- data/lib/snatch/clean/html.rb +1 -1
- data/snatch.gemspec +1 -1
- data/spec/snatch/clean/html_spec.rb +4 -5
- metadata +1 -1
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
1.0.
|
1
|
+
1.0.1
|
data/lib/snatch/clean/html.rb
CHANGED
@@ -59,7 +59,7 @@ class Snatch
|
|
59
59
|
def update
|
60
60
|
@doc.css('base, meta[generator]').each { |node| node.remove }
|
61
61
|
|
62
|
-
@doc.
|
62
|
+
@doc.search('//comment()').remove
|
63
63
|
|
64
64
|
HrefFixMethods.instance_methods.each do |m|
|
65
65
|
@doc.css('a[href]').each { |a| send m, a }
|
data/snatch.gemspec
CHANGED
@@ -15,19 +15,18 @@ describe Snatch::Clean::HTML do
|
|
15
15
|
it 'should remove any base tags' do
|
16
16
|
mock_nodes = [(mock_node = mock('nokogiri_node'))]
|
17
17
|
@html.doc.should_receive(:css).with('base, meta[generator]').and_return(mock_nodes)
|
18
|
-
@html.doc.should_receive(:
|
18
|
+
@html.doc.should_receive(:search).and_return(mock_node)
|
19
|
+
mock_node.should_receive(:remove).twice.and_return([])
|
19
20
|
mock_nodes.should_receive(:each).and_yield(mock_node)
|
20
|
-
mock_node.should_receive(:remove)
|
21
21
|
@html.send(:update)
|
22
22
|
end
|
23
23
|
|
24
24
|
it 'should remove comments and the generator meta tag' do
|
25
25
|
mock_nodes = [(mock_node = mock('nokogiri_node'))]
|
26
26
|
@html.doc.should_receive(:css).with('base, meta[generator]').and_return([])
|
27
|
-
@html.doc.should_receive(:
|
28
|
-
|
27
|
+
@html.doc.should_receive(:search).with('//comment()').and_return(mock_nodes)
|
28
|
+
mock_nodes.should_receive(:remove).and_return([mock_node])
|
29
29
|
@html.send(:update)
|
30
|
-
@html.doc.children.should be_empty
|
31
30
|
end
|
32
31
|
end
|
33
32
|
|