ruby-readability 0.6.0 → 0.6.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.travis.yml +1 -1
- data/Gemfile +2 -0
- data/Guardfile +9 -0
- data/README.md +5 -0
- data/bin/readability +9 -7
- data/lib/readability.rb +82 -81
- data/ruby-readability.gemspec +1 -1
- data/spec/fixtures/boing_boing.html +876 -0
- data/spec/readability_spec.rb +33 -0
- metadata +5 -2
data/spec/readability_spec.rb
CHANGED
@@ -508,4 +508,37 @@ describe Readability do
|
|
508
508
|
doc.content.should == 'test'
|
509
509
|
end
|
510
510
|
end
|
511
|
+
|
512
|
+
describe "boing boing" do
|
513
|
+
let(:boing_boing) {
|
514
|
+
File.read(File.dirname(__FILE__) + "/fixtures/boing_boing.html")
|
515
|
+
}
|
516
|
+
|
517
|
+
it "contains incorrect data by default" do
|
518
|
+
# NOTE: in an ideal world this spec starts failing
|
519
|
+
# and readability correctly detects content for the
|
520
|
+
# boing boing sample.
|
521
|
+
|
522
|
+
doc = Readability::Document.new(boing_boing)
|
523
|
+
|
524
|
+
content = doc.content
|
525
|
+
(content !~ /Bees and Bombs/).should == true
|
526
|
+
content.should =~ /ADVERTISE/
|
527
|
+
end
|
528
|
+
|
529
|
+
it "should apply whitelist" do
|
530
|
+
|
531
|
+
doc = Readability::Document.new(boing_boing,
|
532
|
+
whitelist: ".post-content")
|
533
|
+
content = doc.content
|
534
|
+
content.should =~ /Bees and Bombs/
|
535
|
+
end
|
536
|
+
|
537
|
+
it "should apply blacklist" do
|
538
|
+
doc = Readability::Document.new(boing_boing, blacklist: "#sidebar_adblock")
|
539
|
+
content = doc.content
|
540
|
+
(content !~ /ADVERTISE/).should == true
|
541
|
+
|
542
|
+
end
|
543
|
+
end
|
511
544
|
end
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: ruby-readability
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.6.
|
4
|
+
version: 0.6.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Andrew Cantino
|
@@ -11,7 +11,7 @@ authors:
|
|
11
11
|
autorequire:
|
12
12
|
bindir: bin
|
13
13
|
cert_chain: []
|
14
|
-
date: 2014-
|
14
|
+
date: 2014-04-15 00:00:00.000000000 Z
|
15
15
|
dependencies:
|
16
16
|
- !ruby/object:Gem::Dependency
|
17
17
|
name: rspec
|
@@ -96,6 +96,7 @@ files:
|
|
96
96
|
- .travis.yml
|
97
97
|
- .yardopts
|
98
98
|
- Gemfile
|
99
|
+
- Guardfile
|
99
100
|
- LICENSE
|
100
101
|
- README.md
|
101
102
|
- Rakefile
|
@@ -104,6 +105,7 @@ files:
|
|
104
105
|
- lib/ruby-readability.rb
|
105
106
|
- ruby-readability.gemspec
|
106
107
|
- spec/fixtures/bbc.html
|
108
|
+
- spec/fixtures/boing_boing.html
|
107
109
|
- spec/fixtures/cant_read.html
|
108
110
|
- spec/fixtures/code.html
|
109
111
|
- spec/fixtures/images/dim_1416768a.jpg
|
@@ -149,6 +151,7 @@ specification_version: 4
|
|
149
151
|
summary: Port of arc90's readability project to ruby
|
150
152
|
test_files:
|
151
153
|
- spec/fixtures/bbc.html
|
154
|
+
- spec/fixtures/boing_boing.html
|
152
155
|
- spec/fixtures/cant_read.html
|
153
156
|
- spec/fixtures/code.html
|
154
157
|
- spec/fixtures/images/dim_1416768a.jpg
|