opds 0.2.0 → 0.3.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -8,14 +8,15 @@ describe OPDS::Support::LinkSet do
8
8
  subject.push('subsection','http://feedbooks.com/feed','feeds')
9
9
  subject.push('http://opds-spec.org/shelf','http://feedbooks.com/shelf','shelf')
10
10
  subject.push('related','http://feedbooks.com/shelf',nil)
11
+ subject.push_facet('/sci-fi','Science-Fiction','application/atom+xml','Categories',nil,'600')
11
12
  end
12
13
 
13
14
  it do
14
- subject.size.should be(6)
15
+ subject.size.should be(7)
15
16
  end
16
17
 
17
18
  it do
18
- subject.map(&:first).size.should be(6)
19
+ subject.map(&:first).size.should be(7)
19
20
  end
20
21
 
21
22
  it "should find 3 subsection" do
@@ -29,6 +30,14 @@ describe OPDS::Support::LinkSet do
29
30
  end
30
31
 
31
32
  it "get all text values" do
32
- subject.texts.size.should be(6)
33
+ subject.texts.size.should be(7)
34
+ end
35
+
36
+ it "should have one Facet" do
37
+ f=subject.find_all{|e| e.class==OPDS::Support::Facet}
38
+ f.size.should be(1)
39
+ f.first.facet_group.should =='Categories'
40
+ f.first.count.should == 600
41
+ f.first.active_facet.should == false
33
42
  end
34
43
  end
@@ -0,0 +1,75 @@
1
+ require File.expand_path(File.dirname(__FILE__) + '/spec_helper')
2
+
3
+ def sample(type)
4
+ File.open( File.expand_path(File.dirname(__FILE__) + "/../samples/#{type}.txt"))
5
+ end
6
+
7
+ describe OPDS::OPDSParser do
8
+
9
+ feed_type=:acquisition_opds1_1
10
+
11
+ it "should parse OPDS 1.1 entry without error" do
12
+ lambda { subject.parse(sample(feed_type)) }.should_not raise_error
13
+ end
14
+
15
+ it "should sniff entry" do
16
+ subject.parse(sample(feed_type))
17
+ subject.sniffed_type.should be(:acquisition)
18
+ end
19
+
20
+ it "should return an instance of the correct class " do
21
+ subject.parse(sample(feed_type)).class.should be(OPDS::AcquisitionFeed)
22
+ end
23
+
24
+ it "should have a feed title" do
25
+ subject.parse(sample(feed_type)).title.size.should_not be(0)
26
+ end
27
+
28
+ it "should have a feed icon" do
29
+ subject.parse(sample(feed_type)).icon.size.should_not be(0)
30
+ end
31
+
32
+ it "should have feed links" do
33
+ subject.parse(sample(feed_type)).links.size.should_not be(0)
34
+ end
35
+
36
+ it "should have feed id" do
37
+ subject.parse(sample(feed_type)).id.size.should_not be(0)
38
+ end
39
+ it "should have a feed author" do
40
+ auth=subject.parse(sample(feed_type)).author
41
+ auth[:name].should == ('Feedbooks')
42
+ auth[:uri].should == ('http://www.feedbooks.com')
43
+ auth[:email].should == ('support@feedbooks.com')
44
+ end
45
+
46
+ it "should have entries" do
47
+ subject.parse(sample(feed_type)).entries.size.should_not be(0)
48
+ end
49
+
50
+ it do
51
+ subject.parse(sample(feed_type)).should be_paginated()
52
+ end
53
+
54
+ it do
55
+ subject.parse(sample(feed_type)).should be_first_page()
56
+ end
57
+
58
+ it "should have partial entries" do
59
+ subject.parse(sample(feed_type)).entries.any?(&:partial?).should be()
60
+ end
61
+
62
+ it do
63
+ subject.parse(sample(feed_type)).should have_at_least(1).facets
64
+ end
65
+
66
+ it "should have 5 sorting facets" do
67
+ subject.parse(sample(feed_type)).facets['Sort'].size.should ==5
68
+ end
69
+
70
+ it do
71
+ subject.parse(sample(feed_type)).should have_at_least(1).active_facets
72
+ end
73
+
74
+
75
+ end
metadata CHANGED
@@ -1,13 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: opds
3
3
  version: !ruby/object:Gem::Version
4
- hash: 23
4
+ hash: 19
5
5
  prerelease: false
6
6
  segments:
7
7
  - 0
8
- - 2
8
+ - 3
9
9
  - 0
10
- version: 0.2.0
10
+ version: 0.3.0
11
11
  platform: ruby
12
12
  authors:
13
13
  - Benoit Larroque
@@ -15,7 +15,7 @@ autorequire:
15
15
  bindir: bin
16
16
  cert_chain: []
17
17
 
18
- date: 2010-08-31 00:00:00 +02:00
18
+ date: 2011-06-13 00:00:00 +02:00
19
19
  default_executable:
20
20
  dependencies:
21
21
  - !ruby/object:Gem::Dependency
@@ -59,7 +59,6 @@ extra_rdoc_files:
59
59
  - README.md
60
60
  files:
61
61
  - .document
62
- - .gitignore
63
62
  - LICENSE
64
63
  - README.md
65
64
  - Rakefile
@@ -76,11 +75,13 @@ files:
76
75
  - lib/opds/support/logging.rb
77
76
  - opds.gemspec
78
77
  - samples/acquisition.txt
78
+ - samples/acquisition_opds1_1.txt
79
79
  - samples/entry.txt
80
80
  - samples/navigation.txt
81
81
  - spec/browser_spec.rb
82
82
  - spec/entry_spec.rb
83
83
  - spec/linkset_spec.rb
84
+ - spec/opdsparser_opds_1_1_spec.rb
84
85
  - spec/opdsparser_spec.rb
85
86
  - spec/spec.opts
86
87
  - spec/spec_helper.rb
@@ -89,8 +90,8 @@ homepage: http://github.com/zetaben/opds
89
90
  licenses: []
90
91
 
91
92
  post_install_message:
92
- rdoc_options:
93
- - --charset=UTF-8
93
+ rdoc_options: []
94
+
94
95
  require_paths:
95
96
  - lib
96
97
  required_ruby_version: !ruby/object:Gem::Requirement
@@ -118,9 +119,5 @@ rubygems_version: 1.3.7
118
119
  signing_key:
119
120
  specification_version: 3
120
121
  summary: ruby lib to read OPDS feeds
121
- test_files:
122
- - spec/spec_helper.rb
123
- - spec/entry_spec.rb
124
- - spec/browser_spec.rb
125
- - spec/linkset_spec.rb
126
- - spec/opdsparser_spec.rb
122
+ test_files: []
123
+
data/.gitignore DELETED
@@ -1,21 +0,0 @@
1
- ## MAC OS
2
- .DS_Store
3
-
4
- ## TEXTMATE
5
- *.tmproj
6
- tmtags
7
-
8
- ## EMACS
9
- *~
10
- \#*
11
- .\#*
12
-
13
- ## VIM
14
- *.swp
15
-
16
- ## PROJECT::GENERAL
17
- coverage
18
- rdoc
19
- pkg
20
-
21
- ## PROJECT::SPECIFIC