bonio-axlsx 2.2.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (325) hide show
  1. checksums.yaml +7 -0
  2. data/.yardopts +9 -0
  3. data/.yardopts_guide +19 -0
  4. data/CHANGELOG.md +239 -0
  5. data/LICENSE +22 -0
  6. data/README.md +258 -0
  7. data/Rakefile +30 -0
  8. data/examples/2010_comments.rb +17 -0
  9. data/examples/anchor_swapping.rb +28 -0
  10. data/examples/auto_filter.rb +25 -0
  11. data/examples/basic_charts.rb +58 -0
  12. data/examples/chart_colors.rb +88 -0
  13. data/examples/colored_links.rb +59 -0
  14. data/examples/conditional_formatting/example_conditional_formatting.rb +89 -0
  15. data/examples/conditional_formatting/getting_barred.rb +37 -0
  16. data/examples/conditional_formatting/hitting_the_high_notes.rb +37 -0
  17. data/examples/conditional_formatting/scaled_colors.rb +39 -0
  18. data/examples/conditional_formatting/stop_and_go.rb +37 -0
  19. data/examples/data_validation.rb +50 -0
  20. data/examples/example.rb +875 -0
  21. data/examples/extractive.rb +45 -0
  22. data/examples/image1.jpeg +0 -0
  23. data/examples/ios_preview.rb +14 -0
  24. data/examples/merge_cells.rb +17 -0
  25. data/examples/no_grid_with_borders.rb +18 -0
  26. data/examples/page_setup.rb +11 -0
  27. data/examples/pivot_table.rb +39 -0
  28. data/examples/pivot_test.rb +63 -0
  29. data/examples/sheet_protection.rb +10 -0
  30. data/examples/skydrive/real_example.rb +63 -0
  31. data/examples/split.rb +16 -0
  32. data/examples/styles.rb +66 -0
  33. data/examples/underline.rb +13 -0
  34. data/examples/wrap_text.rb +21 -0
  35. data/lib/axlsx.rb +168 -0
  36. data/lib/axlsx/content_type/abstract_content_type.rb +32 -0
  37. data/lib/axlsx/content_type/content_type.rb +26 -0
  38. data/lib/axlsx/content_type/default.rb +25 -0
  39. data/lib/axlsx/content_type/override.rb +25 -0
  40. data/lib/axlsx/doc_props/app.rb +235 -0
  41. data/lib/axlsx/doc_props/core.rb +39 -0
  42. data/lib/axlsx/drawing/ax_data_source.rb +26 -0
  43. data/lib/axlsx/drawing/axes.rb +61 -0
  44. data/lib/axlsx/drawing/axis.rb +190 -0
  45. data/lib/axlsx/drawing/bar_3D_chart.rb +151 -0
  46. data/lib/axlsx/drawing/bar_series.rb +82 -0
  47. data/lib/axlsx/drawing/bubble_chart.rb +59 -0
  48. data/lib/axlsx/drawing/bubble_series.rb +63 -0
  49. data/lib/axlsx/drawing/cat_axis.rb +85 -0
  50. data/lib/axlsx/drawing/chart.rb +274 -0
  51. data/lib/axlsx/drawing/d_lbls.rb +90 -0
  52. data/lib/axlsx/drawing/drawing.rb +164 -0
  53. data/lib/axlsx/drawing/graphic_frame.rb +54 -0
  54. data/lib/axlsx/drawing/hyperlink.rb +100 -0
  55. data/lib/axlsx/drawing/line_3D_chart.rb +68 -0
  56. data/lib/axlsx/drawing/line_chart.rb +99 -0
  57. data/lib/axlsx/drawing/line_series.rb +110 -0
  58. data/lib/axlsx/drawing/marker.rb +84 -0
  59. data/lib/axlsx/drawing/num_data.rb +52 -0
  60. data/lib/axlsx/drawing/num_data_source.rb +62 -0
  61. data/lib/axlsx/drawing/num_val.rb +34 -0
  62. data/lib/axlsx/drawing/one_cell_anchor.rb +98 -0
  63. data/lib/axlsx/drawing/pic.rb +213 -0
  64. data/lib/axlsx/drawing/picture_locking.rb +42 -0
  65. data/lib/axlsx/drawing/pie_3D_chart.rb +47 -0
  66. data/lib/axlsx/drawing/pie_series.rb +74 -0
  67. data/lib/axlsx/drawing/scaling.rb +60 -0
  68. data/lib/axlsx/drawing/scatter_chart.rb +74 -0
  69. data/lib/axlsx/drawing/scatter_series.rb +98 -0
  70. data/lib/axlsx/drawing/ser_axis.rb +45 -0
  71. data/lib/axlsx/drawing/series.rb +69 -0
  72. data/lib/axlsx/drawing/series_title.rb +23 -0
  73. data/lib/axlsx/drawing/str_data.rb +42 -0
  74. data/lib/axlsx/drawing/str_val.rb +34 -0
  75. data/lib/axlsx/drawing/title.rb +96 -0
  76. data/lib/axlsx/drawing/two_cell_anchor.rb +92 -0
  77. data/lib/axlsx/drawing/val_axis.rb +37 -0
  78. data/lib/axlsx/drawing/view_3D.rb +115 -0
  79. data/lib/axlsx/drawing/vml_drawing.rb +42 -0
  80. data/lib/axlsx/drawing/vml_shape.rb +66 -0
  81. data/lib/axlsx/package.rb +363 -0
  82. data/lib/axlsx/rels/relationship.rb +129 -0
  83. data/lib/axlsx/rels/relationships.rb +29 -0
  84. data/lib/axlsx/stylesheet/border.rb +71 -0
  85. data/lib/axlsx/stylesheet/border_pr.rb +71 -0
  86. data/lib/axlsx/stylesheet/cell_alignment.rb +132 -0
  87. data/lib/axlsx/stylesheet/cell_protection.rb +41 -0
  88. data/lib/axlsx/stylesheet/cell_style.rb +72 -0
  89. data/lib/axlsx/stylesheet/color.rb +76 -0
  90. data/lib/axlsx/stylesheet/dxf.rb +79 -0
  91. data/lib/axlsx/stylesheet/fill.rb +35 -0
  92. data/lib/axlsx/stylesheet/font.rb +148 -0
  93. data/lib/axlsx/stylesheet/gradient_fill.rb +103 -0
  94. data/lib/axlsx/stylesheet/gradient_stop.rb +37 -0
  95. data/lib/axlsx/stylesheet/num_fmt.rb +86 -0
  96. data/lib/axlsx/stylesheet/pattern_fill.rb +73 -0
  97. data/lib/axlsx/stylesheet/styles.rb +420 -0
  98. data/lib/axlsx/stylesheet/table_style.rb +54 -0
  99. data/lib/axlsx/stylesheet/table_style_element.rb +77 -0
  100. data/lib/axlsx/stylesheet/table_styles.rb +46 -0
  101. data/lib/axlsx/stylesheet/xf.rb +147 -0
  102. data/lib/axlsx/util/accessors.rb +64 -0
  103. data/lib/axlsx/util/constants.rb +397 -0
  104. data/lib/axlsx/util/mime_type_utils.rb +11 -0
  105. data/lib/axlsx/util/options_parser.rb +16 -0
  106. data/lib/axlsx/util/parser.rb +44 -0
  107. data/lib/axlsx/util/serialized_attributes.rb +89 -0
  108. data/lib/axlsx/util/simple_typed_list.rb +179 -0
  109. data/lib/axlsx/util/storage.rb +146 -0
  110. data/lib/axlsx/util/string.rb +7 -0
  111. data/lib/axlsx/util/validators.rb +311 -0
  112. data/lib/axlsx/version.rb +5 -0
  113. data/lib/axlsx/workbook/defined_name.rb +128 -0
  114. data/lib/axlsx/workbook/defined_names.rb +21 -0
  115. data/lib/axlsx/workbook/shared_strings_table.rb +77 -0
  116. data/lib/axlsx/workbook/workbook.rb +375 -0
  117. data/lib/axlsx/workbook/workbook_view.rb +78 -0
  118. data/lib/axlsx/workbook/workbook_views.rb +22 -0
  119. data/lib/axlsx/workbook/worksheet/auto_filter/auto_filter.rb +77 -0
  120. data/lib/axlsx/workbook/worksheet/auto_filter/filter_column.rb +94 -0
  121. data/lib/axlsx/workbook/worksheet/auto_filter/filters.rb +244 -0
  122. data/lib/axlsx/workbook/worksheet/break.rb +35 -0
  123. data/lib/axlsx/workbook/worksheet/cell.rb +475 -0
  124. data/lib/axlsx/workbook/worksheet/cell_serializer.rb +166 -0
  125. data/lib/axlsx/workbook/worksheet/cfvo.rb +60 -0
  126. data/lib/axlsx/workbook/worksheet/cfvos.rb +15 -0
  127. data/lib/axlsx/workbook/worksheet/col.rb +141 -0
  128. data/lib/axlsx/workbook/worksheet/col_breaks.rb +35 -0
  129. data/lib/axlsx/workbook/worksheet/color_scale.rb +110 -0
  130. data/lib/axlsx/workbook/worksheet/cols.rb +20 -0
  131. data/lib/axlsx/workbook/worksheet/comment.rb +91 -0
  132. data/lib/axlsx/workbook/worksheet/comments.rb +82 -0
  133. data/lib/axlsx/workbook/worksheet/conditional_formatting.rb +82 -0
  134. data/lib/axlsx/workbook/worksheet/conditional_formatting_rule.rb +220 -0
  135. data/lib/axlsx/workbook/worksheet/conditional_formattings.rb +25 -0
  136. data/lib/axlsx/workbook/worksheet/data_bar.rb +129 -0
  137. data/lib/axlsx/workbook/worksheet/data_validation.rb +246 -0
  138. data/lib/axlsx/workbook/worksheet/data_validations.rb +28 -0
  139. data/lib/axlsx/workbook/worksheet/date_time_converter.rb +30 -0
  140. data/lib/axlsx/workbook/worksheet/dimension.rb +64 -0
  141. data/lib/axlsx/workbook/worksheet/header_footer.rb +52 -0
  142. data/lib/axlsx/workbook/worksheet/icon_set.rb +81 -0
  143. data/lib/axlsx/workbook/worksheet/merged_cells.rb +37 -0
  144. data/lib/axlsx/workbook/worksheet/outline_pr.rb +33 -0
  145. data/lib/axlsx/workbook/worksheet/page_margins.rb +97 -0
  146. data/lib/axlsx/workbook/worksheet/page_set_up_pr.rb +44 -0
  147. data/lib/axlsx/workbook/worksheet/page_setup.rb +240 -0
  148. data/lib/axlsx/workbook/worksheet/pane.rb +139 -0
  149. data/lib/axlsx/workbook/worksheet/pivot_table.rb +289 -0
  150. data/lib/axlsx/workbook/worksheet/pivot_table_cache_definition.rb +66 -0
  151. data/lib/axlsx/workbook/worksheet/pivot_tables.rb +24 -0
  152. data/lib/axlsx/workbook/worksheet/print_options.rb +39 -0
  153. data/lib/axlsx/workbook/worksheet/protected_range.rb +47 -0
  154. data/lib/axlsx/workbook/worksheet/protected_ranges.rb +34 -0
  155. data/lib/axlsx/workbook/worksheet/rich_text.rb +35 -0
  156. data/lib/axlsx/workbook/worksheet/rich_text_run.rb +254 -0
  157. data/lib/axlsx/workbook/worksheet/row.rb +161 -0
  158. data/lib/axlsx/workbook/worksheet/row_breaks.rb +33 -0
  159. data/lib/axlsx/workbook/worksheet/selection.rb +101 -0
  160. data/lib/axlsx/workbook/worksheet/sheet_calc_pr.rb +29 -0
  161. data/lib/axlsx/workbook/worksheet/sheet_data.rb +27 -0
  162. data/lib/axlsx/workbook/worksheet/sheet_format_pr.rb +60 -0
  163. data/lib/axlsx/workbook/worksheet/sheet_pr.rb +87 -0
  164. data/lib/axlsx/workbook/worksheet/sheet_protection.rb +118 -0
  165. data/lib/axlsx/workbook/worksheet/sheet_view.rb +213 -0
  166. data/lib/axlsx/workbook/worksheet/table.rb +102 -0
  167. data/lib/axlsx/workbook/worksheet/table_style_info.rb +49 -0
  168. data/lib/axlsx/workbook/worksheet/tables.rb +31 -0
  169. data/lib/axlsx/workbook/worksheet/worksheet.rb +799 -0
  170. data/lib/axlsx/workbook/worksheet/worksheet_comments.rb +58 -0
  171. data/lib/axlsx/workbook/worksheet/worksheet_drawing.rb +58 -0
  172. data/lib/axlsx/workbook/worksheet/worksheet_hyperlink.rb +74 -0
  173. data/lib/axlsx/workbook/worksheet/worksheet_hyperlinks.rb +38 -0
  174. data/lib/schema/dc.xsd +118 -0
  175. data/lib/schema/dcmitype.xsd +52 -0
  176. data/lib/schema/dcterms.xsd +331 -0
  177. data/lib/schema/dml-chart.xsd +1499 -0
  178. data/lib/schema/dml-chartDrawing.xsd +146 -0
  179. data/lib/schema/dml-compatibility.xsd +14 -0
  180. data/lib/schema/dml-diagram.xsd +1091 -0
  181. data/lib/schema/dml-lockedCanvas.xsd +11 -0
  182. data/lib/schema/dml-main.xsd +3048 -0
  183. data/lib/schema/dml-picture.xsd +23 -0
  184. data/lib/schema/dml-spreadsheetDrawing.xsd +185 -0
  185. data/lib/schema/dml-wordprocessingDrawing.xsd +185 -0
  186. data/lib/schema/opc-contentTypes.xsd +42 -0
  187. data/lib/schema/opc-coreProperties.xsd +54 -0
  188. data/lib/schema/opc-digSig.xsd +49 -0
  189. data/lib/schema/opc-relationships.xsd +33 -0
  190. data/lib/schema/pml.xsd +1676 -0
  191. data/lib/schema/shared-additionalCharacteristics.xsd +28 -0
  192. data/lib/schema/shared-bibliography.xsd +144 -0
  193. data/lib/schema/shared-commonSimpleTypes.xsd +166 -0
  194. data/lib/schema/shared-customXmlDataProperties.xsd +25 -0
  195. data/lib/schema/shared-customXmlSchemaProperties.xsd +18 -0
  196. data/lib/schema/shared-documentPropertiesCustom.xsd +59 -0
  197. data/lib/schema/shared-documentPropertiesExtended.xsd +56 -0
  198. data/lib/schema/shared-documentPropertiesVariantTypes.xsd +195 -0
  199. data/lib/schema/shared-math.xsd +582 -0
  200. data/lib/schema/shared-relationshipReference.xsd +25 -0
  201. data/lib/schema/sml.xsd +4434 -0
  202. data/lib/schema/vml-main.xsd +569 -0
  203. data/lib/schema/vml-officeDrawing.xsd +509 -0
  204. data/lib/schema/vml-presentationDrawing.xsd +12 -0
  205. data/lib/schema/vml-spreadsheetDrawing.xsd +108 -0
  206. data/lib/schema/vml-wordprocessingDrawing.xsd +96 -0
  207. data/lib/schema/wml.xsd +3644 -0
  208. data/lib/schema/xml.xsd +116 -0
  209. data/test/benchmark.rb +72 -0
  210. data/test/content_type/tc_content_type.rb +76 -0
  211. data/test/content_type/tc_default.rb +16 -0
  212. data/test/content_type/tc_override.rb +14 -0
  213. data/test/doc_props/tc_app.rb +43 -0
  214. data/test/doc_props/tc_core.rb +42 -0
  215. data/test/drawing/tc_axes.rb +8 -0
  216. data/test/drawing/tc_axis.rb +112 -0
  217. data/test/drawing/tc_bar_3D_chart.rb +71 -0
  218. data/test/drawing/tc_bar_series.rb +37 -0
  219. data/test/drawing/tc_bubble_chart.rb +44 -0
  220. data/test/drawing/tc_bubble_series.rb +21 -0
  221. data/test/drawing/tc_cat_axis.rb +31 -0
  222. data/test/drawing/tc_cat_axis_data.rb +27 -0
  223. data/test/drawing/tc_chart.rb +110 -0
  224. data/test/drawing/tc_d_lbls.rb +57 -0
  225. data/test/drawing/tc_data_source.rb +23 -0
  226. data/test/drawing/tc_drawing.rb +80 -0
  227. data/test/drawing/tc_graphic_frame.rb +27 -0
  228. data/test/drawing/tc_hyperlink.rb +64 -0
  229. data/test/drawing/tc_line_3d_chart.rb +47 -0
  230. data/test/drawing/tc_line_chart.rb +39 -0
  231. data/test/drawing/tc_line_series.rb +71 -0
  232. data/test/drawing/tc_marker.rb +44 -0
  233. data/test/drawing/tc_named_axis_data.rb +27 -0
  234. data/test/drawing/tc_num_data.rb +31 -0
  235. data/test/drawing/tc_num_val.rb +29 -0
  236. data/test/drawing/tc_one_cell_anchor.rb +66 -0
  237. data/test/drawing/tc_pic.rb +106 -0
  238. data/test/drawing/tc_picture_locking.rb +72 -0
  239. data/test/drawing/tc_pie_3D_chart.rb +28 -0
  240. data/test/drawing/tc_pie_series.rb +32 -0
  241. data/test/drawing/tc_scaling.rb +36 -0
  242. data/test/drawing/tc_scatter_chart.rb +48 -0
  243. data/test/drawing/tc_scatter_series.rb +45 -0
  244. data/test/drawing/tc_ser_axis.rb +31 -0
  245. data/test/drawing/tc_series.rb +23 -0
  246. data/test/drawing/tc_series_title.rb +33 -0
  247. data/test/drawing/tc_str_data.rb +18 -0
  248. data/test/drawing/tc_str_val.rb +30 -0
  249. data/test/drawing/tc_title.rb +49 -0
  250. data/test/drawing/tc_two_cell_anchor.rb +36 -0
  251. data/test/drawing/tc_val_axis.rb +24 -0
  252. data/test/drawing/tc_view_3D.rb +54 -0
  253. data/test/drawing/tc_vml_drawing.rb +25 -0
  254. data/test/drawing/tc_vml_shape.rb +106 -0
  255. data/test/profile.rb +24 -0
  256. data/test/rels/tc_relationship.rb +44 -0
  257. data/test/rels/tc_relationships.rb +37 -0
  258. data/test/stylesheet/tc_border.rb +37 -0
  259. data/test/stylesheet/tc_border_pr.rb +32 -0
  260. data/test/stylesheet/tc_cell_alignment.rb +81 -0
  261. data/test/stylesheet/tc_cell_protection.rb +29 -0
  262. data/test/stylesheet/tc_cell_style.rb +57 -0
  263. data/test/stylesheet/tc_color.rb +43 -0
  264. data/test/stylesheet/tc_dxf.rb +81 -0
  265. data/test/stylesheet/tc_fill.rb +18 -0
  266. data/test/stylesheet/tc_font.rb +121 -0
  267. data/test/stylesheet/tc_gradient_fill.rb +72 -0
  268. data/test/stylesheet/tc_gradient_stop.rb +31 -0
  269. data/test/stylesheet/tc_num_fmt.rb +30 -0
  270. data/test/stylesheet/tc_pattern_fill.rb +43 -0
  271. data/test/stylesheet/tc_styles.rb +235 -0
  272. data/test/stylesheet/tc_table_style.rb +44 -0
  273. data/test/stylesheet/tc_table_style_element.rb +45 -0
  274. data/test/stylesheet/tc_table_styles.rb +29 -0
  275. data/test/stylesheet/tc_xf.rb +120 -0
  276. data/test/tc_axlsx.rb +82 -0
  277. data/test/tc_helper.rb +10 -0
  278. data/test/tc_package.rb +233 -0
  279. data/test/util/tc_mime_type_utils.rb +13 -0
  280. data/test/util/tc_serialized_attributes.rb +19 -0
  281. data/test/util/tc_simple_typed_list.rb +77 -0
  282. data/test/util/tc_validators.rb +210 -0
  283. data/test/workbook/tc_defined_name.rb +49 -0
  284. data/test/workbook/tc_shared_strings_table.rb +58 -0
  285. data/test/workbook/tc_workbook.rb +145 -0
  286. data/test/workbook/tc_workbook_view.rb +50 -0
  287. data/test/workbook/worksheet/auto_filter/tc_auto_filter.rb +38 -0
  288. data/test/workbook/worksheet/auto_filter/tc_filter_column.rb +76 -0
  289. data/test/workbook/worksheet/auto_filter/tc_filters.rb +50 -0
  290. data/test/workbook/worksheet/tc_break.rb +49 -0
  291. data/test/workbook/worksheet/tc_cell.rb +373 -0
  292. data/test/workbook/worksheet/tc_cfvo.rb +31 -0
  293. data/test/workbook/worksheet/tc_col.rb +78 -0
  294. data/test/workbook/worksheet/tc_color_scale.rb +58 -0
  295. data/test/workbook/worksheet/tc_comment.rb +72 -0
  296. data/test/workbook/worksheet/tc_comments.rb +57 -0
  297. data/test/workbook/worksheet/tc_conditional_formatting.rb +224 -0
  298. data/test/workbook/worksheet/tc_data_bar.rb +46 -0
  299. data/test/workbook/worksheet/tc_data_validation.rb +265 -0
  300. data/test/workbook/worksheet/tc_date_time_converter.rb +124 -0
  301. data/test/workbook/worksheet/tc_header_footer.rb +151 -0
  302. data/test/workbook/worksheet/tc_icon_set.rb +45 -0
  303. data/test/workbook/worksheet/tc_outline_pr.rb +19 -0
  304. data/test/workbook/worksheet/tc_page_margins.rb +97 -0
  305. data/test/workbook/worksheet/tc_page_set_up_pr.rb +15 -0
  306. data/test/workbook/worksheet/tc_page_setup.rb +143 -0
  307. data/test/workbook/worksheet/tc_pane.rb +54 -0
  308. data/test/workbook/worksheet/tc_pivot_table.rb +140 -0
  309. data/test/workbook/worksheet/tc_pivot_table_cache_definition.rb +54 -0
  310. data/test/workbook/worksheet/tc_print_options.rb +72 -0
  311. data/test/workbook/worksheet/tc_protected_range.rb +17 -0
  312. data/test/workbook/worksheet/tc_rich_text.rb +44 -0
  313. data/test/workbook/worksheet/tc_rich_text_run.rb +172 -0
  314. data/test/workbook/worksheet/tc_row.rb +122 -0
  315. data/test/workbook/worksheet/tc_selection.rb +55 -0
  316. data/test/workbook/worksheet/tc_sheet_calc_pr.rb +18 -0
  317. data/test/workbook/worksheet/tc_sheet_format_pr.rb +88 -0
  318. data/test/workbook/worksheet/tc_sheet_pr.rb +49 -0
  319. data/test/workbook/worksheet/tc_sheet_protection.rb +117 -0
  320. data/test/workbook/worksheet/tc_sheet_view.rb +214 -0
  321. data/test/workbook/worksheet/tc_table.rb +68 -0
  322. data/test/workbook/worksheet/tc_table_style_info.rb +53 -0
  323. data/test/workbook/worksheet/tc_worksheet.rb +594 -0
  324. data/test/workbook/worksheet/tc_worksheet_hyperlink.rb +55 -0
  325. metadata +582 -0
