saxophone 1.0.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.
@@ -0,0 +1,49 @@
1
+ require File.expand_path(File.dirname(__FILE__) + '/../spec_helper')
2
+
3
+ describe "Saxophone inheritance" do
4
+ before do
5
+ class A
6
+ include Saxophone
7
+ element :title
8
+ end
9
+
10
+ class B < A
11
+ element :b
12
+ end
13
+
14
+ class C < B
15
+ element :c
16
+ end
17
+
18
+ xml = "<top><title>Test</title><b>Matched!</b><c>And Again</c></top>"
19
+ @a = A.new
20
+ @a.parse xml
21
+ @b = B.new
22
+ @b.parse xml
23
+ @c = C.new
24
+ @c.parse xml
25
+ end
26
+
27
+ after do
28
+ Object.send(:remove_const, :A)
29
+ Object.send(:remove_const, :B)
30
+ Object.send(:remove_const, :C)
31
+ end
32
+
33
+ it { expect(@a).to be_a(A) }
34
+ it { expect(@a).not_to be_a(B) }
35
+ it { expect(@a).to be_a(Saxophone) }
36
+ it { expect(@a.title).to eq("Test") }
37
+ it { expect(@b).to be_a(A) }
38
+ it { expect(@b).to be_a(B) }
39
+ it { expect(@b).to be_a(Saxophone) }
40
+ it { expect(@b.title).to eq("Test") }
41
+ it { expect(@b.b).to eq("Matched!") }
42
+ it { expect(@c).to be_a(A) }
43
+ it { expect(@c).to be_a(B) }
44
+ it { expect(@c).to be_a(C) }
45
+ it { expect(@c).to be_a(Saxophone) }
46
+ it { expect(@c.title).to eq("Test") }
47
+ it { expect(@c.b).to eq("Matched!") }
48
+ it { expect(@c.c).to eq("And Again") }
49
+ end
@@ -0,0 +1,22 @@
1
+ begin
2
+ require 'simplecov'
3
+ require 'coveralls'
4
+
5
+ SimpleCov.formatter = SimpleCov::Formatter::MultiFormatter[
6
+ SimpleCov::Formatter::HTMLFormatter,
7
+ Coveralls::SimpleCov::Formatter
8
+ ]
9
+
10
+ SimpleCov.start do
11
+ add_filter '/spec/'
12
+ end
13
+ rescue LoadError
14
+ end
15
+
16
+ require File.expand_path(File.dirname(__FILE__) + '/../lib/saxophone')
17
+ Saxophone.handler = ENV['HANDLER'].to_sym if ENV['HANDLER']
18
+
19
+ RSpec.configure do |config|
20
+ config.run_all_when_everything_filtered = true
21
+ config.filter_run :focus
22
+ end
metadata ADDED
@@ -0,0 +1,98 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: saxophone
3
+ version: !ruby/object:Gem::Version
4
+ version: 1.0.0
5
+ platform: ruby
6
+ authors:
7
+ - Paul Dix
8
+ - Julien Kirch
9
+ - Ezekiel Templin
10
+ - Dmitry Krasnoukhov
11
+ - Robin Neumann
12
+ autorequire:
13
+ bindir: bin
14
+ cert_chain: []
15
+ date: 2018-10-19 00:00:00.000000000 Z
16
+ dependencies:
17
+ - !ruby/object:Gem::Dependency
18
+ name: rspec
19
+ requirement: !ruby/object:Gem::Requirement
20
+ requirements:
21
+ - - "~>"
22
+ - !ruby/object:Gem::Version
23
+ version: '3.6'
24
+ type: :development
25
+ prerelease: false
26
+ version_requirements: !ruby/object:Gem::Requirement
27
+ requirements:
28
+ - - "~>"
29
+ - !ruby/object:Gem::Version
30
+ version: '3.6'
31
+ description:
32
+ email:
33
+ executables: []
34
+ extensions: []
35
+ extra_rdoc_files: []
36
+ files:
37
+ - ".gitignore"
38
+ - ".rspec"
39
+ - ".ruby-version"
40
+ - ".travis.yml"
41
+ - Gemfile
42
+ - README.md
43
+ - Rakefile
44
+ - archive/HISTORY.md
45
+ - lib/saxophone.rb
46
+ - lib/saxophone/config/sax_ancestor.rb
47
+ - lib/saxophone/config/sax_attribute.rb
48
+ - lib/saxophone/config/sax_collection.rb
49
+ - lib/saxophone/config/sax_element.rb
50
+ - lib/saxophone/config/sax_element_value.rb
51
+ - lib/saxophone/handlers/sax_abstract_handler.rb
52
+ - lib/saxophone/handlers/sax_nokogiri_handler.rb
53
+ - lib/saxophone/handlers/sax_oga_handler.rb
54
+ - lib/saxophone/handlers/sax_ox_handler.rb
55
+ - lib/saxophone/sax_config.rb
56
+ - lib/saxophone/sax_configure.rb
57
+ - lib/saxophone/sax_document.rb
58
+ - lib/saxophone/version.rb
59
+ - saxophone.gemspec
60
+ - spec/fixtures/atom-content.html
61
+ - spec/fixtures/atom.xml
62
+ - spec/saxophone/sax_activerecord_spec.rb
63
+ - spec/saxophone/sax_configure_spec.rb
64
+ - spec/saxophone/sax_document_spec.rb
65
+ - spec/saxophone/sax_include_spec.rb
66
+ - spec/spec_helper.rb
67
+ homepage: http://github.com/Absolventa/saxophone
68
+ licenses:
69
+ - MIT
70
+ metadata: {}
71
+ post_install_message:
72
+ rdoc_options: []
73
+ require_paths:
74
+ - lib
75
+ required_ruby_version: !ruby/object:Gem::Requirement
76
+ requirements:
77
+ - - ">="
78
+ - !ruby/object:Gem::Version
79
+ version: '0'
80
+ required_rubygems_version: !ruby/object:Gem::Requirement
81
+ requirements:
82
+ - - ">="
83
+ - !ruby/object:Gem::Version
84
+ version: '0'
85
+ requirements: []
86
+ rubyforge_project:
87
+ rubygems_version: 2.2.2
88
+ signing_key:
89
+ specification_version: 4
90
+ summary: Declarative SAX Parsing with Nokogiri, Ox or Oga
91
+ test_files:
92
+ - spec/fixtures/atom-content.html
93
+ - spec/fixtures/atom.xml
94
+ - spec/saxophone/sax_activerecord_spec.rb
95
+ - spec/saxophone/sax_configure_spec.rb
96
+ - spec/saxophone/sax_document_spec.rb
97
+ - spec/saxophone/sax_include_spec.rb
98
+ - spec/spec_helper.rb