xommelier 0.1.31 → 0.1.32
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.gitignore +1 -0
- data/.travis.yml +3 -1
- data/Gemfile +1 -1
- data/README.md +4 -0
- data/lib/xommelier/version.rb +1 -1
- data/lib/xommelier/xml/element/serialization.rb +1 -0
- data/lib/xommelier/xml/element/structure.rb +2 -0
- data/lib/xommelier/xml/element.rb +3 -0
- data/spec/functional/xommelier/atom/feed/building_hash_spec.rb +7 -7
- data/spec/functional/xommelier/atom/feed/building_spec.rb +2 -2
- data/spec/functional/xommelier/atom/feed/parsing_spec.rb +34 -34
- data/spec/functional/xommelier/atom/threading/building_spec.rb +1 -1
- data/spec/functional/xommelier/open_search/description/parsing_spec.rb +17 -17
- data/spec/functional/xommelier/rss/rss/parsing_spec.rb +2 -2
- data/spec/lib/xommelier/atom/entry_spec.rb +4 -4
- data/spec/lib/xommelier/ds_spec.rb +12 -12
- data/spec/lib/xommelier/rss/email_address_spec.rb +3 -3
- data/spec/lib/xommelier/xml/element/serialization_spec.rb +1 -1
- data/spec/lib/xommelier/xml/element/structure_spec.rb +12 -12
- data/spec/lib/xommelier/xml/element_spec.rb +26 -26
- data/spec/lib/xommelier/xml_spec.rb +2 -2
- data/spec/spec_helper.rb +1 -1
- data/spec/{namespaced_module.rb → support/namespaced_module.rb} +0 -0
- data/spec/support/schema_validatable.rb +2 -2
- data/xommelier.gemspec +11 -7
- metadata +82 -40
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 5021eac8283a90857cbf59e48a66eba7f920483a
|
4
|
+
data.tar.gz: 9903d50374acb7e8d1478b19ae6890289a9936cf
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 189d9e449e0af6d6cbebb21fa8ac822184aa3d6afa4d7b02d6015909f88049327a3202c6459a9917ac0d629e0f30c3d3fddada45ae9cb031a64f58523e93bba8
|
7
|
+
data.tar.gz: 47df7ea79aabb669ab39b2847dc2248d92d9baf5f540ef7d27571df09265c682c9ad2e3dfb390ddf401c54df73a373ab3011885f3a88ddd78c8e45b581ad4e12
|
data/.gitignore
CHANGED
data/.travis.yml
CHANGED
data/Gemfile
CHANGED
data/README.md
CHANGED
data/lib/xommelier/version.rb
CHANGED
@@ -9,6 +9,7 @@ require 'xommelier/xml/element'
|
|
9
9
|
require 'xommelier/xml/element/structure/property'
|
10
10
|
require 'active_support/concern'
|
11
11
|
require 'active_support/core_ext/module/delegation'
|
12
|
+
require 'active_support/core_ext/module/aliasing'
|
12
13
|
require 'active_support/core_ext/object/with_options'
|
13
14
|
require 'active_support/core_ext/object/try'
|
14
15
|
require 'active_support/core_ext/string/inflections'
|
@@ -20,6 +21,7 @@ module Xommelier
|
|
20
21
|
module Structure
|
21
22
|
extend ActiveSupport::Concern
|
22
23
|
|
24
|
+
|
23
25
|
included do
|
24
26
|
class_attribute :elements, :attributes
|
25
27
|
|
@@ -12,6 +12,7 @@ require 'xommelier/xml/element/serialization'
|
|
12
12
|
require 'active_support/core_ext/string/inflections'
|
13
13
|
require 'active_support/core_ext/array/extract_options'
|
14
14
|
require 'active_support/core_ext/class/attribute'
|
15
|
+
require 'active_support/core_ext/module/delegation'
|
15
16
|
|
16
17
|
module Xommelier
|
17
18
|
module Xml
|
@@ -55,6 +56,8 @@ module Xommelier
|
|
55
56
|
%(#<#{self.class.name}:0x#{object_id.to_s(16)} #{inspect_contents}>)
|
56
57
|
end
|
57
58
|
|
59
|
+
delegate :match, to: :to_s
|
60
|
+
|
58
61
|
private
|
59
62
|
|
60
63
|
def inspect_contents
|
@@ -7,7 +7,7 @@
|
|
7
7
|
|
8
8
|
require 'spec_helper'
|
9
9
|
|
10
|
-
describe Xommelier::Atom::Feed do
|
10
|
+
RSpec.describe Xommelier::Atom::Feed do
|
11
11
|
describe '.new(Hash)' do
|
12
12
|
let(:hash) do
|
13
13
|
{
|
@@ -29,13 +29,13 @@ describe Xommelier::Atom::Feed do
|
|
29
29
|
|
30
30
|
subject(:doc) { Xommelier::Atom::Feed.new(hash) }
|
31
31
|
|
32
|
-
|
33
|
-
|
34
|
-
|
32
|
+
its('authors.size') { should == 1 }
|
33
|
+
its('contributors.size') { should == 2 }
|
34
|
+
its('entries.size') { should == 3 }
|
35
35
|
|
36
|
-
it { doc.author.
|
37
|
-
it { doc.contributors[1].
|
38
|
-
it { doc.entries[1].
|
36
|
+
it { expect(doc.author).to be_an(Xommelier::Atom::Person) }
|
37
|
+
it { expect(doc.contributors[1]).to be_an(Xommelier::Atom::Person) }
|
38
|
+
it { expect(doc.entries[1]).to be_an(Xommelier::Atom::Entry) }
|
39
39
|
|
40
40
|
its(:to_hash) { should == hash}
|
41
41
|
its(:to_xml) { should == load_xml_file('nested_atom') }
|
@@ -34,7 +34,7 @@ describe Xommelier::Atom::Feed do
|
|
34
34
|
it_behaves_like 'Valid XML Document'
|
35
35
|
|
36
36
|
its(:to_xml) { should == load_xml_file('simple_feed.atom') }
|
37
|
-
it('should conform to RelaxNG schema') { rng.valid?(parsed_xml).
|
38
|
-
it('should conform to XML Schema') { xsd.valid?(parsed_xml).
|
37
|
+
it('should conform to RelaxNG schema') { expect(rng.valid?(parsed_xml)).to eq(true) }
|
38
|
+
it('should conform to XML Schema') { expect(xsd.valid?(parsed_xml)).to eq(true) }
|
39
39
|
end
|
40
40
|
end
|
@@ -14,45 +14,45 @@ describe Xommelier::Atom::Feed do
|
|
14
14
|
let(:atom_xml) { load_xml_file('feed.atom') }
|
15
15
|
subject(:feed) { Xommelier::Atom::Feed.parse(atom_xml) }
|
16
16
|
|
17
|
-
it {
|
18
|
-
it {
|
19
|
-
it {
|
17
|
+
it { is_expected.to be_kind_of(Xommelier::Atom::Feed) }
|
18
|
+
it { is_expected.to respond_to(:complete?) }
|
19
|
+
it { is_expected.to respond_to(:archive?) }
|
20
20
|
|
21
21
|
its(:id) { should == 'urn:uuid:60a76c80-d399-11d9-b93C-0003939e0af6' }
|
22
22
|
its(:title) { should == 'Example Feed' }
|
23
23
|
its(:updated) { should == Time.utc(2003, 12, 13, 18, 30, 20) }
|
24
24
|
its(:subtitle) { should == 'A <em>lot</em> of effort went into making this effortless' }
|
25
25
|
|
26
|
-
|
26
|
+
its('links.size') { should == 3 }
|
27
27
|
its(:link) { should be_instance_of(Xommelier::Atom::Link) }
|
28
|
-
it { feed.links[0].href.
|
29
|
-
it { feed.links[0].rel.
|
30
|
-
it { feed.links[0].type.
|
31
|
-
it { feed.links[1].href.
|
32
|
-
it { feed.links[1].rel.
|
33
|
-
it { feed.links[1].type.
|
28
|
+
it { expect(feed.links[0].href).to eq(URI.parse('http://example.ru/')) }
|
29
|
+
it { expect(feed.links[0].rel).to eq('alternate') }
|
30
|
+
it { expect(feed.links[0].type).to eq('text/html') }
|
31
|
+
it { expect(feed.links[1].href).to eq(URI.parse('http://example.ru/feed.atom')) }
|
32
|
+
it { expect(feed.links[1].rel).to eq('self') }
|
33
|
+
it { expect(feed.links[1].type).to eq('application/atom+xml') }
|
34
34
|
its(:feed_url) { should == URI.parse('http://example.ru/feed.atom') }
|
35
35
|
its(:html_url) { should == URI.parse('http://example.ru/') }
|
36
36
|
its(:next_feed_url) { should == URI.parse('http://example.ru/feed.atom?page=2') }
|
37
37
|
|
38
|
-
its(:archive) { should
|
39
|
-
its(:complete) { should
|
38
|
+
its(:archive) { should be_truthy }
|
39
|
+
its(:complete) { should be_falsey }
|
40
40
|
its(:rights) { should == '© Mark Pilgrim, 2003' }
|
41
41
|
describe 'Generator' do
|
42
42
|
subject { feed.generator }
|
43
43
|
context '#to_s' do
|
44
|
-
it {
|
44
|
+
it { is_expected.to eq('Example Toolkit') }
|
45
45
|
its(:text) { should == 'Example Toolkit' }
|
46
46
|
end
|
47
47
|
its(:uri) { should == URI.parse('http://example.com/') }
|
48
48
|
its(:version) { should == '1.0' }
|
49
49
|
end
|
50
50
|
|
51
|
-
|
51
|
+
its('authors.size') { should == 1 }
|
52
52
|
its(:author) { should be_instance_of(Xommelier::Atom::Person) }
|
53
|
-
it { feed.author.name.
|
53
|
+
it { expect(feed.author.name).to eq('John Doe') }
|
54
54
|
|
55
|
-
it { feed.
|
55
|
+
it { expect(feed.entries.size).to eq(2) }
|
56
56
|
describe 'Entry' do
|
57
57
|
subject(:entry) { feed.entries[0] }
|
58
58
|
|
@@ -61,24 +61,24 @@ describe Xommelier::Atom::Feed do
|
|
61
61
|
its(:updated) { should == Time.utc(2003, 12, 13, 18, 30, 02) }
|
62
62
|
its(:published) { should == Time.utc(2003, 12, 13, 8, 29, 29) + 4.hours }
|
63
63
|
|
64
|
-
|
64
|
+
its('links.size') { should == 3 }
|
65
65
|
its(:link) { should be_instance_of(Xommelier::Atom::Link) }
|
66
|
-
it { entry.links[0].href.
|
67
|
-
it { entry.links[0].rel.
|
68
|
-
it { entry.links[0].type.
|
69
|
-
it { entry.links[1].href.
|
70
|
-
it { entry.links[1].rel.
|
71
|
-
it { entry.links[1].type.
|
72
|
-
it { entry.links[1].length.
|
73
|
-
it { entry.links[2].href.
|
74
|
-
it { entry.links[2].rel.
|
75
|
-
it { entry.links[2].type.
|
76
|
-
it { entry.links[2].count.
|
77
|
-
it { entry.links[2].updated.
|
66
|
+
it { expect(entry.links[0].href).to eq(URI.parse('http://example.ru/2003/12/13/atom03')) }
|
67
|
+
it { expect(entry.links[0].rel).to eq('alternate') }
|
68
|
+
it { expect(entry.links[0].type).to eq('text/html') }
|
69
|
+
it { expect(entry.links[1].href).to eq(URI.parse('http://example.org/audio/ph34r_my_podcast.mp3')) }
|
70
|
+
it { expect(entry.links[1].rel).to eq('enclosure') }
|
71
|
+
it { expect(entry.links[1].type).to eq('audio/mpeg') }
|
72
|
+
it { expect(entry.links[1].length).to eq(1337) }
|
73
|
+
it { expect(entry.links[2].href).to eq(URI.parse('http://example.ru/2003/12/13/atom03/comments.atom')) }
|
74
|
+
it { expect(entry.links[2].rel).to eq('replies') }
|
75
|
+
it { expect(entry.links[2].type).to eq('application/atom+xml') }
|
76
|
+
it { expect(entry.links[2].count).to eq(1) }
|
77
|
+
it { expect(entry.links[2].updated).to eq(Time.utc(2003, 12, 13, 18, 30, 20)) }
|
78
78
|
its(:html_url) { should == URI.parse('http://example.ru/2003/12/13/atom03') }
|
79
79
|
its(:replies_feed_url) { should == URI.parse('http://example.ru/2003/12/13/atom03/comments.atom') }
|
80
80
|
|
81
|
-
|
81
|
+
its('authors.size') { should == 1 }
|
82
82
|
|
83
83
|
describe 'Author' do
|
84
84
|
subject { entry.author }
|
@@ -87,13 +87,13 @@ describe Xommelier::Atom::Feed do
|
|
87
87
|
its(:email) { should == 'f8dy@example.com' }
|
88
88
|
end
|
89
89
|
|
90
|
-
|
91
|
-
it { entry.contributors[0].name.
|
92
|
-
it { entry.contributors[1].name.
|
90
|
+
its('contributors.size') { should == 2 }
|
91
|
+
it { expect(entry.contributors[0].name).to eq('Sam Ruby') }
|
92
|
+
it { expect(entry.contributors[1].name).to eq('Joe Gregorio') }
|
93
93
|
its(:summary) { should == 'Some text.' }
|
94
94
|
context 'Content' do
|
95
95
|
subject { entry.content }
|
96
|
-
it {
|
96
|
+
it { is_expected.to match(/#{Regexp.escape('[Update: The Atom draft is finished.]')}/) }
|
97
97
|
its(:text) do
|
98
98
|
should == "\n <div xmlns=\"http://www.w3.org/1999/xhtml\">\n <p><i>[Update: The Atom draft is finished.]</i></p>\n </div>\n "
|
99
99
|
end
|
@@ -41,6 +41,6 @@ describe 'Atom feed building' do
|
|
41
41
|
let(:xsd) { Nokogiri::XML::Schema(load_xml_file('atom.xsd')) }
|
42
42
|
|
43
43
|
its(:to_xml) { should == load_xml_file('multi_namespace_feed.atom') }
|
44
|
-
it('should conform to RelaxNG schema') { rng.valid?(parsed_xml).
|
44
|
+
it('should conform to RelaxNG schema') { expect(rng.valid?(parsed_xml)).to eq(true) }
|
45
45
|
it_behaves_like 'Valid XML Document'
|
46
46
|
end
|
@@ -13,7 +13,7 @@ describe Xommelier::OpenSearch::Description do
|
|
13
13
|
let(:osd_xml) { load_xml_file('opensearch.full') }
|
14
14
|
subject(:description) { Xommelier::OpenSearch::Description.parse(osd_xml) }
|
15
15
|
|
16
|
-
its(:adult_content) { should
|
16
|
+
its(:adult_content) { should be_falsey }
|
17
17
|
its(:attribution) { should == "\n Search data Copyright 2005, Example.com, Inc., All Rights Reserved\n " }
|
18
18
|
its(:contact) { should == 'admin@example.com' }
|
19
19
|
its(:description) { should == 'Use Example.com to search the Web.' }
|
@@ -26,26 +26,26 @@ describe Xommelier::OpenSearch::Description do
|
|
26
26
|
its(:syndication_right) { should == 'open' }
|
27
27
|
its(:tags) { should == 'example web' }
|
28
28
|
|
29
|
-
|
29
|
+
its('images.size') { should == 2 }
|
30
30
|
describe '#images' do
|
31
|
-
it { subject.images[0].
|
32
|
-
it { subject.images[0].type.
|
33
|
-
it { subject.images[0].height.
|
34
|
-
it { subject.images[0].width.
|
35
|
-
it { subject.images[1].
|
36
|
-
it { subject.images[1].type.
|
37
|
-
it { subject.images[1].height.
|
38
|
-
it { subject.images[1].width.
|
31
|
+
it { expect(subject.images[0]).to eq('http://example.com/websearch.png') }
|
32
|
+
it { expect(subject.images[0].type).to eq('image/png') }
|
33
|
+
it { expect(subject.images[0].height).to eq(64) }
|
34
|
+
it { expect(subject.images[0].width).to eq(64) }
|
35
|
+
it { expect(subject.images[1]).to eq('http://example.com/websearch.ico') }
|
36
|
+
it { expect(subject.images[1].type).to eq('image/vnd.microsoft.icon') }
|
37
|
+
it { expect(subject.images[1].height).to eq(16) }
|
38
|
+
it { expect(subject.images[1].width).to eq(16) }
|
39
39
|
end
|
40
40
|
|
41
|
-
|
41
|
+
its('urls.size') { should == 3 }
|
42
42
|
describe '#urls' do
|
43
|
-
it { subject.urls[0].type.
|
44
|
-
it { subject.urls[0].template.
|
45
|
-
it { subject.urls[1].type.
|
46
|
-
it { subject.urls[1].template.
|
47
|
-
it { subject.urls[2].type.
|
48
|
-
it { subject.urls[2].template.
|
43
|
+
it { expect(subject.urls[0].type).to eq('application/atom+xml') }
|
44
|
+
it { expect(subject.urls[0].template).to eq('http://example.com/?q={searchTerms}&pw={startPage?}&format=atom') }
|
45
|
+
it { expect(subject.urls[1].type).to eq('application/rss+xml') }
|
46
|
+
it { expect(subject.urls[1].template).to eq('http://example.com/?q={searchTerms}&pw={startPage?}&format=rss') }
|
47
|
+
it { expect(subject.urls[2].type).to eq('text/html') }
|
48
|
+
it { expect(subject.urls[2].template).to eq('http://example.com/?q={searchTerms}&pw={startPage?}') }
|
49
49
|
end
|
50
50
|
end
|
51
51
|
end
|
@@ -14,7 +14,7 @@ describe 'RSS feed' do
|
|
14
14
|
let(:rss_xml) { load_xml_file('feed.rss2.0') }
|
15
15
|
subject(:feed) { Xommelier::RSS::Rss.parse(rss_xml) }
|
16
16
|
|
17
|
-
it {
|
17
|
+
it { is_expected.to be_kind_of(Xommelier::RSS::Rss) }
|
18
18
|
|
19
19
|
its(:title) { should == 'Liftoff News' }
|
20
20
|
its(:last_build_date) { should == Time.utc(2003, 6, 10, 9, 41, 01) }
|
@@ -27,7 +27,7 @@ describe 'RSS feed' do
|
|
27
27
|
its(:managing_editor) { should == 'editor@example.com' }
|
28
28
|
its(:web_master) { should == 'webmaster@example.com' }
|
29
29
|
|
30
|
-
it { feed.
|
30
|
+
it { expect(feed.items.size).to eq(4) }
|
31
31
|
describe 'Item' do
|
32
32
|
subject(:item) { feed.items[0] }
|
33
33
|
|
@@ -12,14 +12,14 @@ describe Xommelier::Atom::Entry do
|
|
12
12
|
subject { Xommelier::Atom::Entry.new }
|
13
13
|
|
14
14
|
[:id, :title, :updated].each do |must_field|
|
15
|
-
it {
|
15
|
+
it { is_expected.to respond_to(must_field) }
|
16
16
|
end
|
17
17
|
[:content, :published, :rights, :source, :summary].each do |may_field|
|
18
|
-
it {
|
18
|
+
it { is_expected.to respond_to(may_field) }
|
19
19
|
end
|
20
20
|
%w(author category contributor link).each do |any_field|
|
21
|
-
it {
|
22
|
-
it('have plural methods for embedded collections') {
|
21
|
+
it { is_expected.to respond_to(any_field) }
|
22
|
+
it('have plural methods for embedded collections') { is_expected.to respond_to(any_field.pluralize) }
|
23
23
|
end
|
24
24
|
end
|
25
25
|
end
|
@@ -12,19 +12,19 @@ describe Xommelier::DS do
|
|
12
12
|
end
|
13
13
|
|
14
14
|
describe Xommelier::DS::Signature do
|
15
|
-
it {
|
16
|
-
it {
|
17
|
-
it {
|
15
|
+
it { is_expected.to respond_to(:signed_info) }
|
16
|
+
it { is_expected.to respond_to(:signature_value) }
|
17
|
+
it { is_expected.to respond_to(:key_info) }
|
18
18
|
end
|
19
19
|
|
20
20
|
describe Xommelier::DS::SignedInfo do
|
21
|
-
it {
|
22
|
-
it {
|
23
|
-
it {
|
21
|
+
it { is_expected.to respond_to(:canonicalization_method) }
|
22
|
+
it { is_expected.to respond_to(:signature_method) }
|
23
|
+
it { is_expected.to respond_to(:reference) }
|
24
24
|
end
|
25
25
|
|
26
26
|
describe Xommelier::DS::CanonicalizationMethod do
|
27
|
-
it {
|
27
|
+
it { is_expected.to respond_to(:algorithm) }
|
28
28
|
|
29
29
|
describe '.new_omit_comments' do
|
30
30
|
subject { described_class.new_omit_comments }
|
@@ -38,7 +38,7 @@ describe Xommelier::DS::CanonicalizationMethod do
|
|
38
38
|
end
|
39
39
|
|
40
40
|
describe Xommelier::DS::SignatureMethod do
|
41
|
-
it {
|
41
|
+
it { is_expected.to respond_to(:hmac_output_length) }
|
42
42
|
|
43
43
|
describe '.new_rsa_sha1' do
|
44
44
|
subject { described_class.new_rsa_sha1 }
|
@@ -52,7 +52,7 @@ describe Xommelier::DS::SignatureMethod do
|
|
52
52
|
end
|
53
53
|
|
54
54
|
describe Xommelier::DS::Transform do
|
55
|
-
it {
|
55
|
+
it { is_expected.to respond_to(:xpath) }
|
56
56
|
|
57
57
|
describe '.new_xslt' do
|
58
58
|
subject { described_class.new_xslt }
|
@@ -81,9 +81,9 @@ describe Xommelier::DS::DigestMethod do
|
|
81
81
|
end
|
82
82
|
|
83
83
|
describe Xommelier::DS::Reference do
|
84
|
-
it {
|
85
|
-
it {
|
86
|
-
it {
|
84
|
+
it { is_expected.to respond_to(:digest_method) }
|
85
|
+
it { is_expected.to respond_to(:digest_value) }
|
86
|
+
it { is_expected.to respond_to(:uri) }
|
87
87
|
end
|
88
88
|
|
89
89
|
describe Xommelier::DS::Signature, '(signature-example-rsa.xml)' do
|
@@ -15,15 +15,15 @@ describe Xommelier::RSS::EmailAddress do
|
|
15
15
|
}.each do |email_address, (address, name)|
|
16
16
|
it "parses #{email_address.inspect} as address:#{address.inspect}, name:#{name.inspect}" do
|
17
17
|
e = described_class.from_xommelier(email_address)
|
18
|
-
e.
|
19
|
-
e.name.
|
18
|
+
expect(e).to eq(address)
|
19
|
+
expect(e.name).to eq(name)
|
20
20
|
end
|
21
21
|
|
22
22
|
it "produces #{email_address.inspect} from address:#{address.inspect}, name:#{name.inspect}" do
|
23
23
|
e = described_class.new
|
24
24
|
e.address = address
|
25
25
|
e.name = name
|
26
|
-
e.to_xommelier.
|
26
|
+
expect(e.to_xommelier).to eq(email_address)
|
27
27
|
end
|
28
28
|
end
|
29
29
|
end
|
@@ -10,25 +10,25 @@ require 'spec_helper'
|
|
10
10
|
describe Xommelier::Xml::Element::Structure do
|
11
11
|
subject { NamespacedModule::RootWithSimpleSubelement }
|
12
12
|
|
13
|
-
it {
|
14
|
-
it {
|
13
|
+
it { is_expected.to respond_to(:elements) }
|
14
|
+
it { is_expected.to respond_to(:element) }
|
15
15
|
it 'defines subelement' do
|
16
|
-
NamespacedModule::RootWithSimpleSubelement.elements.
|
16
|
+
expect(NamespacedModule::RootWithSimpleSubelement.elements).to have_key(:some)
|
17
17
|
end
|
18
18
|
|
19
|
-
it {
|
20
|
-
it {
|
19
|
+
it { is_expected.to respond_to(:attributes) }
|
20
|
+
it { is_expected.to respond_to(:attribute) }
|
21
21
|
it 'defines attribute' do
|
22
|
-
NamespacedModule::RootWithAttribute.attributes.
|
22
|
+
expect(NamespacedModule::RootWithAttribute.attributes).to have_key(:another)
|
23
23
|
end
|
24
24
|
|
25
|
-
it {
|
25
|
+
it { is_expected.to respond_to(:text) }
|
26
26
|
it 'defines as containing text' do
|
27
|
-
NamespacedModule::RootWithText.new.
|
27
|
+
expect(NamespacedModule::RootWithText.new).to respond_to(:text)
|
28
28
|
end
|
29
29
|
|
30
|
-
it {
|
31
|
-
it { NamespacedModule::RootWithText.xmlns.uri.
|
32
|
-
it { NamespacedModule::RootWithAttribute.xmlns.uri.
|
33
|
-
it { Xommelier::Atom::Feed.xmlns.uri.
|
30
|
+
it { is_expected.to respond_to(:xmlns) }
|
31
|
+
it { expect(NamespacedModule::RootWithText.xmlns.uri).to eq('http://example.org/')}
|
32
|
+
it { expect(NamespacedModule::RootWithAttribute.xmlns.uri).to eq('http://example.org/')}
|
33
|
+
it { expect(Xommelier::Atom::Feed.xmlns.uri).to eq('http://www.w3.org/2005/Atom')}
|
34
34
|
end
|
@@ -11,33 +11,33 @@ describe Xommelier::Xml::Element do
|
|
11
11
|
describe 'class' do
|
12
12
|
subject { Xommelier::Atom::Link }
|
13
13
|
|
14
|
-
it {
|
15
|
-
it { subject.xmlns.to_s.
|
14
|
+
it { is_expected.to respond_to(:xmlns) }
|
15
|
+
it { expect(subject.xmlns.to_s).to eq(ATOM_XMLNS) }
|
16
16
|
|
17
|
-
it {
|
18
|
-
it { subject.element_name.
|
17
|
+
it { is_expected.to respond_to(:element_name) }
|
18
|
+
it { expect(subject.element_name).to eq('link') }
|
19
19
|
end
|
20
20
|
|
21
21
|
describe 'instance' do
|
22
22
|
subject { Xommelier::Atom::Link.new }
|
23
23
|
|
24
|
-
it {
|
25
|
-
it { subject.to_xml.
|
24
|
+
it { is_expected.to respond_to(:to_xml) }
|
25
|
+
it { expect(subject.to_xml).to eq(%(<?xml version="1.0" encoding="utf-8"?>\n<link xmlns="#{ATOM_XMLNS}"/>\n)) }
|
26
26
|
|
27
27
|
describe 'with text' do
|
28
28
|
subject { NamespacedModule::RootWithText.new('Text') }
|
29
29
|
|
30
|
-
it {
|
31
|
-
it { subject.text.
|
32
|
-
it { subject.to_xml.
|
30
|
+
it { is_expected.to respond_to(:text) }
|
31
|
+
it { expect(subject.text).to eq('Text') }
|
32
|
+
it { expect(subject.to_xml).to eq(%(<?xml version="1.0" encoding="utf-8"?>\n<root-with-text xmlns="http://example.org/">Text</root-with-text>\n)) }
|
33
33
|
end
|
34
34
|
|
35
35
|
describe 'with simple subelements' do
|
36
36
|
subject { Xommelier::Atom::Person.new(name: 'Ivan') }
|
37
37
|
|
38
|
-
it {
|
39
|
-
it { subject.name.
|
40
|
-
it { subject.to_xml.
|
38
|
+
it { is_expected.to respond_to(:name) }
|
39
|
+
it { expect(subject.name).to eq('Ivan') }
|
40
|
+
it { expect(subject.to_xml).to eq(%(<?xml version="1.0" encoding="utf-8"?>\n<person xmlns="#{ATOM_XMLNS}">\n <name>Ivan</name>\n</person>\n)) }
|
41
41
|
end
|
42
42
|
|
43
43
|
describe 'with many simple subelements' do
|
@@ -45,18 +45,18 @@ describe Xommelier::Xml::Element do
|
|
45
45
|
NamespacedModule::RootWithManySimpleSubelements.new(foos: %w(bar baz))
|
46
46
|
end
|
47
47
|
|
48
|
-
it {
|
49
|
-
it { subject.foos.
|
50
|
-
it { subject.foo.
|
51
|
-
it { subject.to_xml.
|
48
|
+
it { is_expected.to respond_to(:foo) }
|
49
|
+
it { expect(subject.foos).to eq(%w(bar baz)) }
|
50
|
+
it { expect(subject.foo).to eq('bar') }
|
51
|
+
it { expect(subject.to_xml).to eq(%(<?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)) }
|
52
52
|
end
|
53
53
|
|
54
54
|
describe 'with attribute' do
|
55
55
|
subject { NamespacedModule::RootWithAttribute.new(another: 'Difference') }
|
56
56
|
|
57
|
-
it {
|
58
|
-
it { subject.another.
|
59
|
-
it { subject.to_xml.
|
57
|
+
it { is_expected.to respond_to(:another) }
|
58
|
+
it { expect(subject.another).to eq('Difference') }
|
59
|
+
it { expect(subject.to_xml).to eq(%(<?xml version="1.0" encoding="utf-8"?>\n<root-with-attribute xmlns="http://example.org/" another="Difference"/>\n)) }
|
60
60
|
end
|
61
61
|
|
62
62
|
describe 'with subelements' do
|
@@ -69,13 +69,13 @@ describe Xommelier::Xml::Element do
|
|
69
69
|
)
|
70
70
|
end
|
71
71
|
|
72
|
-
it {
|
73
|
-
it {
|
74
|
-
it {
|
75
|
-
it {
|
76
|
-
it { subject.another.class.
|
77
|
-
it { subject.another.some.
|
78
|
-
it { subject.to_xml.
|
72
|
+
it { is_expected.to respond_to(:one) }
|
73
|
+
it { is_expected.to respond_to(:two) }
|
74
|
+
it { is_expected.to respond_to(:some) }
|
75
|
+
it { is_expected.to respond_to(:another) }
|
76
|
+
it { expect(subject.another.class).to eq(NamespacedModule::RootWithSimpleSubelement) }
|
77
|
+
it { expect(subject.another.some).to eq('Text') }
|
78
|
+
it { expect(subject.to_xml).to eq(%(<?xml version="1.0" encoding="utf-8"?>\n<root-with-subelement xmlns="http://example.org/" one="2011-08-15" two="2">\n <some>Text</some>\n <another>\n <some>Text</some>\n </another>\n</root-with-subelement>\n)) }
|
79
79
|
end
|
80
80
|
end
|
81
81
|
end
|
@@ -11,7 +11,7 @@ describe Xommelier::Xml do
|
|
11
11
|
end
|
12
12
|
|
13
13
|
describe Xommelier::Atom do
|
14
|
-
it {
|
15
|
-
it { subject.xmlns.to_s.
|
14
|
+
it { is_expected.to respond_to(:xmlns) }
|
15
|
+
it { expect(subject.xmlns.to_s).to eq(ATOM_XMLNS) }
|
16
16
|
its(:schema) { should_not be_nil }
|
17
17
|
end
|
data/spec/spec_helper.rb
CHANGED
@@ -9,11 +9,11 @@ SPEC_ROOT = File.expand_path('../..', __FILE__)
|
|
9
9
|
require 'simplecov'
|
10
10
|
require 'bundler/setup'
|
11
11
|
require 'rspec'
|
12
|
+
require 'rspec/its'
|
12
13
|
|
13
14
|
SimpleCov.start
|
14
15
|
|
15
16
|
require 'xommelier'
|
16
|
-
require 'namespaced_module'
|
17
17
|
|
18
18
|
#noinspection RubyResolve
|
19
19
|
Dir[File.join(SPEC_ROOT, 'spec/support/**/*.rb')].each {|f| require f}
|
File without changes
|
@@ -7,10 +7,10 @@
|
|
7
7
|
|
8
8
|
require 'rspec'
|
9
9
|
shared_examples 'Valid XML Document' do
|
10
|
-
it { subject.class.schema.
|
10
|
+
it { expect(subject.class.schema).to be_present }
|
11
11
|
specify do
|
12
12
|
begin
|
13
|
-
|
13
|
+
is_expected.to be_valid
|
14
14
|
rescue RSpec::Expectations::ExpectationNotMetError => e
|
15
15
|
puts subject.to_xml
|
16
16
|
puts subject.schema_validation_errors
|
data/xommelier.gemspec
CHANGED
@@ -19,11 +19,15 @@ Gem::Specification.new do |s|
|
|
19
19
|
s.executables = `git ls-files -- bin/*`.split("\n").map{ |f| File.basename(f) }
|
20
20
|
s.require_paths = %w(lib)
|
21
21
|
|
22
|
-
s.add_dependency 'nokogiri', '~> 1.
|
23
|
-
s.add_dependency 'activesupport', '~>
|
24
|
-
s.add_dependency 'activemodel'
|
25
|
-
s.
|
26
|
-
|
27
|
-
s.add_development_dependency 'rspec', '~> 2.
|
28
|
-
s.add_development_dependency '
|
22
|
+
s.add_dependency 'nokogiri', '~> 1.6.8'
|
23
|
+
s.add_dependency 'activesupport', '~> 4.2.2'
|
24
|
+
s.add_dependency 'activemodel'
|
25
|
+
s.add_dependency 'tzinfo', '~> 1.1'
|
26
|
+
|
27
|
+
s.add_development_dependency 'rspec', '~> 2.99.0'
|
28
|
+
s.add_development_dependency 'rspec-its', '~> 1.0.1'
|
29
|
+
s.add_development_dependency 'rake', '~> 10.4.2'
|
30
|
+
s.add_development_dependency 'yard', '~> 0.8.7.6'
|
31
|
+
s.add_development_dependency 'simplecov', '~> 0.6.1'
|
32
|
+
s.add_development_dependency 'redcarpet', '>= 3.2.3'
|
29
33
|
end
|
metadata
CHANGED
@@ -1,113 +1,155 @@
|
|
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.32
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Alexander Semyonov
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2016-07-05 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: nokogiri
|
15
15
|
requirement: !ruby/object:Gem::Requirement
|
16
16
|
requirements:
|
17
|
-
- - ~>
|
17
|
+
- - "~>"
|
18
18
|
- !ruby/object:Gem::Version
|
19
|
-
version:
|
19
|
+
version: 1.6.8
|
20
20
|
type: :runtime
|
21
21
|
prerelease: false
|
22
22
|
version_requirements: !ruby/object:Gem::Requirement
|
23
23
|
requirements:
|
24
|
-
- - ~>
|
24
|
+
- - "~>"
|
25
25
|
- !ruby/object:Gem::Version
|
26
|
-
version:
|
26
|
+
version: 1.6.8
|
27
27
|
- !ruby/object:Gem::Dependency
|
28
28
|
name: activesupport
|
29
29
|
requirement: !ruby/object:Gem::Requirement
|
30
30
|
requirements:
|
31
|
-
- - ~>
|
31
|
+
- - "~>"
|
32
32
|
- !ruby/object:Gem::Version
|
33
|
-
version:
|
33
|
+
version: 4.2.2
|
34
34
|
type: :runtime
|
35
35
|
prerelease: false
|
36
36
|
version_requirements: !ruby/object:Gem::Requirement
|
37
37
|
requirements:
|
38
|
-
- - ~>
|
38
|
+
- - "~>"
|
39
39
|
- !ruby/object:Gem::Version
|
40
|
-
version:
|
40
|
+
version: 4.2.2
|
41
41
|
- !ruby/object:Gem::Dependency
|
42
42
|
name: activemodel
|
43
43
|
requirement: !ruby/object:Gem::Requirement
|
44
44
|
requirements:
|
45
|
-
- -
|
45
|
+
- - ">="
|
46
46
|
- !ruby/object:Gem::Version
|
47
|
-
version:
|
47
|
+
version: '0'
|
48
48
|
type: :runtime
|
49
49
|
prerelease: false
|
50
50
|
version_requirements: !ruby/object:Gem::Requirement
|
51
51
|
requirements:
|
52
|
-
- -
|
52
|
+
- - ">="
|
53
53
|
- !ruby/object:Gem::Version
|
54
|
-
version:
|
54
|
+
version: '0'
|
55
55
|
- !ruby/object:Gem::Dependency
|
56
|
-
name:
|
56
|
+
name: tzinfo
|
57
57
|
requirement: !ruby/object:Gem::Requirement
|
58
58
|
requirements:
|
59
|
-
- - ~>
|
59
|
+
- - "~>"
|
60
60
|
- !ruby/object:Gem::Version
|
61
|
-
version: 1.
|
61
|
+
version: '1.1'
|
62
|
+
type: :runtime
|
63
|
+
prerelease: false
|
64
|
+
version_requirements: !ruby/object:Gem::Requirement
|
65
|
+
requirements:
|
66
|
+
- - "~>"
|
67
|
+
- !ruby/object:Gem::Version
|
68
|
+
version: '1.1'
|
69
|
+
- !ruby/object:Gem::Dependency
|
70
|
+
name: rspec
|
71
|
+
requirement: !ruby/object:Gem::Requirement
|
72
|
+
requirements:
|
73
|
+
- - "~>"
|
74
|
+
- !ruby/object:Gem::Version
|
75
|
+
version: 2.99.0
|
62
76
|
type: :development
|
63
77
|
prerelease: false
|
64
78
|
version_requirements: !ruby/object:Gem::Requirement
|
65
79
|
requirements:
|
66
|
-
- - ~>
|
80
|
+
- - "~>"
|
67
81
|
- !ruby/object:Gem::Version
|
68
|
-
version:
|
82
|
+
version: 2.99.0
|
83
|
+
- !ruby/object:Gem::Dependency
|
84
|
+
name: rspec-its
|
85
|
+
requirement: !ruby/object:Gem::Requirement
|
86
|
+
requirements:
|
87
|
+
- - "~>"
|
88
|
+
- !ruby/object:Gem::Version
|
89
|
+
version: 1.0.1
|
90
|
+
type: :development
|
91
|
+
prerelease: false
|
92
|
+
version_requirements: !ruby/object:Gem::Requirement
|
93
|
+
requirements:
|
94
|
+
- - "~>"
|
95
|
+
- !ruby/object:Gem::Version
|
96
|
+
version: 1.0.1
|
69
97
|
- !ruby/object:Gem::Dependency
|
70
98
|
name: rake
|
71
99
|
requirement: !ruby/object:Gem::Requirement
|
72
100
|
requirements:
|
73
|
-
- - ~>
|
101
|
+
- - "~>"
|
74
102
|
- !ruby/object:Gem::Version
|
75
|
-
version: 10.
|
103
|
+
version: 10.4.2
|
76
104
|
type: :development
|
77
105
|
prerelease: false
|
78
106
|
version_requirements: !ruby/object:Gem::Requirement
|
79
107
|
requirements:
|
80
|
-
- - ~>
|
108
|
+
- - "~>"
|
81
109
|
- !ruby/object:Gem::Version
|
82
|
-
version: 10.
|
110
|
+
version: 10.4.2
|
83
111
|
- !ruby/object:Gem::Dependency
|
84
|
-
name:
|
112
|
+
name: yard
|
85
113
|
requirement: !ruby/object:Gem::Requirement
|
86
114
|
requirements:
|
87
|
-
- - ~>
|
115
|
+
- - "~>"
|
88
116
|
- !ruby/object:Gem::Version
|
89
|
-
version:
|
117
|
+
version: 0.8.7.6
|
90
118
|
type: :development
|
91
119
|
prerelease: false
|
92
120
|
version_requirements: !ruby/object:Gem::Requirement
|
93
121
|
requirements:
|
94
|
-
- - ~>
|
122
|
+
- - "~>"
|
95
123
|
- !ruby/object:Gem::Version
|
96
|
-
version:
|
124
|
+
version: 0.8.7.6
|
97
125
|
- !ruby/object:Gem::Dependency
|
98
126
|
name: simplecov
|
99
127
|
requirement: !ruby/object:Gem::Requirement
|
100
128
|
requirements:
|
101
|
-
- - ~>
|
129
|
+
- - "~>"
|
130
|
+
- !ruby/object:Gem::Version
|
131
|
+
version: 0.6.1
|
132
|
+
type: :development
|
133
|
+
prerelease: false
|
134
|
+
version_requirements: !ruby/object:Gem::Requirement
|
135
|
+
requirements:
|
136
|
+
- - "~>"
|
137
|
+
- !ruby/object:Gem::Version
|
138
|
+
version: 0.6.1
|
139
|
+
- !ruby/object:Gem::Dependency
|
140
|
+
name: redcarpet
|
141
|
+
requirement: !ruby/object:Gem::Requirement
|
142
|
+
requirements:
|
143
|
+
- - ">="
|
102
144
|
- !ruby/object:Gem::Version
|
103
|
-
version:
|
145
|
+
version: 3.2.3
|
104
146
|
type: :development
|
105
147
|
prerelease: false
|
106
148
|
version_requirements: !ruby/object:Gem::Requirement
|
107
149
|
requirements:
|
108
|
-
- -
|
150
|
+
- - ">="
|
109
151
|
- !ruby/object:Gem::Version
|
110
|
-
version:
|
152
|
+
version: 3.2.3
|
111
153
|
description: XML-Object Mapper with many built-in XML formats supported
|
112
154
|
email:
|
113
155
|
- al@semyonov.us
|
@@ -115,9 +157,9 @@ executables: []
|
|
115
157
|
extensions: []
|
116
158
|
extra_rdoc_files: []
|
117
159
|
files:
|
118
|
-
- .gitignore
|
119
|
-
- .rspec
|
120
|
-
- .travis.yml
|
160
|
+
- ".gitignore"
|
161
|
+
- ".rspec"
|
162
|
+
- ".travis.yml"
|
121
163
|
- Gemfile
|
122
164
|
- Guardfile
|
123
165
|
- MIT-LICENSE
|
@@ -214,9 +256,9 @@ files:
|
|
214
256
|
- spec/lib/xommelier/xml/element_spec.rb
|
215
257
|
- spec/lib/xommelier/xml_spec.rb
|
216
258
|
- spec/lib/xommelier_spec.rb
|
217
|
-
- spec/namespaced_module.rb
|
218
259
|
- spec/spec_helper.rb
|
219
260
|
- spec/support/fixtures.rb
|
261
|
+
- spec/support/namespaced_module.rb
|
220
262
|
- spec/support/schema_validatable.rb
|
221
263
|
- xommelier.gemspec
|
222
264
|
homepage: http://github.com/alsemyonov/xommelier
|
@@ -229,17 +271,17 @@ require_paths:
|
|
229
271
|
- lib
|
230
272
|
required_ruby_version: !ruby/object:Gem::Requirement
|
231
273
|
requirements:
|
232
|
-
- -
|
274
|
+
- - ">="
|
233
275
|
- !ruby/object:Gem::Version
|
234
276
|
version: '0'
|
235
277
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
236
278
|
requirements:
|
237
|
-
- -
|
279
|
+
- - ">="
|
238
280
|
- !ruby/object:Gem::Version
|
239
281
|
version: '0'
|
240
282
|
requirements: []
|
241
283
|
rubyforge_project: xommelier
|
242
|
-
rubygems_version: 2.
|
284
|
+
rubygems_version: 2.6.4
|
243
285
|
signing_key:
|
244
286
|
specification_version: 4
|
245
287
|
summary: Xommelier is an XML Sommelier
|
@@ -270,8 +312,8 @@ test_files:
|
|
270
312
|
- spec/lib/xommelier/xml/element_spec.rb
|
271
313
|
- spec/lib/xommelier/xml_spec.rb
|
272
314
|
- spec/lib/xommelier_spec.rb
|
273
|
-
- spec/namespaced_module.rb
|
274
315
|
- spec/spec_helper.rb
|
275
316
|
- spec/support/fixtures.rb
|
317
|
+
- spec/support/namespaced_module.rb
|
276
318
|
- spec/support/schema_validatable.rb
|
277
319
|
has_rdoc:
|