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.
Files changed (192) hide show
  1. data/CHANGELOG +21 -0
  2. data/README.markdown +1 -0
  3. data/lib/onix.rb +4 -17
  4. data/lib/onix/code_list_extractor.rb +69 -0
  5. data/lib/onix/lists.rb +134 -0
  6. data/lib/onix/product.rb +14 -0
  7. data/lib/onix/sl_product.rb +24 -1
  8. data/lib/onix/version.rb +3 -0
  9. data/lib/onix/work_identifier.rb +28 -0
  10. data/spec/apa_product_spec.rb +9 -9
  11. data/spec/audience_range_spec.rb +4 -4
  12. data/spec/contributor_spec.rb +4 -4
  13. data/spec/header_spec.rb +7 -7
  14. data/spec/imprint_spec.rb +4 -4
  15. data/spec/language_spec.rb +4 -4
  16. data/spec/lists_spec.rb +33 -0
  17. data/spec/market_representation_spec.rb +4 -6
  18. data/spec/measure_spec.rb +4 -4
  19. data/spec/media_file_spec.rb +4 -4
  20. data/spec/normaliser_spec.rb +28 -4
  21. data/spec/other_text_spec.rb +4 -4
  22. data/spec/price_spec.rb +4 -4
  23. data/spec/product_identifier_spec.rb +4 -4
  24. data/spec/product_spec.rb +8 -8
  25. data/spec/publisher_spec.rb +4 -4
  26. data/spec/reader_spec.rb +11 -11
  27. data/spec/sales_restriction_spec.rb +4 -5
  28. data/spec/sender_identifier.rb +4 -4
  29. data/spec/series_identifier_spec.rb +4 -4
  30. data/spec/series_spec.rb +4 -4
  31. data/spec/spec_helper.rb +4 -1
  32. data/spec/stock_spec.rb +4 -4
  33. data/spec/subject_spec.rb +4 -5
  34. data/spec/supply_detail_spec.rb +4 -4
  35. data/spec/title_spec.rb +4 -4
  36. data/spec/website_spec.rb +4 -4
  37. data/spec/work_identifier_spec.rb +39 -0
  38. data/spec/writer_spec.rb +7 -7
  39. data/support/codes/001.tsv +10 -0
  40. data/support/codes/002.tsv +5 -0
  41. data/support/codes/003.tsv +7 -0
  42. data/support/codes/005.tsv +13 -0
  43. data/support/codes/006.tsv +76 -0
  44. data/support/codes/007.tsv +123 -0
  45. data/support/codes/008.tsv +7 -0
  46. data/support/codes/009.tsv +7 -0
  47. data/support/codes/010.tsv +34 -0
  48. data/support/codes/011.tsv +11 -0
  49. data/support/codes/012.tsv +11 -0
  50. data/support/codes/013.tsv +7 -0
  51. data/support/codes/014.tsv +4 -0
  52. data/support/codes/015.tsv +13 -0
  53. data/support/codes/016.tsv +6 -0
  54. data/support/codes/017.tsv +90 -0
  55. data/support/codes/018.tsv +3 -0
  56. data/support/codes/019.tsv +7 -0
  57. data/support/codes/020.tsv +0 -0
  58. data/support/codes/021.tsv +31 -0
  59. data/support/codes/022.tsv +9 -0
  60. data/support/codes/023.tsv +9 -0
  61. data/support/codes/024.tsv +11 -0
  62. data/support/codes/025.tsv +29 -0
  63. data/support/codes/026.tsv +75 -0
  64. data/support/codes/027.tsv +75 -0
  65. data/support/codes/028.tsv +8 -0
  66. data/support/codes/029.tsv +16 -0
  67. data/support/codes/030.tsv +15 -0
  68. data/support/codes/031.tsv +3 -0
  69. data/support/codes/032.tsv +2 -0
  70. data/support/codes/033.tsv +36 -0
  71. data/support/codes/034.tsv +14 -0
  72. data/support/codes/035.tsv +6 -0
  73. data/support/codes/036.tsv +3 -0
  74. data/support/codes/037.tsv +6 -0
  75. data/support/codes/038.tsv +36 -0
  76. data/support/codes/039.tsv +8 -0
  77. data/support/codes/040.tsv +6 -0
  78. data/support/codes/041.tsv +6 -0
  79. data/support/codes/042.tsv +16 -0
  80. data/support/codes/043.tsv +4 -0
  81. data/support/codes/044.tsv +13 -0
  82. data/support/codes/045.tsv +12 -0
  83. data/support/codes/046.tsv +3 -0
  84. data/support/codes/047.tsv +4 -0
  85. data/support/codes/048.tsv +11 -0
  86. data/support/codes/049.tsv +84 -0
  87. data/support/codes/050.tsv +8 -0
  88. data/support/codes/051.tsv +27 -0
  89. data/support/codes/052.tsv +1 -0
  90. data/support/codes/053.tsv +3 -0
  91. data/support/codes/054.tsv +23 -0
  92. data/support/codes/055.tsv +13 -0
  93. data/support/codes/056.tsv +2 -0
  94. data/support/codes/057.tsv +5 -0
  95. data/support/codes/058.tsv +21 -0
  96. data/support/codes/059.tsv +4 -0
  97. data/support/codes/060.tsv +2 -0
  98. data/support/codes/061.tsv +3 -0
  99. data/support/codes/062.tsv +5 -0
  100. data/support/codes/063.tsv +0 -0
  101. data/support/codes/064.tsv +13 -0
  102. data/support/codes/065.tsv +25 -0
  103. data/support/codes/066.tsv +4 -0
  104. data/support/codes/067.tsv +2 -0
  105. data/support/codes/068.tsv +15 -0
  106. data/support/codes/069.tsv +4 -0
  107. data/support/codes/070.tsv +2 -0
  108. data/support/codes/071.tsv +9 -0
  109. data/support/codes/072.tsv +7 -0
  110. data/support/codes/073.tsv +36 -0
  111. data/support/codes/074.tsv +489 -0
  112. data/support/codes/075.tsv +2 -0
  113. data/support/codes/076.tsv +12 -0
  114. data/support/codes/077.tsv +19 -0
  115. data/support/codes/078.tsv +148 -0
  116. data/support/codes/079.tsv +17 -0
  117. data/support/codes/080.tsv +19 -0
  118. data/support/codes/081.tsv +11 -0
  119. data/support/codes/082.tsv +17 -0
  120. data/support/codes/083.tsv +68 -0
  121. data/support/codes/084.tsv +10 -0
  122. data/support/codes/085.tsv +23 -0
  123. data/support/codes/086.tsv +5 -0
  124. data/support/codes/087.tsv +6 -0
  125. data/support/codes/088.tsv +0 -0
  126. data/support/codes/089.tsv +1 -0
  127. data/support/codes/090.tsv +11 -0
  128. data/support/codes/091.tsv +248 -0
  129. data/support/codes/092.tsv +7 -0
  130. data/support/codes/093.tsv +13 -0
  131. data/support/codes/094.tsv +3 -0
  132. data/support/codes/095.tsv +3 -0
  133. data/support/codes/096.tsv +185 -0
  134. data/support/codes/097.tsv +1 -0
  135. data/support/codes/098.tsv +21 -0
  136. data/support/codes/099.tsv +24 -0
  137. data/support/codes/100.tsv +4 -0
  138. data/support/codes/101.tsv +2 -0
  139. data/support/codes/102.tsv +3 -0
  140. data/support/codes/121.tsv +127 -0
  141. data/support/codes/138.tsv +6 -0
  142. data/support/codes/139.tsv +70 -0
  143. data/support/codes/140.tsv +7 -0
  144. data/support/codes/141.tsv +10 -0
  145. data/support/codes/142.tsv +12 -0
  146. data/support/codes/143.tsv +7 -0
  147. data/support/codes/144.tsv +4 -0
  148. data/support/codes/145.tsv +5 -0
  149. data/support/codes/146.tsv +3 -0
  150. data/support/codes/147.tsv +7 -0
  151. data/support/codes/148.tsv +3 -0
  152. data/support/codes/149.tsv +4 -0
  153. data/support/codes/150.tsv +124 -0
  154. data/support/codes/151.tsv +7 -0
  155. data/support/codes/152.tsv +2 -0
  156. data/support/codes/153.tsv +14 -0
  157. data/support/codes/154.tsv +9 -0
  158. data/support/codes/155.tsv +5 -0
  159. data/support/codes/156.tsv +4 -0
  160. data/support/codes/157.tsv +4 -0
  161. data/support/codes/158.tsv +24 -0
  162. data/support/codes/159.tsv +6 -0
  163. data/support/codes/160.tsv +0 -0
  164. data/support/codes/161.tsv +3 -0
  165. data/support/codes/162.tsv +3 -0
  166. data/support/codes/163.tsv +7 -0
  167. data/support/codes/164.tsv +2 -0
  168. data/support/codes/165.tsv +2 -0
  169. data/support/codes/166.tsv +2 -0
  170. data/support/codes/167.tsv +3 -0
  171. data/support/codes/168.tsv +2 -0
  172. data/support/codes/169.tsv +3 -0
  173. data/support/codes/170.tsv +0 -0
  174. data/support/codes/171.tsv +2 -0
  175. data/support/codes/172.tsv +1 -0
  176. data/support/codes/173.tsv +2 -0
  177. data/support/codes/174.tsv +2 -0
  178. data/support/codes/175.tsv +175 -0
  179. data/support/codes/176.tsv +12 -0
  180. data/support/codes/177.tsv +2 -0
  181. data/support/codes/178.tsv +17 -0
  182. data/support/switch-onix-2.1-short-to-reference.xsl +3 -2
  183. metadata +226 -38
  184. data/lib/onix/lists/audience_code.rb +0 -17
  185. data/lib/onix/lists/contributor_role.rb +0 -99
  186. data/lib/onix/lists/country_code.rb +0 -257
  187. data/lib/onix/lists/language_code.rb +0 -498
  188. data/lib/onix/lists/language_role.rb +0 -18
  189. data/lib/onix/lists/notification_type.rb +0 -19
  190. data/lib/onix/lists/product_availability.rb +0 -32
  191. data/lib/onix/lists/product_form.rb +0 -99
  192. 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