@@ -0,0 +1,50 @@
1
+ require 'tc_helper'
2
+
3
+ class TestWorkbookView < Test::Unit::TestCase
4
+
5
+ def setup
6
+ @options = { visibility: :hidden, minimized: true, show_horizontal_scroll: true, show_vertical_scroll: true,
7
+ show_sheet_tabs: true, tab_ratio: 750, first_sheet: 0, active_tab: 1, x_window: 500, y_window: 400,
8
+ window_width: 800, window_height: 600, auto_filter_date_grouping: true }
9
+ @book_view = Axlsx::WorkbookView.new @options
10
+ end
11
+
12
+ def test_options_assignation
13
+ @options.each do |key, value|
14
+ assert_equal(value, @book_view.send(key))
15
+ end
16
+ end
17
+
18
+ def test_boolean_attribute_validation
19
+ %w(minimized show_horizontal_scroll show_vertical_scroll show_sheet_tabs auto_filter_date_grouping).each do |attr|
20
+ assert_raise(ArgumentError, 'only booleanish allowed in boolean attributes') { @book_view.send("#{attr}=", "banana") }
21
+ assert_nothing_raised { @book_view.send("#{attr}=", false )}
22
+ end
23
+ end
24
+
25
+ def test_integer_attribute_validation
26
+ %w(tab_ratio first_sheet active_tab x_window y_window window_width window_height).each do |attr|
27
+ assert_raise(ArgumentError, 'only integer allowed in integer attributes') { @book_view.send("#{attr}=", "b") }
28
+ assert_nothing_raised { @book_view.send("#{attr}=", 7 )}
29
+ end
30
+ end
31
+
32
+ def test_visibility_attribute_validation
33
+ assert_raise(ArgumentError) { @book_view.visibility = :foobar }
34
+ assert_nothing_raised { @book_view.visibility = :hidden }
35
+ assert_nothing_raised { @book_view.visibility = :very_hidden }
36
+ assert_nothing_raised { @book_view.visibility = :visible }
37
+ end
38
+
39
+ def test_to_xml_string
40
+ xml = @book_view.to_xml_string
41
+ doc = Nokogiri::XML(xml)
42
+ @options.each do |key, value|
43
+ if value == true || value == false
44
+ value = value ? 1 : 0
45
+ end
46
+ path = "workbookView[@#{Axlsx.camel(key, false)}='#{value}']"
47
+ assert_equal(1, doc.xpath(path).size)
48
+ end
49
+ end
50
+ end
@@ -0,0 +1,38 @@
1
+ require 'tc_helper.rb'
2
+
3
+ class TestAutoFilter < Test::Unit::TestCase
4
+
5
+ def setup
6
+ ws = Axlsx::Package.new.workbook.add_worksheet
7
+ 3.times { |index| ws.add_row [1*index,2*index,3*index] }
8
+ @auto_filter = ws.auto_filter
9
+ @auto_filter.range = 'A1:C3'
10
+ @auto_filter.add_column 0, :filters, :filter_items => [1]
11
+ end
12
+
13
+ def test_defined_name
14
+ assert_equal("'Sheet1'!$A$1:$C$3", @auto_filter.defined_name)
15
+ end
16
+
17
+ def test_to_xml_string
18
+ doc = Nokogiri::XML(@auto_filter.to_xml_string)
19
+ assert(doc.xpath("autoFilter[@ref='#{@auto_filter.range}']"))
20
+ end
21
+
22
+ def test_columns
23
+ assert @auto_filter.columns.is_a?(Axlsx::SimpleTypedList)
24
+ assert_equal @auto_filter.columns.allowed_types, [Axlsx::FilterColumn]
25
+ end
26
+
27
+ def test_add_column
28
+ @auto_filter.add_column(0, :filters) do |column|
29
+ assert column.is_a? FilterColumn
30
+ end
31
+ end
32
+
33
+ def test_applya
34
+ assert_equal nil, @auto_filter.worksheet.rows.last.hidden
35
+ @auto_filter.apply
36
+ assert_equal true, @auto_filter.worksheet.rows.last.hidden
37
+ end
38
+ end
@@ -0,0 +1,76 @@
1
+ require 'tc_helper.rb'
2
+
3
+ class TestFilterColumn < Test::Unit::TestCase
4
+
5
+ def setup
6
+ @filter_column = Axlsx::FilterColumn.new(0, :filters, :filter_items => [200])
7
+ end
8
+
9
+
10
+ def test_initialize_col_id
11
+ assert_raise ArgumentError do
12
+ Axlsx::FilterColumn.new(0, :bobs_house_of_filter)
13
+ end
14
+ assert_raise ArgumentError do
15
+ Axlsx::FilterColumn.new(:penut, :filters)
16
+ end
17
+ end
18
+
19
+ def test_initailize_filter_type
20
+ assert @filter_column.filter.is_a?(Axlsx::Filters)
21
+ assert_equal 1, @filter_column.filter.filter_items.size
22
+ end
23
+
24
+ def test_initialize_filter_type_filters_with_options
25
+ assert_equal 200, @filter_column.filter.filter_items.first.val
26
+ end
27
+
28
+ def test_initialize_with_block
29
+ filter_column = Axlsx::FilterColumn.new(0, :filters) do |filters|
30
+ filters.filter_items = [700, 100, 5]
31
+ end
32
+ assert_equal 3, filter_column.filter.filter_items.size
33
+ assert_equal 700, filter_column.filter.filter_items.first.val
34
+ assert_equal 5, filter_column.filter.filter_items.last.val
35
+ end
36
+
37
+ def test_default_show_button
38
+ assert_equal true, @filter_column.show_button
39
+ end
40
+
41
+ def test_default_hidden_button
42
+ assert_equal false, @filter_column.hidden_button
43
+ end
44
+
45
+ def test_show_button
46
+ assert_raise ArgumentError do
47
+ @filter_column.show_button = :foo
48
+ end
49
+ assert_nothing_raised { @filter_column.show_button = false }
50
+ end
51
+
52
+ def test_hidden_button
53
+ assert_raise ArgumentError do
54
+ @filter_column.hidden_button = :hoge
55
+ end
56
+ assert_nothing_raised { @filter_column.hidden_button = true }
57
+ end
58
+
59
+ def test_col_id=
60
+ assert_raise ArgumentError do
61
+ @filter_column.col_id = :bar
62
+ end
63
+ assert_nothing_raised { @filter_column.col_id = 7 }
64
+ end
65
+
66
+ def test_to_xml_string
67
+ doc = Nokogiri::XML(@filter_column.to_xml_string)
68
+ assert doc.xpath("//filterColumn[@colId=#{@filter_column.col_id}]")
69
+ assert doc.xpath("//filterColumn[@hiddenButton=#{@filter_column.hidden_button}]")
70
+ assert doc.xpath("//filterColumn[@showButton=#{@filter_column.show_button}]")
71
+
72
+
73
+
74
+ assert doc.xpath("//filterColumn/filters")
75
+ end
76
+ end
@@ -0,0 +1,50 @@
1
+ require 'tc_helper.rb'
2
+
3
+ class TestFilters < Test::Unit::TestCase
4
+ def setup
5
+ @filters = Axlsx::Filters.new(:filter_items => [1, 'a'],
6
+ :date_group_items =>[ { :date_time_grouping => :year, :year => 2011, :month => 11, :day => 11, :hour => 0, :minute => 0, :second => 0 } ] ,
7
+ :blank => true)
8
+ end
9
+
10
+ def test_blank
11
+ assert_equal true, @filters.blank
12
+ assert_raise(ArgumentError) { @filters.blank = :only_if_you_want_it }
13
+ @filters.blank = true
14
+ assert_equal true, @filters.blank
15
+ end
16
+
17
+ def test_calendar_type
18
+ assert_raise(ArgumentError) { @filters.calendar_type = 'monkey calendar' }
19
+ @filters.calendar_type = 'japan'
20
+ assert_equal('japan', @filters.calendar_type)
21
+ end
22
+
23
+ def test_filters_items
24
+ assert @filters.filter_items.is_a?(Array)
25
+ assert_equal 2, @filters.filter_items.size
26
+ end
27
+
28
+ def test_date_group_items
29
+ assert @filters.date_group_items.is_a?(Array)
30
+ assert_equal 1, @filters.date_group_items.size
31
+ end
32
+
33
+ def test_apply_is_false_for_matching_values
34
+ keeper = Object.new
35
+ def keeper.value; 'a'; end
36
+ assert_equal false, @filters.apply(keeper)
37
+ end
38
+
39
+ def test_apply_is_true_for_non_matching_values
40
+ hidden = Object.new
41
+ def hidden.value; 'b'; end
42
+ assert_equal true, @filters.apply(hidden)
43
+ end
44
+
45
+ def test_to_xml_string
46
+ doc = Nokogiri::XML(@filters.to_xml_string)
47
+ assert_equal(1, doc.xpath('//filters[@blank=1]').size)
48
+ end
49
+ end
50
+
@@ -0,0 +1,49 @@
1
+ require 'tc_helper.rb'
2
+
3
+ class TestBreak < Test::Unit::TestCase
4
+
5
+ def setup
6
+ @break = Axlsx::Break.new(:id => 1, :min => 1, :max => 10, :man => true, :pt => false)
7
+ end
8
+
9
+ def test_id
10
+ assert_equal(1, @break.id)
11
+ assert_raises ArgumentError do
12
+ Axlsx::Break.new(:hoge, {:id => -1})
13
+ end
14
+ end
15
+
16
+ def test_min
17
+ assert_equal(1, @break.min)
18
+ assert_raises ArgumentError do
19
+ Axlsx::Break.new(:hoge, :min => -1)
20
+ end
21
+ end
22
+
23
+ def test_max
24
+ assert_equal(10, @break.max)
25
+ assert_raises ArgumentError do
26
+ Axlsx::Break.new(:hoge, :max => -1)
27
+ end
28
+ end
29
+
30
+
31
+ def test_man
32
+ assert_equal(true, @break.man)
33
+ assert_raises ArgumentError do
34
+ Axlsx::Break.new(:man => -1)
35
+ end
36
+ end
37
+
38
+ def test_pt
39
+ assert_equal(false, @break.pt)
40
+ assert_raises ArgumentError do
41
+ Axlsx::Break.new(:pt => -1)
42
+ end
43
+ end
44
+
45
+ def test_to_xml_string
46
+ doc = Nokogiri::XML(@break.to_xml_string)
47
+ assert_equal(doc.xpath('//brk[@id="1"][@min="1"][@max="10"][@pt=0][@man=1]').size, 1)
48
+ end
49
+ end
@@ -0,0 +1,373 @@
1
+ require 'tc_helper.rb'
2
+
3
+ class TestCell < Test::Unit::TestCase
4
+
5
+ def setup
6
+ p = Axlsx::Package.new
7
+ @ws = p.workbook.add_worksheet :name=>"hmmm"
8
+ p.workbook.styles.add_style :sz=>20
9
+ @row = @ws.add_row
10
+ @c = @row.add_cell 1, :type=>:float, :style=>1
11
+ data = (0..26).map { |index| index }
12
+ @ws.add_row data
13
+ @cAA = @ws["AA2"]
14
+ end
15
+
16
+ def test_initialize
17
+ assert_equal(@row.cells.last, @c, "the cell was added to the row")
18
+ assert_equal(@c.type, :float, "type option is applied")
19
+ assert_equal(@c.style, 1, "style option is applied")
20
+ assert_equal(@c.value, 1.0, "type option is applied and value is casted")
21
+ end
22
+
23
+ def test_style_date_data
24
+ c = Axlsx::Cell.new(@c.row, Time.now)
25
+ assert_equal(Axlsx::STYLE_DATE, c.style)
26
+ end
27
+
28
+ def test_row
29
+ assert_equal(@c.row, @row)
30
+ end
31
+
32
+ def test_index
33
+ assert_equal(@c.index, @row.cells.index(@c))
34
+ end
35
+
36
+ def test_pos
37
+ assert_equal(@c.pos, [@c.index, @c.row.index(@c)])
38
+ end
39
+
40
+ def test_r
41
+ assert_equal(@c.r, "A1", "calculate cell reference")
42
+ end
43
+
44
+ def test_wide_r
45
+ assert_equal(@cAA.r, "AA2", "calculate cell reference")
46
+ end
47
+
48
+ def test_r_abs
49
+ assert_equal(@c.r_abs,"$A$1", "calculate absolute cell reference")
50
+ assert_equal(@cAA.r_abs,"$AA$2", "needs to accept multi-digit columns")
51
+ end
52
+
53
+ def test_name
54
+ @c.name = 'foo'
55
+ assert_equal(1, @ws.workbook.defined_names.size)
56
+ assert_equal('foo', @ws.workbook.defined_names.last.name)
57
+ end
58
+
59
+ def test_style
60
+ assert_raise(ArgumentError, "must reject invalid style indexes") { @c.style=@c.row.worksheet.workbook.styles.cellXfs.size }
61
+ assert_nothing_raised("must allow valid style index changes") {@c.style=1}
62
+ assert_equal(@c.style, 1)
63
+ end
64
+
65
+ def test_type
66
+ assert_raise(ArgumentError, "type must be :string, :integer, :float, :date, :time, :boolean") { @c.type = :array }
67
+ assert_nothing_raised("type can be changed") { @c.type = :string }
68
+ assert_equal(@c.value, "1.0", "changing type casts the value")
69
+ assert_equal(:float, @row.add_cell(1.0/10**7).type, 'properly identify exponential floats as float type')
70
+ assert_equal(@row.add_cell(Time.now).type, :time, 'time should be time')
71
+ assert_equal(@row.add_cell(Date.today).type, :date, 'date should be date')
72
+ assert_equal(@row.add_cell(true).type, :boolean, 'boolean should be boolean')
73
+ end
74
+
75
+ def test_value
76
+ assert_raise(ArgumentError, "type must be :string, :integer, :float, :date, :time, :boolean") { @c.type = :array }
77
+ assert_nothing_raised("type can be changed") { @c.type = :string }
78
+ assert_equal(@c.value, "1.0", "changing type casts the value")
79
+ end
80
+
81
+ def test_col_ref
82
+ #TODO move to axlsx spec
83
+ assert_equal(Axlsx.col_ref(0), "A")
84
+ end
85
+
86
+ def test_cell_type_from_value
87
+ assert_equal(@c.send(:cell_type_from_value, 1.0), :float)
88
+ assert_equal(@c.send(:cell_type_from_value, 1), :integer)
89
+ assert_equal(@c.send(:cell_type_from_value, Date.today), :date)
90
+ assert_equal(@c.send(:cell_type_from_value, Time.now), :time)
91
+ assert_equal(@c.send(:cell_type_from_value, []), :string)
92
+ assert_equal(@c.send(:cell_type_from_value, "d"), :string)
93
+ assert_equal(@c.send(:cell_type_from_value, nil), :string)
94
+ assert_equal(@c.send(:cell_type_from_value, -1), :integer)
95
+ assert_equal(@c.send(:cell_type_from_value, true), :boolean)
96
+ assert_equal(@c.send(:cell_type_from_value, false), :boolean)
97
+ assert_equal(@c.send(:cell_type_from_value, 1.0/10**6), :float)
98
+ assert_equal(@c.send(:cell_type_from_value, Axlsx::RichText.new), :richtext)
99
+ assert_equal(:iso_8601, @c.send(:cell_type_from_value, '2008-08-30T01:45:36.123+09:00'))
100
+ end
101
+
102
+ def test_cast_value
103
+ @c.type = :string
104
+ assert_equal(@c.send(:cast_value, 1.0), "1.0")
105
+ @c.type = :integer
106
+ assert_equal(@c.send(:cast_value, 1.0), 1)
107
+ @c.type = :float
108
+ assert_equal(@c.send(:cast_value, "1.0"), 1.0)
109
+ @c.type = :string
110
+ assert_equal(@c.send(:cast_value, nil), nil)
111
+ @c.type = :richtext
112
+ assert_equal(@c.send(:cast_value, nil), nil)
113
+ @c.type = :float
114
+ assert_equal(@c.send(:cast_value, nil), nil)
115
+ @c.type = :boolean
116
+ assert_equal(@c.send(:cast_value, true), 1)
117
+ assert_equal(@c.send(:cast_value, false), 0)
118
+ @c.type = :iso_8601
119
+ assert_equal("2012-10-10T12:24", @c.send(:cast_value, "2012-10-10T12:24"))
120
+ end
121
+
122
+ def test_cast_time_subclass
123
+ subtime = Class.new(Time) do
124
+ def to_time
125
+ raise "#to_time of Time subclass should not be called"
126
+ end
127
+ end
128
+
129
+ time = subtime.now
130
+
131
+ @c.type = :time
132
+ assert_equal(time, @c.send(:cast_value, time))
133
+ end
134
+
135
+ def test_color
136
+ assert_raise(ArgumentError) { @c.color = -1.1 }
137
+ assert_nothing_raised { @c.color = "FF00FF00" }
138
+ assert_equal(@c.color.rgb, "FF00FF00")
139
+ end
140
+
141
+ def test_scheme
142
+ assert_raise(ArgumentError) { @c.scheme = -1.1 }
143
+ assert_nothing_raised { @c.scheme = :major }
144
+ assert_equal(@c.scheme, :major)
145
+ end
146
+
147
+ def test_vertAlign
148
+ assert_raise(ArgumentError) { @c.vertAlign = -1.1 }
149
+ assert_nothing_raised { @c.vertAlign = :baseline }
150
+ assert_equal(@c.vertAlign, :baseline)
151
+ end
152
+
153
+ def test_sz
154
+ assert_raise(ArgumentError) { @c.sz = -1.1 }
155
+ assert_nothing_raised { @c.sz = 12 }
156
+ assert_equal(@c.sz, 12)
157
+ end
158
+
159
+ def test_extend
160
+ assert_raise(ArgumentError) { @c.extend = -1.1 }
161
+ assert_nothing_raised { @c.extend = false }
162
+ assert_equal(@c.extend, false)
163
+ end
164
+
165
+ def test_condense
166
+ assert_raise(ArgumentError) { @c.condense = -1.1 }
167
+ assert_nothing_raised { @c.condense = false }
168
+ assert_equal(@c.condense, false)
169
+ end
170
+
171
+ def test_shadow
172
+ assert_raise(ArgumentError) { @c.shadow = -1.1 }
173
+ assert_nothing_raised { @c.shadow = false }
174
+ assert_equal(@c.shadow, false)
175
+ end
176
+
177
+ def test_outline
178
+ assert_raise(ArgumentError) { @c.outline = -1.1 }
179
+ assert_nothing_raised { @c.outline = false }
180
+ assert_equal(@c.outline, false)
181
+ end
182
+
183
+ def test_strike
184
+ assert_raise(ArgumentError) { @c.strike = -1.1 }
185
+ assert_nothing_raised { @c.strike = false }
186
+ assert_equal(@c.strike, false)
187
+ end
188
+
189
+ def test_u
190
+ @c.type = :string
191
+ assert_raise(ArgumentError) { @c.u = -1.1 }
192
+ assert_nothing_raised { @c.u = :single }
193
+ assert_equal(@c.u, :single)
194
+ doc = Nokogiri::XML(@c.to_xml_string(1,1))
195
+ assert(doc.xpath('//u[@val="single"]'))
196
+ end
197
+
198
+ def test_i
199
+ assert_raise(ArgumentError) { @c.i = -1.1 }
200
+ assert_nothing_raised { @c.i = false }
201
+ assert_equal(@c.i, false)
202
+ end
203
+
204
+ def test_rFont
205
+ assert_raise(ArgumentError) { @c.font_name = -1.1 }
206
+ assert_nothing_raised { @c.font_name = "Arial" }
207
+ assert_equal(@c.font_name, "Arial")
208
+ end
209
+
210
+ def test_charset
211
+ assert_raise(ArgumentError) { @c.charset = -1.1 }
212
+ assert_nothing_raised { @c.charset = 1 }
213
+ assert_equal(@c.charset, 1)
214
+ end
215
+
216
+ def test_family
217
+ assert_raise(ArgumentError) { @c.family = -1.1 }
218
+ assert_nothing_raised { @c.family = 5 }
219
+ assert_equal(@c.family, 5)
220
+ end
221
+
222
+ def test_b
223
+ assert_raise(ArgumentError) { @c.b = -1.1 }
224
+ assert_nothing_raised { @c.b = false }
225
+ assert_equal(@c.b, false)
226
+ end
227
+
228
+ def test_merge_with_string
229
+ @c.row.add_cell 2
230
+ @c.row.add_cell 3
231
+ @c.merge "A2"
232
+ assert_equal(@c.row.worksheet.send(:merged_cells).last, "A1:A2")
233
+ end
234
+
235
+ def test_merge_with_cell
236
+ @c.row.add_cell 2
237
+ @c.row.add_cell 3
238
+ @c.merge @row.cells.last
239
+ assert_equal(@c.row.worksheet.send(:merged_cells).last, "A1:C1")
240
+ end
241
+
242
+ def test_reverse_merge_with_cell
243
+ @c.row.add_cell 2
244
+ @c.row.add_cell 3
245
+ @row.cells.last.merge @c
246
+ assert_equal(@c.row.worksheet.send(:merged_cells).last, "A1:C1")
247
+ end
248
+
249
+ def test_ssti
250
+ assert_raise(ArgumentError, "ssti must be an unsigned integer!") { @c.send(:ssti=, -1) }
251
+ @c.send :ssti=, 1
252
+ assert_equal(@c.ssti, 1)
253
+ end
254
+
255
+ def test_plain_string
256
+ @c.type = :integer
257
+ assert_equal(@c.plain_string?, false)
258
+
259
+ @c.type = :string
260
+ @c.value = 'plain string'
261
+ assert_equal(@c.plain_string?, true)
262
+
263
+ @c.value = nil
264
+ assert_equal(@c.plain_string?, false)
265
+
266
+ @c.value = ''
267
+ assert_equal(@c.plain_string?, false)
268
+
269
+ @c.value = '=sum'
270
+ assert_equal(@c.plain_string?, false)
271
+
272
+ @c.value = 'plain string'
273
+ @c.font_name = 'Arial'
274
+ assert_equal(@c.plain_string?, false)
275
+ end
276
+
277
+ def test_to_xml_string
278
+ c_xml = Nokogiri::XML(@c.to_xml_string(1,1))
279
+ assert_equal(c_xml.xpath("/c[@s=1]").size, 1)
280
+ end
281
+
282
+ def test_to_xml_string_nil
283
+ @c.value = nil
284
+ c_xml = Nokogiri::XML(@c.to_xml_string(1,1))
285
+ assert_equal(c_xml.xpath("/c[@s=1]").size, 1)
286
+ end
287
+
288
+ def test_to_xml_string_with_run
289
+ # Actually quite a number of similar run styles
290
+ # but the processing should be the same
291
+ @c.b = true
292
+ @c.type = :string
293
+ @c.value = "a"
294
+ @c.font_name = 'arial'
295
+ @c.color = 'FF0000'
296
+ c_xml = Nokogiri::XML(@c.to_xml_string(1,1))
297
+ assert(c_xml.xpath("//b").any?)
298
+ end
299
+
300
+ def test_to_xml_string_formula
301
+ p = Axlsx::Package.new
302
+ ws = p.workbook.add_worksheet do |sheet|
303
+ sheet.add_row ["=IF(2+2=4,4,5)"]
304
+ end
305
+ doc = Nokogiri::XML(ws.to_xml_string)
306
+ doc.remove_namespaces!
307
+ assert(doc.xpath("//f[text()='IF(2+2=4,4,5)']").any?)
308
+ end
309
+
310
+ def test_to_xml_string_array_formula
311
+ p = Axlsx::Package.new
312
+ ws = p.workbook.add_worksheet do |sheet|
313
+ sheet.add_row ["{=SUM(C2:C11*D2:D11)}"]
314
+ end
315
+ doc = Nokogiri::XML(ws.to_xml_string)
316
+ doc.remove_namespaces!
317
+ assert(doc.xpath("//f[text()='SUM(C2:C11*D2:D11)']").any?)
318
+ assert(doc.xpath("//f[@t='array']").any?)
319
+ assert(doc.xpath("//f[@ref='A1']").any?)
320
+ end
321
+
322
+ def test_to_xml_string_text_formula
323
+ p = Axlsx::Package.new
324
+ ws = p.workbook.add_worksheet do |sheet|
325
+ sheet.add_row ["=1+1", "-1+1"], type: :text
326
+ end
327
+ doc = Nokogiri::XML(ws.to_xml_string)
328
+ doc.remove_namespaces!
329
+
330
+ assert(doc.xpath("//f[text()='1+1']").empty?)
331
+ assert(doc.xpath("//t[text()='=1+1']").any?)
332
+
333
+ assert(doc.xpath("//f[text()='1+1']").empty?)
334
+ assert(doc.xpath("//t[text()='-1+1']").any?)
335
+ end
336
+
337
+ def test_font_size_with_custom_style_and_no_sz
338
+ @c.style = @c.row.worksheet.workbook.styles.add_style :bg_color => 'FF00FF'
339
+ sz = @c.send(:font_size)
340
+ assert_equal(sz, @c.row.worksheet.workbook.styles.fonts.first.sz)
341
+ end
342
+
343
+ def test_font_size_with_bolding
344
+ @c.style = @c.row.worksheet.workbook.styles.add_style :b => true
345
+ assert_equal(@c.row.worksheet.workbook.styles.fonts.first.sz * 1.5, @c.send(:font_size))
346
+ end
347
+
348
+ def test_font_size_with_custom_sz
349
+ @c.style = @c.row.worksheet.workbook.styles.add_style :sz => 52
350
+ sz = @c.send(:font_size)
351
+ assert_equal(sz, 52)
352
+ end
353
+
354
+ def test_cell_with_sz
355
+ @c.sz = 25
356
+ assert_equal(25, @c.send(:font_size))
357
+ end
358
+
359
+ def test_to_xml
360
+ # TODO This could use some much more stringent testing related to the xml content generated!
361
+ @ws.add_row [Time.now, Date.today, true, 1, 1.0, "text", "=sum(A1:A2)", "2013-01-13T13:31:25.123"]
362
+ @ws.rows.last.cells[5].u = true
363
+
364
+ schema = Nokogiri::XML::Schema(File.open(Axlsx::SML_XSD))
365
+ doc = Nokogiri::XML(@ws.to_xml_string)
366
+ errors = []
367
+ schema.validate(doc).each do |error|
368
+ errors.push error
369
+ puts error.message
370
+ end
371
+ assert(errors.empty?, "error free validation")
372
+ end
373
+ end