milkfarm-onix 0.8.6 → 0.8.7
Sign up to get free protection for your applications and to get access to all the features.
- data/CHANGELOG +21 -0
- data/README.markdown +1 -0
- data/lib/onix.rb +4 -17
- data/lib/onix/code_list_extractor.rb +69 -0
- data/lib/onix/lists.rb +134 -0
- data/lib/onix/product.rb +14 -0
- data/lib/onix/sl_product.rb +24 -1
- data/lib/onix/version.rb +3 -0
- data/lib/onix/work_identifier.rb +28 -0
- data/spec/apa_product_spec.rb +9 -9
- data/spec/audience_range_spec.rb +4 -4
- data/spec/contributor_spec.rb +4 -4
- data/spec/header_spec.rb +7 -7
- data/spec/imprint_spec.rb +4 -4
- data/spec/language_spec.rb +4 -4
- data/spec/lists_spec.rb +33 -0
- data/spec/market_representation_spec.rb +4 -6
- data/spec/measure_spec.rb +4 -4
- data/spec/media_file_spec.rb +4 -4
- data/spec/normaliser_spec.rb +28 -4
- data/spec/other_text_spec.rb +4 -4
- data/spec/price_spec.rb +4 -4
- data/spec/product_identifier_spec.rb +4 -4
- data/spec/product_spec.rb +8 -8
- data/spec/publisher_spec.rb +4 -4
- data/spec/reader_spec.rb +11 -11
- data/spec/sales_restriction_spec.rb +4 -5
- data/spec/sender_identifier.rb +4 -4
- data/spec/series_identifier_spec.rb +4 -4
- data/spec/series_spec.rb +4 -4
- data/spec/spec_helper.rb +4 -1
- data/spec/stock_spec.rb +4 -4
- data/spec/subject_spec.rb +4 -5
- data/spec/supply_detail_spec.rb +4 -4
- data/spec/title_spec.rb +4 -4
- data/spec/website_spec.rb +4 -4
- data/spec/work_identifier_spec.rb +39 -0
- data/spec/writer_spec.rb +7 -7
- data/support/codes/001.tsv +10 -0
- data/support/codes/002.tsv +5 -0
- data/support/codes/003.tsv +7 -0
- data/support/codes/005.tsv +13 -0
- data/support/codes/006.tsv +76 -0
- data/support/codes/007.tsv +123 -0
- data/support/codes/008.tsv +7 -0
- data/support/codes/009.tsv +7 -0
- data/support/codes/010.tsv +34 -0
- data/support/codes/011.tsv +11 -0
- data/support/codes/012.tsv +11 -0
- data/support/codes/013.tsv +7 -0
- data/support/codes/014.tsv +4 -0
- data/support/codes/015.tsv +13 -0
- data/support/codes/016.tsv +6 -0
- data/support/codes/017.tsv +90 -0
- data/support/codes/018.tsv +3 -0
- data/support/codes/019.tsv +7 -0
- data/support/codes/020.tsv +0 -0
- data/support/codes/021.tsv +31 -0
- data/support/codes/022.tsv +9 -0
- data/support/codes/023.tsv +9 -0
- data/support/codes/024.tsv +11 -0
- data/support/codes/025.tsv +29 -0
- data/support/codes/026.tsv +75 -0
- data/support/codes/027.tsv +75 -0
- data/support/codes/028.tsv +8 -0
- data/support/codes/029.tsv +16 -0
- data/support/codes/030.tsv +15 -0
- data/support/codes/031.tsv +3 -0
- data/support/codes/032.tsv +2 -0
- data/support/codes/033.tsv +36 -0
- data/support/codes/034.tsv +14 -0
- data/support/codes/035.tsv +6 -0
- data/support/codes/036.tsv +3 -0
- data/support/codes/037.tsv +6 -0
- data/support/codes/038.tsv +36 -0
- data/support/codes/039.tsv +8 -0
- data/support/codes/040.tsv +6 -0
- data/support/codes/041.tsv +6 -0
- data/support/codes/042.tsv +16 -0
- data/support/codes/043.tsv +4 -0
- data/support/codes/044.tsv +13 -0
- data/support/codes/045.tsv +12 -0
- data/support/codes/046.tsv +3 -0
- data/support/codes/047.tsv +4 -0
- data/support/codes/048.tsv +11 -0
- data/support/codes/049.tsv +84 -0
- data/support/codes/050.tsv +8 -0
- data/support/codes/051.tsv +27 -0
- data/support/codes/052.tsv +1 -0
- data/support/codes/053.tsv +3 -0
- data/support/codes/054.tsv +23 -0
- data/support/codes/055.tsv +13 -0
- data/support/codes/056.tsv +2 -0
- data/support/codes/057.tsv +5 -0
- data/support/codes/058.tsv +21 -0
- data/support/codes/059.tsv +4 -0
- data/support/codes/060.tsv +2 -0
- data/support/codes/061.tsv +3 -0
- data/support/codes/062.tsv +5 -0
- data/support/codes/063.tsv +0 -0
- data/support/codes/064.tsv +13 -0
- data/support/codes/065.tsv +25 -0
- data/support/codes/066.tsv +4 -0
- data/support/codes/067.tsv +2 -0
- data/support/codes/068.tsv +15 -0
- data/support/codes/069.tsv +4 -0
- data/support/codes/070.tsv +2 -0
- data/support/codes/071.tsv +9 -0
- data/support/codes/072.tsv +7 -0
- data/support/codes/073.tsv +36 -0
- data/support/codes/074.tsv +489 -0
- data/support/codes/075.tsv +2 -0
- data/support/codes/076.tsv +12 -0
- data/support/codes/077.tsv +19 -0
- data/support/codes/078.tsv +148 -0
- data/support/codes/079.tsv +17 -0
- data/support/codes/080.tsv +19 -0
- data/support/codes/081.tsv +11 -0
- data/support/codes/082.tsv +17 -0
- data/support/codes/083.tsv +68 -0
- data/support/codes/084.tsv +10 -0
- data/support/codes/085.tsv +23 -0
- data/support/codes/086.tsv +5 -0
- data/support/codes/087.tsv +6 -0
- data/support/codes/088.tsv +0 -0
- data/support/codes/089.tsv +1 -0
- data/support/codes/090.tsv +11 -0
- data/support/codes/091.tsv +248 -0
- data/support/codes/092.tsv +7 -0
- data/support/codes/093.tsv +13 -0
- data/support/codes/094.tsv +3 -0
- data/support/codes/095.tsv +3 -0
- data/support/codes/096.tsv +185 -0
- data/support/codes/097.tsv +1 -0
- data/support/codes/098.tsv +21 -0
- data/support/codes/099.tsv +24 -0
- data/support/codes/100.tsv +4 -0
- data/support/codes/101.tsv +2 -0
- data/support/codes/102.tsv +3 -0
- data/support/codes/121.tsv +127 -0
- data/support/codes/138.tsv +6 -0
- data/support/codes/139.tsv +70 -0
- data/support/codes/140.tsv +7 -0
- data/support/codes/141.tsv +10 -0
- data/support/codes/142.tsv +12 -0
- data/support/codes/143.tsv +7 -0
- data/support/codes/144.tsv +4 -0
- data/support/codes/145.tsv +5 -0
- data/support/codes/146.tsv +3 -0
- data/support/codes/147.tsv +7 -0
- data/support/codes/148.tsv +3 -0
- data/support/codes/149.tsv +4 -0
- data/support/codes/150.tsv +124 -0
- data/support/codes/151.tsv +7 -0
- data/support/codes/152.tsv +2 -0
- data/support/codes/153.tsv +14 -0
- data/support/codes/154.tsv +9 -0
- data/support/codes/155.tsv +5 -0
- data/support/codes/156.tsv +4 -0
- data/support/codes/157.tsv +4 -0
- data/support/codes/158.tsv +24 -0
- data/support/codes/159.tsv +6 -0
- data/support/codes/160.tsv +0 -0
- data/support/codes/161.tsv +3 -0
- data/support/codes/162.tsv +3 -0
- data/support/codes/163.tsv +7 -0
- data/support/codes/164.tsv +2 -0
- data/support/codes/165.tsv +2 -0
- data/support/codes/166.tsv +2 -0
- data/support/codes/167.tsv +3 -0
- data/support/codes/168.tsv +2 -0
- data/support/codes/169.tsv +3 -0
- data/support/codes/170.tsv +0 -0
- data/support/codes/171.tsv +2 -0
- data/support/codes/172.tsv +1 -0
- data/support/codes/173.tsv +2 -0
- data/support/codes/174.tsv +2 -0
- data/support/codes/175.tsv +175 -0
- data/support/codes/176.tsv +12 -0
- data/support/codes/177.tsv +2 -0
- data/support/codes/178.tsv +17 -0
- data/support/switch-onix-2.1-short-to-reference.xsl +3 -2
- metadata +226 -38
- data/lib/onix/lists/audience_code.rb +0 -17
- data/lib/onix/lists/contributor_role.rb +0 -99
- data/lib/onix/lists/country_code.rb +0 -257
- data/lib/onix/lists/language_code.rb +0 -498
- data/lib/onix/lists/language_role.rb +0 -18
- data/lib/onix/lists/notification_type.rb +0 -19
- data/lib/onix/lists/product_availability.rb +0 -32
- data/lib/onix/lists/product_form.rb +0 -99
- data/lib/onix/lists/product_form_detail.rb +0 -157
data/spec/product_spec.rb
CHANGED
@@ -2,7 +2,7 @@
|
|
2
2
|
|
3
3
|
require File.dirname(__FILE__) + '/spec_helper.rb'
|
4
4
|
|
5
|
-
|
5
|
+
describe ONIX::Product do
|
6
6
|
|
7
7
|
before(:each) do
|
8
8
|
@data_path = File.join(File.dirname(__FILE__),"..","data")
|
@@ -11,7 +11,7 @@ context "ONIX::Product" do
|
|
11
11
|
@product_node = @doc.root
|
12
12
|
end
|
13
13
|
|
14
|
-
|
14
|
+
it "should provide read access to first level attributes" do
|
15
15
|
product = ONIX::Product.from_xml(@product_node.to_s)
|
16
16
|
|
17
17
|
product.record_reference.should eql("365-9780194351898")
|
@@ -32,27 +32,27 @@ context "ONIX::Product" do
|
|
32
32
|
product.dimensions.should eql("100x200")
|
33
33
|
end
|
34
34
|
|
35
|
-
|
35
|
+
it "should provide read access to product IDs" do
|
36
36
|
product = ONIX::Product.from_xml(@product_node.to_s)
|
37
37
|
product.product_identifiers.size.should eql(3)
|
38
38
|
end
|
39
39
|
|
40
|
-
|
40
|
+
it "should provide read access to titles" do
|
41
41
|
product = ONIX::Product.from_xml(@product_node.to_s)
|
42
42
|
product.titles.size.should eql(1)
|
43
43
|
end
|
44
44
|
|
45
|
-
|
45
|
+
it "should provide read access to subjects" do
|
46
46
|
product = ONIX::Product.from_xml(@product_node.to_s)
|
47
47
|
product.subjects.size.should eql(1)
|
48
48
|
end
|
49
49
|
|
50
|
-
|
50
|
+
it "should provide read access to measurements" do
|
51
51
|
product = ONIX::Product.from_xml(@product_node.to_s)
|
52
52
|
product.measurements.size.should eql(1)
|
53
53
|
end
|
54
54
|
|
55
|
-
|
55
|
+
it "should provide write access to first level attributes" do
|
56
56
|
product = ONIX::Product.new
|
57
57
|
|
58
58
|
product.notification_type = 3
|
@@ -83,7 +83,7 @@ context "ONIX::Product" do
|
|
83
83
|
product.to_xml.to_s.include?("<YearFirstPublished>1998</YearFirstPublished>").should be_true
|
84
84
|
end
|
85
85
|
|
86
|
-
|
86
|
+
it "should correctly from_xml files that have an invalid publication date" do
|
87
87
|
file = File.join(@data_path, "product_invalid_pubdate.xml")
|
88
88
|
product = ONIX::Product.from_xml(File.read(file))
|
89
89
|
|
data/spec/publisher_spec.rb
CHANGED
@@ -2,7 +2,7 @@
|
|
2
2
|
|
3
3
|
require File.dirname(__FILE__) + '/spec_helper.rb'
|
4
4
|
|
5
|
-
|
5
|
+
describe ONIX::Publisher do
|
6
6
|
|
7
7
|
before(:each) do
|
8
8
|
data_path = File.join(File.dirname(__FILE__),"..","data")
|
@@ -11,18 +11,18 @@ context "ONIX::Publisher" do
|
|
11
11
|
@root = @doc.root
|
12
12
|
end
|
13
13
|
|
14
|
-
|
14
|
+
it "should correctly convert to a string" do
|
15
15
|
pub = ONIX::Publisher.from_xml(@root.to_s)
|
16
16
|
pub.to_xml.to_s[0,11].should eql("<Publisher>")
|
17
17
|
end
|
18
18
|
|
19
|
-
|
19
|
+
it "should provide read access to first level attributes" do
|
20
20
|
pub = ONIX::Publisher.from_xml(@root.to_s)
|
21
21
|
pub.publishing_role.should eql(1)
|
22
22
|
pub.publisher_name.should eql("Desbooks Publishing")
|
23
23
|
end
|
24
24
|
|
25
|
-
|
25
|
+
it "should provide write access to first level attributes" do
|
26
26
|
pub = ONIX::Publisher.new
|
27
27
|
|
28
28
|
pub.publisher_name = "Paulist Press"
|
data/spec/reader_spec.rb
CHANGED
@@ -2,7 +2,7 @@
|
|
2
2
|
|
3
3
|
require File.dirname(__FILE__) + '/spec_helper.rb'
|
4
4
|
|
5
|
-
|
5
|
+
describe ONIX::Reader do
|
6
6
|
|
7
7
|
before(:each) do
|
8
8
|
@data_path = File.join(File.dirname(__FILE__),"..","data")
|
@@ -14,30 +14,30 @@ context "ONIX::Reader" do
|
|
14
14
|
@iso_8859_1_file = File.join(@data_path, "iso_8859_1.xml")
|
15
15
|
end
|
16
16
|
|
17
|
-
|
17
|
+
it "should initialize with a filename" do
|
18
18
|
reader = ONIX::Reader.new(@file1)
|
19
19
|
reader.instance_variable_get("@reader").should be_a_kind_of(Nokogiri::XML::Reader)
|
20
20
|
end
|
21
21
|
|
22
|
-
|
22
|
+
it "should initialize with an IO object" do
|
23
23
|
File.open(@file1,"rb") do |f|
|
24
24
|
reader = ONIX::Reader.new(f)
|
25
25
|
reader.instance_variable_get("@reader").should be_a_kind_of(Nokogiri::XML::Reader)
|
26
26
|
end
|
27
27
|
end
|
28
28
|
|
29
|
-
|
29
|
+
it "should provide access to various XML metadata from file" do
|
30
30
|
filename = File.join(@data_path, "reference_with_release_attrib.xml")
|
31
31
|
reader = ONIX::Reader.new(filename)
|
32
32
|
reader.release.should eql(BigDecimal.new("2.1"))
|
33
33
|
end
|
34
34
|
|
35
|
-
|
35
|
+
it "should provide access to the header in an ONIX file" do
|
36
36
|
reader = ONIX::Reader.new(@file1)
|
37
37
|
reader.header.should be_a_kind_of(ONIX::Header)
|
38
38
|
end
|
39
39
|
|
40
|
-
|
40
|
+
it "should iterate over all product records in an ONIX file" do
|
41
41
|
reader = ONIX::Reader.new(@file1)
|
42
42
|
counter = 0
|
43
43
|
reader.each do |product|
|
@@ -48,7 +48,7 @@ context "ONIX::Reader" do
|
|
48
48
|
counter.should eql(1)
|
49
49
|
end
|
50
50
|
|
51
|
-
|
51
|
+
it "should iterate over all product records in an ONIX file" do
|
52
52
|
reader = ONIX::Reader.new(@file2)
|
53
53
|
products = []
|
54
54
|
reader.each do |product|
|
@@ -63,7 +63,7 @@ context "ONIX::Reader" do
|
|
63
63
|
# libxml can handle the 3 standard entities fine (& < and ^gt;) but
|
64
64
|
# barfs when it encounters others. In theory other entities are defined in the
|
65
65
|
# ONIX DTD, but I can't work out how to get libxml to recognise them
|
66
|
-
|
66
|
+
it "should correctly parse a file that has an entity in it" do
|
67
67
|
reader = ONIX::Reader.new(@entity_file)
|
68
68
|
|
69
69
|
products = []
|
@@ -78,7 +78,7 @@ context "ONIX::Reader" do
|
|
78
78
|
end
|
79
79
|
|
80
80
|
# for some reason I'm getting segfaults when I read a file with more than 7 records
|
81
|
-
|
81
|
+
it "should correctly parse a file with more than 7 records in in" do
|
82
82
|
reader = ONIX::Reader.new(@long_file)
|
83
83
|
counter = 0
|
84
84
|
reader.each do |product|
|
@@ -88,7 +88,7 @@ context "ONIX::Reader" do
|
|
88
88
|
counter.should eql(346)
|
89
89
|
end
|
90
90
|
|
91
|
-
|
91
|
+
it "should transparently convert a iso-8859-1 file to utf-8" do
|
92
92
|
reader = ONIX::Reader.new(@iso_8859_1_file)
|
93
93
|
product = nil
|
94
94
|
reader.each do |p|
|
@@ -105,7 +105,7 @@ context "ONIX::Reader" do
|
|
105
105
|
|
106
106
|
end
|
107
107
|
|
108
|
-
|
108
|
+
it "should transparently convert a utf-16 file to utf-8" do
|
109
109
|
reader = ONIX::Reader.new(@utf_16_file)
|
110
110
|
product = nil
|
111
111
|
reader.each do |p|
|
@@ -2,7 +2,7 @@
|
|
2
2
|
|
3
3
|
require File.dirname(__FILE__) + '/spec_helper.rb'
|
4
4
|
|
5
|
-
|
5
|
+
describe "ONIX::SalesRestriction" do
|
6
6
|
|
7
7
|
before(:each) do
|
8
8
|
data_path = File.join(File.dirname(__FILE__),"..","data")
|
@@ -11,18 +11,18 @@ context "ONIX::SalesRestriction" do
|
|
11
11
|
@root = @doc.root
|
12
12
|
end
|
13
13
|
|
14
|
-
|
14
|
+
it "should correctly convert to a string" do
|
15
15
|
sr = ONIX::SalesRestriction.from_xml(@root.to_s)
|
16
16
|
sr.to_xml.to_s[0,18].should eql("<SalesRestriction>")
|
17
17
|
end
|
18
18
|
|
19
|
-
|
19
|
+
it "should provide read access to first level attributes" do
|
20
20
|
sr = ONIX::SalesRestriction.from_xml(@root.to_s)
|
21
21
|
|
22
22
|
sr.sales_restriction_type.should eql(0)
|
23
23
|
end
|
24
24
|
|
25
|
-
|
25
|
+
it "should provide write access to first level attributes" do
|
26
26
|
sr = ONIX::SalesRestriction.new
|
27
27
|
|
28
28
|
sr.sales_restriction_type = 1
|
@@ -30,4 +30,3 @@ context "ONIX::SalesRestriction" do
|
|
30
30
|
end
|
31
31
|
|
32
32
|
end
|
33
|
-
|
data/spec/sender_identifier.rb
CHANGED
@@ -2,7 +2,7 @@
|
|
2
2
|
|
3
3
|
require File.dirname(__FILE__) + '/spec_helper.rb'
|
4
4
|
|
5
|
-
|
5
|
+
describe ONIX::SenderIdentifier do
|
6
6
|
|
7
7
|
before(:each) do
|
8
8
|
data_path = File.join(File.dirname(__FILE__),"..","data")
|
@@ -11,19 +11,19 @@ context "ONIX::SenderIdentifier" do
|
|
11
11
|
@root = @doc.root
|
12
12
|
end
|
13
13
|
|
14
|
-
|
14
|
+
it "should correctly convert to a string" do
|
15
15
|
id = ONIX::SenderIdentifier.from_xml(@root.to_s)
|
16
16
|
id.to_xml.to_s[0,18].should eql("<SenderIdentifier>")
|
17
17
|
end
|
18
18
|
|
19
|
-
|
19
|
+
it "should provide read access to first level attributes" do
|
20
20
|
id = ONIX::SenderIdentifier.from_xml(@root.to_s)
|
21
21
|
|
22
22
|
id.sender_id_type.should eql(1)
|
23
23
|
id.id_value.should eql("123456")
|
24
24
|
end
|
25
25
|
|
26
|
-
|
26
|
+
it "should provide write access to first level attributes" do
|
27
27
|
id = ONIX::SenderIdentifier.new
|
28
28
|
|
29
29
|
id.sender_id_type = 1
|
@@ -2,7 +2,7 @@
|
|
2
2
|
|
3
3
|
require File.dirname(__FILE__) + '/spec_helper.rb'
|
4
4
|
|
5
|
-
|
5
|
+
describe ONIX::SeriesIdentifier do
|
6
6
|
|
7
7
|
before(:each) do
|
8
8
|
data_path = File.join(File.dirname(__FILE__),"..","data")
|
@@ -11,19 +11,19 @@ context "ONIX::SeriesIdentifier" do
|
|
11
11
|
@root = @doc.root
|
12
12
|
end
|
13
13
|
|
14
|
-
|
14
|
+
it "should correctly convert to a string" do
|
15
15
|
series = ONIX::SeriesIdentifier.from_xml(@root.to_s)
|
16
16
|
series.to_xml.to_s[0,18].should eql("<SeriesIdentifier>")
|
17
17
|
end
|
18
18
|
|
19
|
-
|
19
|
+
it "should provide read access to first level attributes" do
|
20
20
|
series = ONIX::SeriesIdentifier.from_xml(@root.to_s)
|
21
21
|
|
22
22
|
series.series_id_type.should eql(1)
|
23
23
|
series.id_value.should eql("10001")
|
24
24
|
end
|
25
25
|
|
26
|
-
|
26
|
+
it "should provide write access to first level attributes" do
|
27
27
|
series = ONIX::SeriesIdentifier.new
|
28
28
|
|
29
29
|
series.series_id_type = 9
|
data/spec/series_spec.rb
CHANGED
@@ -2,7 +2,7 @@
|
|
2
2
|
|
3
3
|
require File.dirname(__FILE__) + '/spec_helper.rb'
|
4
4
|
|
5
|
-
|
5
|
+
describe ONIX::Series do
|
6
6
|
|
7
7
|
before(:each) do
|
8
8
|
data_path = File.join(File.dirname(__FILE__),"..","data")
|
@@ -11,18 +11,18 @@ context "ONIX::Series" do
|
|
11
11
|
@root = @doc.root
|
12
12
|
end
|
13
13
|
|
14
|
-
|
14
|
+
it "should correctly convert to a string" do
|
15
15
|
series = ONIX::Series.from_xml(@root.to_s)
|
16
16
|
series.to_xml.to_s[0,8].should eql("<Series>")
|
17
17
|
end
|
18
18
|
|
19
|
-
|
19
|
+
it "should provide read access to first level attributes" do
|
20
20
|
series = ONIX::Series.from_xml(@root.to_s)
|
21
21
|
|
22
22
|
series.title_of_series.should eql("Citizens and Their Governments")
|
23
23
|
end
|
24
24
|
|
25
|
-
|
25
|
+
it "should provide write access to first level attributes" do
|
26
26
|
series = ONIX::Series.new
|
27
27
|
|
28
28
|
series.title_of_series = "Cool Science Careers"
|
data/spec/spec_helper.rb
CHANGED
data/spec/stock_spec.rb
CHANGED
@@ -2,7 +2,7 @@
|
|
2
2
|
|
3
3
|
require File.dirname(__FILE__) + '/spec_helper.rb'
|
4
4
|
|
5
|
-
|
5
|
+
describe ONIX::Stock do
|
6
6
|
|
7
7
|
before(:each) do
|
8
8
|
data_path = File.join(File.dirname(__FILE__),"..","data")
|
@@ -11,12 +11,12 @@ context "ONIX::Stock" do
|
|
11
11
|
@root = @doc.root
|
12
12
|
end
|
13
13
|
|
14
|
-
|
14
|
+
it "should correctly convert to a string" do
|
15
15
|
s = ONIX::Stock.from_xml(@root.to_s)
|
16
16
|
s.to_xml.to_s[0,7].should eql("<Stock>")
|
17
17
|
end
|
18
18
|
|
19
|
-
|
19
|
+
it "should provide read access to first level attributes" do
|
20
20
|
s = ONIX::Stock.from_xml(@root.to_s)
|
21
21
|
|
22
22
|
# note that these fields *should* be numeric according to the ONIX spec,
|
@@ -25,7 +25,7 @@ context "ONIX::Stock" do
|
|
25
25
|
s.on_order.should eql("0")
|
26
26
|
end
|
27
27
|
|
28
|
-
|
28
|
+
it "should provide write access to first level attributes" do
|
29
29
|
s = ONIX::Stock.new
|
30
30
|
|
31
31
|
s.on_hand = "123"
|
data/spec/subject_spec.rb
CHANGED
@@ -2,7 +2,7 @@
|
|
2
2
|
|
3
3
|
require File.dirname(__FILE__) + '/spec_helper.rb'
|
4
4
|
|
5
|
-
|
5
|
+
describe ONIX::Subject do
|
6
6
|
|
7
7
|
before(:each) do
|
8
8
|
data_path = File.join(File.dirname(__FILE__),"..","data")
|
@@ -11,19 +11,19 @@ context "ONIX::Subject" do
|
|
11
11
|
@root = @doc.root
|
12
12
|
end
|
13
13
|
|
14
|
-
|
14
|
+
it "should correctly convert to a string" do
|
15
15
|
sub = ONIX::Subject.from_xml(@root.to_s)
|
16
16
|
sub.to_xml.to_s[0,9].should eql("<Subject>")
|
17
17
|
end
|
18
18
|
|
19
|
-
|
19
|
+
it "should provide read access to first level attributes" do
|
20
20
|
sub = ONIX::Subject.from_xml(@root.to_s)
|
21
21
|
sub.subject_scheme_id.should eql(3)
|
22
22
|
sub.subject_scheme_name.should eql("RBA Subjects")
|
23
23
|
sub.subject_code.should eql("AABB")
|
24
24
|
end
|
25
25
|
|
26
|
-
|
26
|
+
it "should provide write access to first level attributes" do
|
27
27
|
sub = ONIX::Subject.new
|
28
28
|
|
29
29
|
sub.subject_scheme_id = 2
|
@@ -35,4 +35,3 @@ context "ONIX::Subject" do
|
|
35
35
|
end
|
36
36
|
|
37
37
|
end
|
38
|
-
|
data/spec/supply_detail_spec.rb
CHANGED
@@ -2,7 +2,7 @@
|
|
2
2
|
|
3
3
|
require File.dirname(__FILE__) + '/spec_helper.rb'
|
4
4
|
|
5
|
-
|
5
|
+
describe ONIX::SupplyDetail do
|
6
6
|
|
7
7
|
before(:each) do
|
8
8
|
data_path = File.join(File.dirname(__FILE__),"..","data")
|
@@ -11,12 +11,12 @@ context "ONIX::SupplyDetail" do
|
|
11
11
|
@root = @doc.root
|
12
12
|
end
|
13
13
|
|
14
|
-
|
14
|
+
it "should correctly convert to a string" do
|
15
15
|
sd = ONIX::SupplyDetail.from_xml(@root.to_s)
|
16
16
|
sd.to_xml.to_s[0,14].should eql("<SupplyDetail>")
|
17
17
|
end
|
18
18
|
|
19
|
-
|
19
|
+
it "should provide read access to first level attributes" do
|
20
20
|
sd = ONIX::SupplyDetail.from_xml(@root.to_s)
|
21
21
|
|
22
22
|
sd.supplier_name.should eql("Rainbow Book Agencies")
|
@@ -28,7 +28,7 @@ context "ONIX::SupplyDetail" do
|
|
28
28
|
sd.prices.size.should eql(1)
|
29
29
|
end
|
30
30
|
|
31
|
-
|
31
|
+
it "should provide write access to first level attributes" do
|
32
32
|
sd = ONIX::SupplyDetail.new
|
33
33
|
|
34
34
|
sd.supplier_name = "RBA"
|
data/spec/title_spec.rb
CHANGED
@@ -2,7 +2,7 @@
|
|
2
2
|
|
3
3
|
require File.dirname(__FILE__) + '/spec_helper.rb'
|
4
4
|
|
5
|
-
|
5
|
+
describe ONIX::Title do
|
6
6
|
|
7
7
|
before(:each) do
|
8
8
|
data_path = File.join(File.dirname(__FILE__),"..","data")
|
@@ -11,19 +11,19 @@ context "ONIX::Title" do
|
|
11
11
|
@root = @doc.root
|
12
12
|
end
|
13
13
|
|
14
|
-
|
14
|
+
it "should correctly convert to a string" do
|
15
15
|
t = ONIX::Title.from_xml(@root.to_s)
|
16
16
|
t.to_xml.to_s[0,7].should eql("<Title>")
|
17
17
|
end
|
18
18
|
|
19
|
-
|
19
|
+
it "should provide read access to first level attributes" do
|
20
20
|
t = ONIX::Title.from_xml(@root.to_s)
|
21
21
|
t.title_type.should eql(1)
|
22
22
|
t.title_text.should eql("Good Grief")
|
23
23
|
t.subtitle.should eql("A Constructive Approach to the Problem of Loss")
|
24
24
|
end
|
25
25
|
|
26
|
-
|
26
|
+
it "should provide write access to first level attributes" do
|
27
27
|
t = ONIX::Title.new
|
28
28
|
|
29
29
|
t.title_type = 1
|