- context "ONIX::Product" do
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
- specify "should provide read access to first level attributes" do
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
- specify "should provide read access to product IDs" do
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
- specify "should provide read access to titles" do
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
- specify "should provide read access to subjects" do
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
- specify "should provide read access to measurements" do
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
- specify "should provide write access to first level attributes" do
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
- specify "should correctly from_xml files that have an invalid publication date" do
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
 
@@ -2,7 +2,7 @@
2
2
 
3
3
  require File.dirname(__FILE__) + '/spec_helper.rb'
4
4
 
5
- context "ONIX::Publisher" do
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
- specify "should correctly convert to a string" do
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
- specify "should provide read access to first level attributes" do
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
- specify "should provide write access to first level attributes" do
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
- context "ONIX::Reader" do
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
- specify "should initialize with a filename" do
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
- specify "should initialize with an IO object" do
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
- specify "should provide access to various XML metadata from file" do
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
- specify "should provide access to the header in an ONIX file" do
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
- specify "should iterate over all product records in an ONIX file" do
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
- specify "should iterate over all product records in an ONIX file" do
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 (&amp; &lt; 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
- specify "should correctly parse a file that has an entity in it" do
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
- specify "should correctly parse a file with more than 7 records in in" do
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
- specify "should transparently convert a iso-8859-1 file to utf-8" do
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
- specify "should transparently convert a utf-16 file to utf-8" do
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
- context "ONIX::SalesRestriction" do
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
- specify "should correctly convert to a string" do
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
- specify "should provide read access to first level attributes" do
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
- specify "should provide write access to first level attributes" do
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
-
@@ -2,7 +2,7 @@
2
2
 
3
3
  require File.dirname(__FILE__) + '/spec_helper.rb'
4
4
 
5
- context "ONIX::SenderIdentifier" do
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
- specify "should correctly convert to a string" do
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
- specify "should provide read access to first level attributes" do
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
- specify "should provide write access to first level attributes" do
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
- context "ONIX::SeriesIdentifier" do
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
- specify "should correctly convert to a string" do
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
- specify "should provide read access to first level attributes" do
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
- specify "should provide write access to first level attributes" do
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
- context "ONIX::Series" do
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
- specify "should correctly convert to a string" do
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
- specify "should provide read access to first level attributes" do
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
- specify "should provide write access to first level attributes" do
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
@@ -1,7 +1,10 @@
1
1
  # coding: utf-8
2
2
 
3
+ require "rubygems"
4
+ require "bundler"
5
+ Bundler.setup
6
+
3
7
  require 'date'
4
8
  require 'stringio'
5
9
  require 'rubygems'
6
- $LOAD_PATH.unshift(File.dirname(__FILE__) + '/../lib')
7
10
  require 'onix'
data/spec/stock_spec.rb CHANGED
@@ -2,7 +2,7 @@
2
2
 
3
3
  require File.dirname(__FILE__) + '/spec_helper.rb'
4
4
 
5
- context "ONIX::Stock" do
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
- specify "should correctly convert to a string" do
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
- specify "should provide read access to first level attributes" do
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
- specify "should provide write access to first level attributes" do
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
- context "ONIX::Subject" do
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
- specify "should correctly convert to a string" do
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
- specify "should provide read access to first level attributes" do
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
- specify "should provide write access to first level attributes" do
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
-
@@ -2,7 +2,7 @@
2
2
 
3
3
  require File.dirname(__FILE__) + '/spec_helper.rb'
4
4
 
5
- context "ONIX::SupplyDetail" do
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
- specify "should correctly convert to a string" do
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
- specify "should provide read access to first level attributes" do
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
- specify "should provide write access to first level attributes" do
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
- context "ONIX::Title" do
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
- specify "should correctly convert to a string" do
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
- specify "should provide read access to first level attributes" do
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
- specify "should provide write access to first level attributes" do
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