xommelier 0.1.19 → 0.1.20
Sign up to get free protection for your applications and to get access to all the features.
- data/Rakefile +2 -2
- data/examples/atom.rb +3 -3
- data/lib/xommelier.rb +9 -0
- data/lib/xommelier/atom/links_extension.rb +12 -2
- data/lib/xommelier/atom/source.rb +12 -2
- data/lib/xommelier/core_ext/boolean.rb +1 -0
- data/lib/xommelier/core_ext/float.rb +1 -1
- data/lib/xommelier/core_ext/numeric.rb +1 -1
- data/lib/xommelier/core_ext/time.rb +9 -1
- data/lib/xommelier/core_ext/uri.rb +6 -2
- data/lib/xommelier/open_search.rb +55 -40
- data/lib/xommelier/rss.rb +51 -6
- data/lib/xommelier/rss/atomic.rb +21 -0
- data/lib/xommelier/schemas/dublincore/dc.xsd +118 -0
- data/lib/xommelier/schemas/dublincore/dcmitype.xsd +52 -0
- data/lib/xommelier/schemas/dublincore/dcterms.xsd +382 -0
- data/lib/xommelier/schemas/dublincore/qualifieddc.xsd +40 -0
- data/lib/xommelier/schemas/dublincore/simpledc.xsd +39 -0
- data/lib/xommelier/schemas/opensearch.xsd +484 -0
- data/lib/xommelier/schemas/syndication/creativeCommons.xsd +17 -0
- data/lib/xommelier/schemas/syndication/fh.xsd +19 -0
- data/lib/xommelier/schemas/syndication/schematron.xsd +254 -0
- data/lib/xommelier/schemas/syndication/thr.xsd +39 -0
- data/lib/xommelier/schemas/syndication/trackback.xsd +18 -0
- data/lib/xommelier/version.rb +1 -1
- data/lib/xommelier/xml/element.rb +1 -0
- data/lib/xommelier/xml/element/serialization.rb +12 -11
- data/lib/xommelier/xml/element/structure.rb +19 -19
- data/lib/xommelier/xml/element/structure/property.rb +4 -0
- data/spec/fixtures/opensearch.full.xml +23 -0
- data/spec/functional/xommelier/atom/feed/building_hash_spec.rb +37 -0
- data/spec/functional/xommelier/atom/feed/building_spec.rb +33 -0
- data/spec/functional/{atom_feed_parsing_spec.rb → xommelier/atom/feed/parsing_spec.rb} +3 -4
- data/spec/functional/{atom_feed_thread_building_spec.rb → xommelier/atom/threading/building_spec.rb} +0 -0
- data/spec/functional/xommelier/open_search/description/building_spec.rb +36 -0
- data/spec/functional/xommelier/open_search/description/parsing_spec.rb +47 -0
- data/spec/functional/{rss_feed_building_spec.rb → xommelier/rss/rss/building_spec.rb} +0 -0
- data/spec/functional/{rss_feed_parsing_spec.rb → xommelier/rss/rss/parsing_spec.rb} +0 -0
- data/spec/lib/xommelier/rss/email_address_spec.rb +22 -0
- data/spec/lib/xommelier/xml/element_spec.rb +2 -2
- data/spec/spec_helper.rb +1 -0
- data/xommelier.gemspec +8 -8
- metadata +34 -14
- data/spec/functional/atom_feed_building_spec.rb +0 -31
- data/spec/functional/build_nested_document_from_hash_spec.rb +0 -39
@@ -0,0 +1,23 @@
|
|
1
|
+
<?xml version="1.0" encoding="utf-8"?>
|
2
|
+
<OpenSearchDescription xmlns="http://a9.com/-/spec/opensearch/1.1/">
|
3
|
+
<ShortName>Web Search</ShortName>
|
4
|
+
<Description>Use Example.com to search the Web.</Description>
|
5
|
+
<Url template="http://example.com/?q={searchTerms}&pw={startPage?}&format=atom" type="application/atom+xml"/>
|
6
|
+
<Url template="http://example.com/?q={searchTerms}&pw={startPage?}&format=rss" type="application/rss+xml"/>
|
7
|
+
<Url template="http://example.com/?q={searchTerms}&pw={startPage?}" type="text/html"/>
|
8
|
+
<Query role="example" searchTerms="cat"/>
|
9
|
+
<Tags>example web</Tags>
|
10
|
+
<Contact>admin@example.com</Contact>
|
11
|
+
<LongName>Example.com Web Search</LongName>
|
12
|
+
<Developer>Example.com Development Team</Developer>
|
13
|
+
<Attribution>
|
14
|
+
Search data Copyright 2005, Example.com, Inc., All Rights Reserved
|
15
|
+
</Attribution>
|
16
|
+
<SyndicationRight>open</SyndicationRight>
|
17
|
+
<AdultContent>false</AdultContent>
|
18
|
+
<Language>en-us</Language>
|
19
|
+
<InputEncoding>UTF-8</InputEncoding>
|
20
|
+
<OutputEncoding>UTF-8</OutputEncoding>
|
21
|
+
<Image height="64" width="64" type="image/png">http://example.com/websearch.png</Image>
|
22
|
+
<Image height="16" width="16" type="image/vnd.microsoft.icon">http://example.com/websearch.ico</Image>
|
23
|
+
</OpenSearchDescription>
|
@@ -0,0 +1,37 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
|
3
|
+
describe Xommelier::Atom::Feed do
|
4
|
+
describe '.new(Hash)' do
|
5
|
+
let(:hash) do
|
6
|
+
{
|
7
|
+
title: 'Xommelier nest elements',
|
8
|
+
subtitle: 'Xommelier is able to build complex objects from very nested hash',
|
9
|
+
author: {name: 'Alexander', email: 'al@semyonov.us'},
|
10
|
+
updated: Time.utc(2012, 04, 04, 04, 04),
|
11
|
+
contributors: [
|
12
|
+
{name: 'Artyom', email: 'sevenov@gmail.com'},
|
13
|
+
{name: 'Ivan', email: 'ivan@example.com'},
|
14
|
+
{name: 'Pyotr', email: 'pyotr@example.com'},
|
15
|
+
],
|
16
|
+
entries: [
|
17
|
+
{title: 'First article', updated: Time.utc(2012, 01, 01, 01, 01)},
|
18
|
+
{title: 'Second article', updated: Time.utc(2012, 02, 02, 02, 02)},
|
19
|
+
{title: 'Third article', updated: Time.utc(2012, 03, 03, 03, 03)},
|
20
|
+
]
|
21
|
+
}
|
22
|
+
end
|
23
|
+
|
24
|
+
subject(:doc) { Xommelier::Atom::Feed.new(hash) }
|
25
|
+
|
26
|
+
it { should have(1).authors }
|
27
|
+
it { should have(3).contributors }
|
28
|
+
it { should have(3).entries }
|
29
|
+
|
30
|
+
it { doc.author.should be_an(Xommelier::Atom::Person) }
|
31
|
+
it { doc.contributors[2].should be_an(Xommelier::Atom::Person) }
|
32
|
+
it { doc.entries[1].should be_an(Xommelier::Atom::Entry) }
|
33
|
+
|
34
|
+
its(:to_hash) { should == hash}
|
35
|
+
its(:to_xml) { should == load_xml_file('nested_atom') }
|
36
|
+
end
|
37
|
+
end
|
@@ -0,0 +1,33 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
|
3
|
+
describe Xommelier::Atom::Feed do
|
4
|
+
describe '.to_xml' do
|
5
|
+
subject(:feed) do
|
6
|
+
Xommelier::Atom::Feed.new.tap do |feed|
|
7
|
+
feed.id = 'urn:uuid:60a76c80-d399-11d9-b93C-0003939e0af6'
|
8
|
+
feed.title = 'Example Feed'
|
9
|
+
feed.link = Xommelier::Atom::Link.new(href: 'http://example.org/')
|
10
|
+
feed.updated = Time.utc(2003, 12, 13, 18, 30, 02)
|
11
|
+
feed.author = Xommelier::Atom::Person.new(name: 'John Doe')
|
12
|
+
feed.entry = Xommelier::Atom::Entry.new(
|
13
|
+
title: 'Atom-Powered Robots Run Amok',
|
14
|
+
id: 'urn:uuid:1225c695-cfb8-4ebb-aaaa-80da344efa6a',
|
15
|
+
updated: Time.utc(2003, 12, 13, 18, 30, 02),
|
16
|
+
summary: 'Some text.'
|
17
|
+
).tap do |entry|
|
18
|
+
entry.link = Xommelier::Atom::Link.new(href: 'http://example.org/2003/12/13/atom03')
|
19
|
+
end
|
20
|
+
end
|
21
|
+
end
|
22
|
+
|
23
|
+
let(:parsed_xml) { Nokogiri::XML(feed.to_xml) }
|
24
|
+
let(:rng) { Nokogiri::XML::RelaxNG(load_xml_file('atom.rng')) }
|
25
|
+
let(:xsd) { Xommelier::Atom.schema }
|
26
|
+
|
27
|
+
it { should be_valid }
|
28
|
+
|
29
|
+
its(:to_xml) { should == load_xml_file('simple_feed.atom') }
|
30
|
+
it('should conform to RelaxNG schema') { rng.valid?(parsed_xml).should == true }
|
31
|
+
it('should conform to XML Schema') { xsd.valid?(parsed_xml).should == true }
|
32
|
+
end
|
33
|
+
end
|
@@ -1,11 +1,10 @@
|
|
1
1
|
# coding: utf-8
|
2
2
|
require 'spec_helper'
|
3
3
|
require 'active_support/core_ext/numeric/time'
|
4
|
-
require 'xommelier/atom/
|
5
|
-
require 'xommelier/atom/history'
|
4
|
+
require 'xommelier/atom/full'
|
6
5
|
|
7
|
-
describe
|
8
|
-
describe '
|
6
|
+
describe Xommelier::Atom::Feed do
|
7
|
+
describe '.parse' do
|
9
8
|
let(:atom_xml) { load_xml_file('feed.atom') }
|
10
9
|
let(:feed) { Xommelier::Atom::Feed.parse(atom_xml) }
|
11
10
|
|
data/spec/functional/{atom_feed_thread_building_spec.rb → xommelier/atom/threading/building_spec.rb}
RENAMED
File without changes
|
@@ -0,0 +1,36 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
|
3
|
+
describe Xommelier::OpenSearch::Description do
|
4
|
+
describe '.to_xml' do
|
5
|
+
let(:hash) do
|
6
|
+
{
|
7
|
+
short_name: 'Web Search',
|
8
|
+
description: 'Use Example.com to search the Web.',
|
9
|
+
urls: [{template: 'http://example.com/?q={searchTerms}&pw={startPage?}&format=atom',
|
10
|
+
type: 'application/atom+xml'},
|
11
|
+
{template: 'http://example.com/?q={searchTerms}&pw={startPage?}&format=rss',
|
12
|
+
type: 'application/rss+xml'},
|
13
|
+
{template: 'http://example.com/?q={searchTerms}&pw={startPage?}',
|
14
|
+
type: 'text/html'}],
|
15
|
+
query: {role: 'example', search_terms: 'cat'},
|
16
|
+
tags: 'example web',
|
17
|
+
contact: 'admin@example.com',
|
18
|
+
long_name: 'Example.com Web Search',
|
19
|
+
developer: 'Example.com Development Team',
|
20
|
+
attribution: "\n Search data Copyright 2005, Example.com, Inc., All Rights Reserved\n ",
|
21
|
+
syndication_right: 'open',
|
22
|
+
language: 'en-us',
|
23
|
+
input_encoding: 'UTF-8',
|
24
|
+
output_encoding: 'UTF-8',
|
25
|
+
adult_content: false,
|
26
|
+
images: [{height: 64, width: 64, type: 'image/png', text: 'http://example.com/websearch.png'},
|
27
|
+
{height: 16, width: 16, type: 'image/vnd.microsoft.icon', text: 'http://example.com/websearch.ico'}]
|
28
|
+
}
|
29
|
+
end
|
30
|
+
subject(:description) { Xommelier::OpenSearch::Description.new(hash) }
|
31
|
+
|
32
|
+
its(:to_hash) { should == hash }
|
33
|
+
it { should be_valid }
|
34
|
+
its(:to_xml) { should == load_xml_file('opensearch.full') }
|
35
|
+
end
|
36
|
+
end
|
@@ -0,0 +1,47 @@
|
|
1
|
+
# coding: utf-8
|
2
|
+
require 'spec_helper'
|
3
|
+
require 'xommelier/open_search'
|
4
|
+
|
5
|
+
describe Xommelier::OpenSearch::Description do
|
6
|
+
describe '.parse' do
|
7
|
+
let(:osd_xml) { load_xml_file('opensearch.full') }
|
8
|
+
let(:description) { Xommelier::OpenSearch::Description.parse(osd_xml) }
|
9
|
+
|
10
|
+
subject { description }
|
11
|
+
|
12
|
+
its(:adult_content) { should be_false }
|
13
|
+
its(:attribution) { should == "\n Search data Copyright 2005, Example.com, Inc., All Rights Reserved\n " }
|
14
|
+
its(:contact) { should == 'admin@example.com' }
|
15
|
+
its(:description) { should == 'Use Example.com to search the Web.' }
|
16
|
+
its(:developer) { should == 'Example.com Development Team' }
|
17
|
+
its(:input_encoding) { should == 'UTF-8' }
|
18
|
+
its(:language) { should == 'en-us' }
|
19
|
+
its(:long_name) { should == 'Example.com Web Search' }
|
20
|
+
its(:output_encoding) { should == 'UTF-8' }
|
21
|
+
its(:short_name) { should == 'Web Search' }
|
22
|
+
its(:syndication_right) { should == 'open' }
|
23
|
+
its(:tags) { should == 'example web' }
|
24
|
+
|
25
|
+
it { should have(2).images }
|
26
|
+
describe '#images' do
|
27
|
+
it { subject.images[0].should == 'http://example.com/websearch.png' }
|
28
|
+
it { subject.images[0].type.should == 'image/png' }
|
29
|
+
it { subject.images[0].height.should == 64 }
|
30
|
+
it { subject.images[0].width.should == 64 }
|
31
|
+
it { subject.images[1].should == 'http://example.com/websearch.ico' }
|
32
|
+
it { subject.images[1].type.should == 'image/vnd.microsoft.icon' }
|
33
|
+
it { subject.images[1].height.should == 16 }
|
34
|
+
it { subject.images[1].width.should == 16 }
|
35
|
+
end
|
36
|
+
|
37
|
+
it { should have(3).urls }
|
38
|
+
describe '#urls' do
|
39
|
+
it { subject.urls[0].type.should == 'application/atom+xml' }
|
40
|
+
it { subject.urls[0].template.should == 'http://example.com/?q={searchTerms}&pw={startPage?}&format=atom' }
|
41
|
+
it { subject.urls[1].type.should == 'application/rss+xml' }
|
42
|
+
it { subject.urls[1].template.should == 'http://example.com/?q={searchTerms}&pw={startPage?}&format=rss' }
|
43
|
+
it { subject.urls[2].type.should == 'text/html' }
|
44
|
+
it { subject.urls[2].template.should == 'http://example.com/?q={searchTerms}&pw={startPage?}' }
|
45
|
+
end
|
46
|
+
end
|
47
|
+
end
|
File without changes
|
File without changes
|
@@ -0,0 +1,22 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
|
3
|
+
describe Xommelier::RSS::EmailAddress do
|
4
|
+
{
|
5
|
+
'al@semyonov.us' => ['al@semyonov.us', nil],
|
6
|
+
'al@semyonov.us (Alexander)' => ['al@semyonov.us', 'Alexander'],
|
7
|
+
'al@semyonov.us (Alexander Semyonov)' => ['al@semyonov.us', 'Alexander Semyonov']
|
8
|
+
}.each do |email_address, (address, name)|
|
9
|
+
it "parses #{email_address.inspect} as address:#{address.inspect}, name:#{name.inspect}" do
|
10
|
+
e = described_class.from_xommelier(email_address)
|
11
|
+
e.should == address
|
12
|
+
e.name.should == name
|
13
|
+
end
|
14
|
+
|
15
|
+
it "produces #{email_address.inspect} from address:#{address.inspect}, name:#{name.inspect}" do
|
16
|
+
e = described_class.new
|
17
|
+
e.address = address
|
18
|
+
e.name = name
|
19
|
+
e.to_xommelier.should == email_address
|
20
|
+
end
|
21
|
+
end
|
22
|
+
end
|
@@ -35,11 +35,11 @@ describe Xommelier::Xml::Element do
|
|
35
35
|
|
36
36
|
describe 'with many simple subelements' do
|
37
37
|
subject do
|
38
|
-
NamespacedModule::RootWithManySimpleSubelements.new(foos:
|
38
|
+
NamespacedModule::RootWithManySimpleSubelements.new(foos: %w(bar baz))
|
39
39
|
end
|
40
40
|
|
41
41
|
it { should respond_to(:foo) }
|
42
|
-
it { subject.foos.should ==
|
42
|
+
it { subject.foos.should == %w(bar baz) }
|
43
43
|
it { subject.foo.should == 'bar' }
|
44
44
|
it { subject.to_xml.should == %(<?xml version="1.0" encoding="utf-8"?>\n<root-with-many-simple-subelements xmlns="http://example.org/">\n <foo>bar</foo>\n <foo>baz</foo>\n</root-with-many-simple-subelements>\n) }
|
45
45
|
end
|
data/spec/spec_helper.rb
CHANGED
data/xommelier.gemspec
CHANGED
@@ -1,22 +1,22 @@
|
|
1
1
|
# -*- encoding: utf-8 -*-
|
2
|
-
$:.push File.expand_path(
|
3
|
-
require
|
2
|
+
$:.push File.expand_path('../lib', __FILE__)
|
3
|
+
require 'xommelier/version'
|
4
4
|
|
5
5
|
Gem::Specification.new do |s|
|
6
|
-
s.name =
|
6
|
+
s.name = 'xommelier'
|
7
7
|
s.version = Xommelier::VERSION
|
8
|
-
s.authors = [
|
9
|
-
s.email =
|
10
|
-
s.homepage =
|
8
|
+
s.authors = ['Alexander Semyonov']
|
9
|
+
s.email = %w(al@semyonov.us)
|
10
|
+
s.homepage = 'http://github.com/alsemyonov/xommelier'
|
11
11
|
s.summary = %q{Xommelier is an XML Sommelier}
|
12
12
|
s.description = %q{XML-Object Mapper with many built-in XML formats supported}
|
13
13
|
|
14
|
-
s.rubyforge_project =
|
14
|
+
s.rubyforge_project = 'xommelier'
|
15
15
|
|
16
16
|
s.files = `git ls-files`.split("\n")
|
17
17
|
s.test_files = `git ls-files -- {test,spec,features}/*`.split("\n")
|
18
18
|
s.executables = `git ls-files -- bin/*`.split("\n").map{ |f| File.basename(f) }
|
19
|
-
s.require_paths =
|
19
|
+
s.require_paths = %w(lib)
|
20
20
|
|
21
21
|
s.add_dependency 'nokogiri', '~> 1.5.0'
|
22
22
|
s.add_dependency 'activesupport', '~> 3.2.0'
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: xommelier
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.20
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2013-01-
|
12
|
+
date: 2013-01-11 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: nokogiri
|
@@ -106,8 +106,20 @@ files:
|
|
106
106
|
- lib/xommelier/open_search.rb
|
107
107
|
- lib/xommelier/opml.rb
|
108
108
|
- lib/xommelier/rss.rb
|
109
|
+
- lib/xommelier/rss/atomic.rb
|
109
110
|
- lib/xommelier/schemas/atom.xsd
|
111
|
+
- lib/xommelier/schemas/dublincore/dc.xsd
|
112
|
+
- lib/xommelier/schemas/dublincore/dcmitype.xsd
|
113
|
+
- lib/xommelier/schemas/dublincore/dcterms.xsd
|
114
|
+
- lib/xommelier/schemas/dublincore/qualifieddc.xsd
|
115
|
+
- lib/xommelier/schemas/dublincore/simpledc.xsd
|
116
|
+
- lib/xommelier/schemas/opensearch.xsd
|
110
117
|
- lib/xommelier/schemas/rss.xsd
|
118
|
+
- lib/xommelier/schemas/syndication/creativeCommons.xsd
|
119
|
+
- lib/xommelier/schemas/syndication/fh.xsd
|
120
|
+
- lib/xommelier/schemas/syndication/schematron.xsd
|
121
|
+
- lib/xommelier/schemas/syndication/thr.xsd
|
122
|
+
- lib/xommelier/schemas/syndication/trackback.xsd
|
111
123
|
- lib/xommelier/version.rb
|
112
124
|
- lib/xommelier/xml.rb
|
113
125
|
- lib/xommelier/xml/element.rb
|
@@ -120,16 +132,20 @@ files:
|
|
120
132
|
- spec/fixtures/feed.rss2.0.xml
|
121
133
|
- spec/fixtures/multi_namespace_feed.atom.xml
|
122
134
|
- spec/fixtures/nested_atom.xml
|
135
|
+
- spec/fixtures/opensearch.full.xml
|
123
136
|
- spec/fixtures/rss-2.0-namespace.xml
|
124
137
|
- spec/fixtures/simple_feed.atom.xml
|
125
138
|
- spec/fixtures/simple_feed.rss.xml
|
126
|
-
- spec/functional/
|
127
|
-
- spec/functional/
|
128
|
-
- spec/functional/
|
129
|
-
- spec/functional/
|
130
|
-
- spec/functional/
|
131
|
-
- spec/functional/
|
139
|
+
- spec/functional/xommelier/atom/feed/building_hash_spec.rb
|
140
|
+
- spec/functional/xommelier/atom/feed/building_spec.rb
|
141
|
+
- spec/functional/xommelier/atom/feed/parsing_spec.rb
|
142
|
+
- spec/functional/xommelier/atom/threading/building_spec.rb
|
143
|
+
- spec/functional/xommelier/open_search/description/building_spec.rb
|
144
|
+
- spec/functional/xommelier/open_search/description/parsing_spec.rb
|
145
|
+
- spec/functional/xommelier/rss/rss/building_spec.rb
|
146
|
+
- spec/functional/xommelier/rss/rss/parsing_spec.rb
|
132
147
|
- spec/lib/xommelier/atom/entry_spec.rb
|
148
|
+
- spec/lib/xommelier/rss/email_address_spec.rb
|
133
149
|
- spec/lib/xommelier/xml/element/serialization_spec.rb
|
134
150
|
- spec/lib/xommelier/xml/element/structure_spec.rb
|
135
151
|
- spec/lib/xommelier/xml/element_spec.rb
|
@@ -169,16 +185,20 @@ test_files:
|
|
169
185
|
- spec/fixtures/feed.rss2.0.xml
|
170
186
|
- spec/fixtures/multi_namespace_feed.atom.xml
|
171
187
|
- spec/fixtures/nested_atom.xml
|
188
|
+
- spec/fixtures/opensearch.full.xml
|
172
189
|
- spec/fixtures/rss-2.0-namespace.xml
|
173
190
|
- spec/fixtures/simple_feed.atom.xml
|
174
191
|
- spec/fixtures/simple_feed.rss.xml
|
175
|
-
- spec/functional/
|
176
|
-
- spec/functional/
|
177
|
-
- spec/functional/
|
178
|
-
- spec/functional/
|
179
|
-
- spec/functional/
|
180
|
-
- spec/functional/
|
192
|
+
- spec/functional/xommelier/atom/feed/building_hash_spec.rb
|
193
|
+
- spec/functional/xommelier/atom/feed/building_spec.rb
|
194
|
+
- spec/functional/xommelier/atom/feed/parsing_spec.rb
|
195
|
+
- spec/functional/xommelier/atom/threading/building_spec.rb
|
196
|
+
- spec/functional/xommelier/open_search/description/building_spec.rb
|
197
|
+
- spec/functional/xommelier/open_search/description/parsing_spec.rb
|
198
|
+
- spec/functional/xommelier/rss/rss/building_spec.rb
|
199
|
+
- spec/functional/xommelier/rss/rss/parsing_spec.rb
|
181
200
|
- spec/lib/xommelier/atom/entry_spec.rb
|
201
|
+
- spec/lib/xommelier/rss/email_address_spec.rb
|
182
202
|
- spec/lib/xommelier/xml/element/serialization_spec.rb
|
183
203
|
- spec/lib/xommelier/xml/element/structure_spec.rb
|
184
204
|
- spec/lib/xommelier/xml/element_spec.rb
|
@@ -1,31 +0,0 @@
|
|
1
|
-
require 'spec_helper'
|
2
|
-
|
3
|
-
describe 'Atom feed building' do
|
4
|
-
subject(:feed) do
|
5
|
-
Xommelier::Atom::Feed.new.tap do |feed|
|
6
|
-
feed.id = 'urn:uuid:60a76c80-d399-11d9-b93C-0003939e0af6'
|
7
|
-
feed.title = 'Example Feed'
|
8
|
-
feed.link = Xommelier::Atom::Link.new(href: 'http://example.org/')
|
9
|
-
feed.updated = Time.utc(2003, 12, 13, 18, 30, 02)
|
10
|
-
feed.author = Xommelier::Atom::Person.new(name: 'John Doe')
|
11
|
-
feed.entry = Xommelier::Atom::Entry.new(
|
12
|
-
title: 'Atom-Powered Robots Run Amok',
|
13
|
-
id: 'urn:uuid:1225c695-cfb8-4ebb-aaaa-80da344efa6a',
|
14
|
-
updated: Time.utc(2003, 12, 13, 18, 30, 02),
|
15
|
-
summary: 'Some text.'
|
16
|
-
).tap do |entry|
|
17
|
-
entry.link = Xommelier::Atom::Link.new(href: 'http://example.org/2003/12/13/atom03')
|
18
|
-
end
|
19
|
-
end
|
20
|
-
end
|
21
|
-
|
22
|
-
let(:parsed_xml) { Nokogiri::XML(feed.to_xml) }
|
23
|
-
let(:rng) { Nokogiri::XML::RelaxNG(load_xml_file('atom.rng')) }
|
24
|
-
let(:xsd) { Xommelier::Atom.schema }
|
25
|
-
|
26
|
-
it { should be_valid }
|
27
|
-
|
28
|
-
its(:to_xml) { should == load_xml_file('simple_feed.atom') }
|
29
|
-
it('should conform to RelaxNG schema') { rng.valid?(parsed_xml).should == true }
|
30
|
-
it('should conform to XML Schema') { xsd.valid?(parsed_xml).should == true }
|
31
|
-
end
|
@@ -1,39 +0,0 @@
|
|
1
|
-
require 'spec_helper'
|
2
|
-
|
3
|
-
describe 'Build document from nested hash' do
|
4
|
-
let(:hash) do
|
5
|
-
{
|
6
|
-
title: 'Xommelier nest elements',
|
7
|
-
subtitle: 'Xommelier is able to build complex objects from very nested hash',
|
8
|
-
author: {name: 'Alexander', email: 'al@semyonov.us'},
|
9
|
-
updated: Time.utc(2012, 04, 04, 04, 04),
|
10
|
-
contributors: [
|
11
|
-
{name: 'Artyom', email: 'sevenov@gmail.com'},
|
12
|
-
{name: 'Ivan', email: 'ivan@example.com'},
|
13
|
-
{name: 'Pyotr', email: 'pyotr@example.com'},
|
14
|
-
],
|
15
|
-
entries: [
|
16
|
-
{title: 'First article', updated: Time.utc(2012, 01, 01, 01, 01)},
|
17
|
-
{title: 'Second article', updated: Time.utc(2012, 02, 02, 02, 02)},
|
18
|
-
{title: 'Third article', updated: Time.utc(2012, 03, 03, 03, 03)},
|
19
|
-
]
|
20
|
-
}
|
21
|
-
end
|
22
|
-
|
23
|
-
let(:doc) do
|
24
|
-
Xommelier::Atom::Feed.new(hash)
|
25
|
-
end
|
26
|
-
|
27
|
-
subject { doc }
|
28
|
-
|
29
|
-
its(:to_xml) { should == load_xml_file('nested_atom') }
|
30
|
-
it { should have(1).authors }
|
31
|
-
it { should have(3).contributors }
|
32
|
-
it { should have(3).entries }
|
33
|
-
|
34
|
-
it { doc.author.should be_an(Xommelier::Atom::Person) }
|
35
|
-
it { doc.contributors[2].should be_an(Xommelier::Atom::Person) }
|
36
|
-
it { doc.entries[1].should be_an(Xommelier::Atom::Entry) }
|
37
|
-
|
38
|
-
its(:to_hash) { should == hash}
|
39
|
-
end
|