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 CHANGED
@@ -1 +1 @@
1
- 1.0.0
1
+ 1.0.1
@@ -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.children.reject! { |child| child.comment? }
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
@@ -5,7 +5,7 @@
5
5
 
6
6
  Gem::Specification.new do |s|
7
7
  s.name = %q{snatch}
8
- s.version = "1.0.0"
8
+ s.version = "1.0.1"
9
9
 
10
10
  s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
11
11
  s.authors = ["James Conroy-Finn"]
@@ -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(:children).and_return([])
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(:children).twice.and_return(mock_nodes)
28
- mock_node.should_receive(:comment?).and_return(true)
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
 
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: snatch
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.0
4
+ version: 1.0.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - James Conroy-Finn