openxml-docx 0.8.0 → 0.9.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/Gemfile.lock +1 -1
- data/{example → examples/base} +1 -1
- data/examples/table +68 -0
- data/lib/openxml/docx/elements/grid_column.rb +12 -0
- data/lib/openxml/docx/elements/table.rb +30 -0
- data/lib/openxml/docx/elements/table_cell.rb +26 -0
- data/lib/openxml/docx/elements/table_grid.rb +10 -0
- data/lib/openxml/docx/elements/table_row.rb +36 -0
- data/lib/openxml/docx/package.rb +3 -0
- data/lib/openxml/docx/properties.rb +2 -0
- data/lib/openxml/docx/properties/base_property.rb +14 -0
- data/lib/openxml/docx/properties/cant_split.rb +8 -0
- data/lib/openxml/docx/properties/columns.rb +2 -0
- data/lib/openxml/docx/properties/grid_after.rb +8 -0
- data/lib/openxml/docx/properties/grid_before.rb +8 -0
- data/lib/openxml/docx/properties/grid_span.rb +8 -0
- data/lib/openxml/docx/properties/header.rb +8 -0
- data/lib/openxml/docx/properties/headers.rb +12 -0
- data/lib/openxml/docx/properties/hidden.rb +8 -0
- data/lib/openxml/docx/properties/hide_mark.rb +8 -0
- data/lib/openxml/docx/properties/no_wrap.rb +8 -0
- data/lib/openxml/docx/properties/table_border.rb +25 -0
- data/lib/openxml/docx/properties/table_borders.rb +13 -0
- data/lib/openxml/docx/properties/table_caption.rb +10 -0
- data/lib/openxml/docx/properties/table_cell_border.rb +25 -0
- data/lib/openxml/docx/properties/table_cell_borders.rb +13 -0
- data/lib/openxml/docx/properties/table_cell_cell_margin.rb +13 -0
- data/lib/openxml/docx/properties/table_cell_fit_text.rb +9 -0
- data/lib/openxml/docx/properties/table_cell_margin.rb +13 -0
- data/lib/openxml/docx/properties/table_cell_margins.rb +13 -0
- data/lib/openxml/docx/properties/table_cell_spacing.rb +13 -0
- data/lib/openxml/docx/properties/table_cell_width.rb +13 -0
- data/lib/openxml/docx/properties/table_description.rb +10 -0
- data/lib/openxml/docx/properties/table_header.rb +10 -0
- data/lib/openxml/docx/properties/table_indent.rb +13 -0
- data/lib/openxml/docx/properties/table_layout.rb +14 -0
- data/lib/openxml/docx/properties/table_look.rb +17 -0
- data/lib/openxml/docx/properties/table_overlap.rb +14 -0
- data/lib/openxml/docx/properties/table_p_pr.rb +41 -0
- data/lib/openxml/docx/properties/table_style.rb +10 -0
- data/lib/openxml/docx/properties/table_width.rb +13 -0
- data/lib/openxml/docx/properties/tr_height.rb +19 -0
- data/lib/openxml/docx/properties/valign.rb +13 -0
- data/lib/openxml/docx/properties/wafter.rb +12 -0
- data/lib/openxml/docx/properties/wbefore.rb +12 -0
- data/lib/openxml/docx/properties/width_property.rb +17 -0
- data/lib/openxml/docx/style.rb +17 -7
- data/lib/openxml/docx/version.rb +1 -1
- data/spec/elements/grid_column_spec.rb +15 -0
- data/spec/elements/table_cell_spec.rb +15 -0
- data/spec/elements/table_grid_spec.rb +17 -0
- data/spec/elements/table_row_spec.rb +18 -0
- data/spec/elements/table_spec.rb +21 -0
- data/spec/properties/border_spec.rb +21 -95
- data/spec/properties/cant_split_spec.rb +23 -0
- data/spec/properties/color_spec.rb +9 -29
- data/spec/properties/column_spec.rb +6 -22
- data/spec/properties/columns_spec.rb +4 -14
- data/spec/properties/conditional_formatting_spec.rb +12 -108
- data/spec/properties/document_grid_spec.rb +12 -53
- data/spec/properties/east_asian_layout_spec.rb +14 -74
- data/spec/properties/font_spec.rb +35 -238
- data/spec/properties/frame_spec.rb +48 -285
- data/spec/properties/grid_after_spec.rb +26 -0
- data/spec/properties/grid_before_spec.rb +26 -0
- data/spec/properties/grid_span_spec.rb +24 -0
- data/spec/properties/header_spec.rb +17 -0
- data/spec/properties/headers_spec.rb +39 -0
- data/spec/properties/hidden_spec.rb +23 -0
- data/spec/properties/hide_mark_spec.rb +23 -0
- data/spec/properties/indentation_spec.rb +32 -136
- data/spec/properties/language_spec.rb +3 -12
- data/spec/properties/latent_styles_exception_spec.rb +7 -22
- data/spec/properties/latent_styles_spec.rb +5 -18
- data/spec/properties/line_numbering_spec.rb +15 -68
- data/spec/properties/manual_width_spec.rb +8 -33
- data/spec/properties/no_wrap_spec.rb +23 -0
- data/spec/properties/numbering_spec.rb +4 -13
- data/spec/properties/page_margins_spec.rb +28 -114
- data/spec/properties/page_numbering_spec.rb +26 -367
- data/spec/properties/page_size_spec.rb +15 -62
- data/spec/properties/paper_source_spec.rb +8 -34
- data/spec/properties/shading_spec.rb +21 -92
- data/spec/properties/spacing_spec.rb +27 -119
- data/spec/properties/table_border_spec.rb +119 -0
- data/spec/properties/table_borders_spec.rb +41 -0
- data/spec/properties/table_caption_spec.rb +17 -0
- data/spec/properties/table_cell_border_spec.rb +119 -0
- data/spec/properties/table_cell_borders_spec.rb +40 -0
- data/spec/properties/table_cell_cell_margin_spec.rb +46 -0
- data/spec/properties/table_cell_fit_text.rb +23 -0
- data/spec/properties/table_cell_margin_spec.rb +40 -0
- data/spec/properties/table_cell_margins_spec.rb +46 -0
- data/spec/properties/table_cell_spacing_spec.rb +21 -0
- data/spec/properties/table_cell_width.rb +21 -0
- data/spec/properties/table_description_spec.rb +17 -0
- data/spec/properties/table_header_spec.rb +23 -0
- data/spec/properties/table_indent_spec.rb +43 -0
- data/spec/properties/table_layout_spec.rb +22 -0
- data/spec/properties/table_look_spec.rb +38 -0
- data/spec/properties/table_overlap_spec.rb +22 -0
- data/spec/properties/table_p_pr_spec.rb +68 -0
- data/spec/properties/table_row_height.rb +20 -0
- data/spec/properties/table_style_spec.rb +17 -0
- data/spec/properties/table_width_spec.rb +21 -0
- data/spec/properties/underline_spec.rb +14 -130
- data/spec/properties/valign_spec.rb +19 -0
- data/spec/properties/wafter_spec.rb +21 -0
- data/spec/properties/wbefore_spec.rb +21 -0
- data/spec/support/data/elements/grid_column_element.xml +4 -0
- data/spec/support/data/elements/table_cell_element.xml +8 -0
- data/spec/support/data/elements/table_element.xml +18 -0
- data/spec/support/data/elements/table_grid_element.xml +6 -0
- data/spec/support/data/elements/table_row_element.xml +13 -0
- data/spec/support/property_test_macros.rb +61 -0
- metadata +86 -3
@@ -0,0 +1,17 @@
|
|
1
|
+
require "spec_helper"
|
2
|
+
|
3
|
+
describe OpenXml::Docx::Properties::Header do
|
4
|
+
include ValuePropertyTestMacros
|
5
|
+
|
6
|
+
it_should_use tag: :header, name: "header", value: "Something"
|
7
|
+
|
8
|
+
with_value("Something Else") do
|
9
|
+
it_should_work
|
10
|
+
it_should_output "<w:header w:val=\"Something Else\"/>"
|
11
|
+
end
|
12
|
+
|
13
|
+
with_value("") do
|
14
|
+
it_should_not_work
|
15
|
+
end
|
16
|
+
|
17
|
+
end
|
@@ -0,0 +1,39 @@
|
|
1
|
+
require "spec_helper"
|
2
|
+
|
3
|
+
describe OpenXml::Docx::Properties::Headers do
|
4
|
+
include PropertyTestMacros
|
5
|
+
|
6
|
+
it_should_use tag: :headers, name: "headers"
|
7
|
+
|
8
|
+
context "when trying to add headers, it" do
|
9
|
+
before(:each) do
|
10
|
+
@instance = described_class.new
|
11
|
+
end
|
12
|
+
|
13
|
+
it "should raise an exception if the header to be added isn't a header at all" do
|
14
|
+
expect { instance << [] }.to raise_error(ArgumentError)
|
15
|
+
end
|
16
|
+
end
|
17
|
+
|
18
|
+
context "when there are no headers" do
|
19
|
+
before(:each) do
|
20
|
+
@instance = described_class.new
|
21
|
+
end
|
22
|
+
|
23
|
+
it "should not output any XML" do
|
24
|
+
expect(xml(instance)).to eq("")
|
25
|
+
end
|
26
|
+
end
|
27
|
+
|
28
|
+
context "when there are borders" do
|
29
|
+
before(:each) do
|
30
|
+
@instance = described_class.new
|
31
|
+
instance << OpenXml::Docx::Properties::Header.new("Something")
|
32
|
+
end
|
33
|
+
|
34
|
+
it "should output the correct XML" do
|
35
|
+
expect(xml(instance)).to eq("<w:headers>\n <w:header w:val=\"Something\"/>\n </w:headers>")
|
36
|
+
end
|
37
|
+
end
|
38
|
+
|
39
|
+
end
|
@@ -0,0 +1,23 @@
|
|
1
|
+
require "spec_helper"
|
2
|
+
|
3
|
+
describe OpenXml::Docx::Properties::Hidden do
|
4
|
+
include ValuePropertyTestMacros
|
5
|
+
|
6
|
+
it_should_use tag: :hidden, name: "hidden"
|
7
|
+
|
8
|
+
with_value(true) do
|
9
|
+
it_should_work
|
10
|
+
it_should_output "<w:hidden/>"
|
11
|
+
end
|
12
|
+
|
13
|
+
with_value(false) do
|
14
|
+
it_should_work
|
15
|
+
it_should_output ""
|
16
|
+
end
|
17
|
+
|
18
|
+
with_value(nil) do
|
19
|
+
it_should_work
|
20
|
+
it_should_output ""
|
21
|
+
end
|
22
|
+
|
23
|
+
end
|
@@ -0,0 +1,23 @@
|
|
1
|
+
require "spec_helper"
|
2
|
+
|
3
|
+
describe OpenXml::Docx::Properties::HideMark do
|
4
|
+
include ValuePropertyTestMacros
|
5
|
+
|
6
|
+
it_should_use tag: :hideMark, name: "hide_mark"
|
7
|
+
|
8
|
+
with_value(true) do
|
9
|
+
it_should_work
|
10
|
+
it_should_output "<w:hideMark/>"
|
11
|
+
end
|
12
|
+
|
13
|
+
with_value(false) do
|
14
|
+
it_should_work
|
15
|
+
it_should_output ""
|
16
|
+
end
|
17
|
+
|
18
|
+
with_value(nil) do
|
19
|
+
it_should_work
|
20
|
+
it_should_output ""
|
21
|
+
end
|
22
|
+
|
23
|
+
end
|
@@ -6,163 +6,59 @@ describe OpenXml::Docx::Properties::Indentation do
|
|
6
6
|
it_should_use tag: :ind, name: "indentation"
|
7
7
|
|
8
8
|
for_attribute(:end) do
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
with_value(-1220) do
|
15
|
-
it_should_assign_successfully
|
16
|
-
it_should_output "<w:ind w:end=\"-1220\"/>"
|
17
|
-
end
|
18
|
-
|
19
|
-
with_value(1220.3) do
|
20
|
-
it_should_raise_an_exception
|
21
|
-
end
|
22
|
-
|
23
|
-
with_value(:bad) do
|
24
|
-
it_should_raise_an_exception
|
25
|
-
end
|
9
|
+
values = [1220, -1220]
|
10
|
+
it_should_assign_and_output_xml values
|
11
|
+
it_should_not_allow_floats
|
12
|
+
it_should_not_allow_invalid_value
|
26
13
|
end
|
27
14
|
|
28
15
|
for_attribute(:end_characters) do
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
with_value(-1220) do
|
35
|
-
it_should_assign_successfully
|
36
|
-
it_should_output "<w:ind w:endChars=\"-1220\"/>"
|
37
|
-
end
|
38
|
-
|
39
|
-
with_value(1220.3) do
|
40
|
-
it_should_raise_an_exception
|
41
|
-
end
|
42
|
-
|
43
|
-
with_value(:bad) do
|
44
|
-
it_should_raise_an_exception
|
45
|
-
end
|
16
|
+
values = [1220, -1220]
|
17
|
+
it_should_assign_and_output_xml values
|
18
|
+
it_should_not_allow_floats
|
19
|
+
it_should_not_allow_invalid_value
|
46
20
|
end
|
47
21
|
|
48
22
|
for_attribute(:first_line) do
|
49
|
-
|
50
|
-
|
51
|
-
|
52
|
-
|
53
|
-
|
54
|
-
with_value(-1220) do
|
55
|
-
it_should_assign_successfully
|
56
|
-
it_should_output "<w:ind w:firstLine=\"-1220\"/>"
|
57
|
-
end
|
58
|
-
|
59
|
-
with_value(1220.3) do
|
60
|
-
it_should_raise_an_exception
|
61
|
-
end
|
62
|
-
|
63
|
-
with_value(:bad) do
|
64
|
-
it_should_raise_an_exception
|
65
|
-
end
|
23
|
+
values = [1220, -1220]
|
24
|
+
it_should_assign_and_output_xml values
|
25
|
+
it_should_not_allow_floats
|
26
|
+
it_should_not_allow_invalid_value
|
66
27
|
end
|
67
28
|
|
68
29
|
for_attribute(:first_line_characters) do
|
69
|
-
|
70
|
-
|
71
|
-
|
72
|
-
|
73
|
-
|
74
|
-
with_value(-1220) do
|
75
|
-
it_should_assign_successfully
|
76
|
-
it_should_output "<w:ind w:firstLineChars=\"-1220\"/>"
|
77
|
-
end
|
78
|
-
|
79
|
-
with_value(1220.3) do
|
80
|
-
it_should_raise_an_exception
|
81
|
-
end
|
82
|
-
|
83
|
-
with_value(:bad) do
|
84
|
-
it_should_raise_an_exception
|
85
|
-
end
|
30
|
+
values = [1220, -1220]
|
31
|
+
it_should_assign_and_output_xml values
|
32
|
+
it_should_not_allow_floats
|
33
|
+
it_should_not_allow_invalid_value
|
86
34
|
end
|
87
35
|
|
88
36
|
for_attribute(:hanging) do
|
89
|
-
|
90
|
-
|
91
|
-
|
92
|
-
|
93
|
-
|
94
|
-
with_value(-1220) do
|
95
|
-
it_should_assign_successfully
|
96
|
-
it_should_output "<w:ind w:hanging=\"-1220\"/>"
|
97
|
-
end
|
98
|
-
|
99
|
-
with_value(1220.3) do
|
100
|
-
it_should_raise_an_exception
|
101
|
-
end
|
102
|
-
|
103
|
-
with_value(:bad) do
|
104
|
-
it_should_raise_an_exception
|
105
|
-
end
|
37
|
+
values = [1220, -1220]
|
38
|
+
it_should_assign_and_output_xml values
|
39
|
+
it_should_not_allow_floats
|
40
|
+
it_should_not_allow_invalid_value
|
106
41
|
end
|
107
42
|
|
108
43
|
for_attribute(:hanging_characters) do
|
109
|
-
|
110
|
-
|
111
|
-
|
112
|
-
|
113
|
-
|
114
|
-
with_value(-1220) do
|
115
|
-
it_should_assign_successfully
|
116
|
-
it_should_output "<w:ind w:hangingChars=\"-1220\"/>"
|
117
|
-
end
|
118
|
-
|
119
|
-
with_value(1220.3) do
|
120
|
-
it_should_raise_an_exception
|
121
|
-
end
|
122
|
-
|
123
|
-
with_value(:bad) do
|
124
|
-
it_should_raise_an_exception
|
125
|
-
end
|
44
|
+
values = [1220, -1220]
|
45
|
+
it_should_assign_and_output_xml values
|
46
|
+
it_should_not_allow_floats
|
47
|
+
it_should_not_allow_invalid_value
|
126
48
|
end
|
127
49
|
|
128
50
|
for_attribute(:start) do
|
129
|
-
|
130
|
-
|
131
|
-
|
132
|
-
|
133
|
-
|
134
|
-
with_value(-1220) do
|
135
|
-
it_should_assign_successfully
|
136
|
-
it_should_output "<w:ind w:start=\"-1220\"/>"
|
137
|
-
end
|
138
|
-
|
139
|
-
with_value(1220.3) do
|
140
|
-
it_should_raise_an_exception
|
141
|
-
end
|
142
|
-
|
143
|
-
with_value(:bad) do
|
144
|
-
it_should_raise_an_exception
|
145
|
-
end
|
51
|
+
values = [1220, -1220]
|
52
|
+
it_should_assign_and_output_xml values
|
53
|
+
it_should_not_allow_floats
|
54
|
+
it_should_not_allow_invalid_value
|
146
55
|
end
|
147
56
|
|
148
57
|
for_attribute(:start_characters) do
|
149
|
-
|
150
|
-
|
151
|
-
|
152
|
-
|
153
|
-
|
154
|
-
with_value(-1220) do
|
155
|
-
it_should_assign_successfully
|
156
|
-
it_should_output "<w:ind w:startChars=\"-1220\"/>"
|
157
|
-
end
|
158
|
-
|
159
|
-
with_value(1220.3) do
|
160
|
-
it_should_raise_an_exception
|
161
|
-
end
|
162
|
-
|
163
|
-
with_value(:bad) do
|
164
|
-
it_should_raise_an_exception
|
165
|
-
end
|
58
|
+
values = [1220, -1220]
|
59
|
+
it_should_assign_and_output_xml values
|
60
|
+
it_should_not_allow_floats
|
61
|
+
it_should_not_allow_invalid_value
|
166
62
|
end
|
167
63
|
|
168
64
|
with_no_attributes_set do
|
@@ -6,24 +6,15 @@ describe OpenXml::Docx::Properties::Language do
|
|
6
6
|
it_should_use tag: :lang, name: "language"
|
7
7
|
|
8
8
|
for_attribute(:bidi) do
|
9
|
-
|
10
|
-
it_should_assign_successfully
|
11
|
-
it_should_output "<w:lang w:bidi=\"en-US\"/>"
|
12
|
-
end
|
9
|
+
it_should_assign_and_output_xml "en-US"
|
13
10
|
end
|
14
11
|
|
15
12
|
for_attribute(:east_asia) do
|
16
|
-
|
17
|
-
it_should_assign_successfully
|
18
|
-
it_should_output "<w:lang w:eastAsia=\"ko-KR\"/>"
|
19
|
-
end
|
13
|
+
it_should_assign_and_output_xml "ko-KR"
|
20
14
|
end
|
21
15
|
|
22
16
|
for_attribute(:latin) do
|
23
|
-
|
24
|
-
it_should_assign_successfully
|
25
|
-
it_should_output "<w:lang w:val=\"fr-CA\"/>"
|
26
|
-
end
|
17
|
+
it_should_assign_and_output_xml "fr-CA"
|
27
18
|
end
|
28
19
|
|
29
20
|
end
|
@@ -11,9 +11,7 @@ describe OpenXml::Docx::Properties::LatentStylesException do
|
|
11
11
|
it_should_output "<w:lsdException w:locked=\"true\" w:name=\"StyleName\"/>", "StyleName"
|
12
12
|
end
|
13
13
|
|
14
|
-
|
15
|
-
it_should_raise_an_exception
|
16
|
-
end
|
14
|
+
it_should_not_allow_integers
|
17
15
|
end
|
18
16
|
|
19
17
|
for_attribute(:style_name) do
|
@@ -22,9 +20,7 @@ describe OpenXml::Docx::Properties::LatentStylesException do
|
|
22
20
|
it_should_output "<w:lsdException w:name=\"NewStyleName\"/>", "StyleName"
|
23
21
|
end
|
24
22
|
|
25
|
-
|
26
|
-
it_should_raise_an_exception
|
27
|
-
end
|
23
|
+
it_should_not_allow_nil
|
28
24
|
end
|
29
25
|
|
30
26
|
for_attribute(:qFormat) do
|
@@ -33,9 +29,7 @@ describe OpenXml::Docx::Properties::LatentStylesException do
|
|
33
29
|
it_should_output "<w:lsdException w:name=\"StyleName\" w:qFormat=\"true\"/>", "StyleName"
|
34
30
|
end
|
35
31
|
|
36
|
-
|
37
|
-
it_should_raise_an_exception
|
38
|
-
end
|
32
|
+
it_should_not_allow_integers
|
39
33
|
end
|
40
34
|
|
41
35
|
for_attribute(:semi_hidden) do
|
@@ -44,9 +38,7 @@ describe OpenXml::Docx::Properties::LatentStylesException do
|
|
44
38
|
it_should_output "<w:lsdException w:name=\"StyleName\" w:semiHidden=\"true\"/>", "StyleName"
|
45
39
|
end
|
46
40
|
|
47
|
-
|
48
|
-
it_should_raise_an_exception
|
49
|
-
end
|
41
|
+
it_should_not_allow_integers
|
50
42
|
end
|
51
43
|
|
52
44
|
for_attribute(:ui_priority) do
|
@@ -60,13 +52,8 @@ describe OpenXml::Docx::Properties::LatentStylesException do
|
|
60
52
|
it_should_output "<w:lsdException w:name=\"StyleName\" w:uiPriority=\"-1\"/>", "StyleName"
|
61
53
|
end
|
62
54
|
|
63
|
-
|
64
|
-
|
65
|
-
end
|
66
|
-
|
67
|
-
with_value(:a_lot) do
|
68
|
-
it_should_raise_an_exception
|
69
|
-
end
|
55
|
+
it_should_not_allow_floats
|
56
|
+
it_should_not_allow_invalid_value
|
70
57
|
end
|
71
58
|
|
72
59
|
for_attribute(:unhide_when_used) do
|
@@ -75,9 +62,7 @@ describe OpenXml::Docx::Properties::LatentStylesException do
|
|
75
62
|
it_should_output "<w:lsdException w:name=\"StyleName\" w:unhideWhenUsed=\"true\"/>", "StyleName"
|
76
63
|
end
|
77
64
|
|
78
|
-
|
79
|
-
it_should_raise_an_exception
|
80
|
-
end
|
65
|
+
it_should_not_allow_integers
|
81
66
|
end
|
82
67
|
|
83
68
|
end
|
@@ -57,17 +57,9 @@ describe OpenXml::Docx::Properties::LatentStyles do
|
|
57
57
|
end
|
58
58
|
end
|
59
59
|
|
60
|
-
|
61
|
-
|
62
|
-
|
63
|
-
|
64
|
-
with_value(1.3) do
|
65
|
-
it_should_raise_an_exception
|
66
|
-
end
|
67
|
-
|
68
|
-
with_value(:a_lot) do
|
69
|
-
it_should_raise_an_exception
|
70
|
-
end
|
60
|
+
it_should_not_allow_negative_numbers
|
61
|
+
it_should_not_allow_floats
|
62
|
+
it_should_not_allow_invalid_value
|
71
63
|
end
|
72
64
|
|
73
65
|
for_attribute(:default_locked_state) do
|
@@ -168,13 +160,8 @@ describe OpenXml::Docx::Properties::LatentStyles do
|
|
168
160
|
end
|
169
161
|
end
|
170
162
|
|
171
|
-
|
172
|
-
|
173
|
-
end
|
174
|
-
|
175
|
-
with_value(:a_lot) do
|
176
|
-
it_should_raise_an_exception
|
177
|
-
end
|
163
|
+
it_should_not_allow_floats
|
164
|
+
it_should_not_allow_invalid_value
|
178
165
|
end
|
179
166
|
|
180
167
|
for_attribute(:default_unhide_when_used) do
|
@@ -6,83 +6,30 @@ describe OpenXml::Docx::Properties::LineNumbering do
|
|
6
6
|
it_should_use tag: :lnNumType, name: "line_numbering"
|
7
7
|
|
8
8
|
for_attribute(:count_by) do
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
with_value(-5) do
|
15
|
-
it_should_assign_successfully
|
16
|
-
it_should_output "<w:lnNumType w:countBy=\"-5\"/>"
|
17
|
-
end
|
18
|
-
|
19
|
-
with_value(123.4) do
|
20
|
-
it_should_raise_an_exception
|
21
|
-
end
|
22
|
-
|
23
|
-
with_value(:twelve) do
|
24
|
-
it_should_raise_an_exception
|
25
|
-
end
|
9
|
+
values = [5, -5]
|
10
|
+
it_should_assign_and_output_xml values
|
11
|
+
it_should_not_allow_floats
|
12
|
+
it_should_not_allow_invalid_value
|
26
13
|
end
|
27
14
|
|
28
15
|
for_attribute(:distance) do
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
with_value(-720) do
|
35
|
-
it_should_raise_an_exception
|
36
|
-
end
|
37
|
-
|
38
|
-
with_value(123.4) do
|
39
|
-
it_should_raise_an_exception
|
40
|
-
end
|
41
|
-
|
42
|
-
with_value(:twelve) do
|
43
|
-
it_should_raise_an_exception
|
44
|
-
end
|
16
|
+
it_should_assign_and_output_xml 720
|
17
|
+
it_should_not_allow_negative_numbers
|
18
|
+
it_should_not_allow_floats
|
19
|
+
it_should_not_allow_invalid_value
|
45
20
|
end
|
46
21
|
|
47
22
|
for_attribute(:restart) do
|
48
|
-
|
49
|
-
|
50
|
-
|
51
|
-
end
|
52
|
-
|
53
|
-
with_value(:newPage) do
|
54
|
-
it_should_assign_successfully
|
55
|
-
it_should_output "<w:lnNumType w:restart=\"newPage\"/>"
|
56
|
-
end
|
57
|
-
|
58
|
-
with_value(:newSection) do
|
59
|
-
it_should_assign_successfully
|
60
|
-
it_should_output "<w:lnNumType w:restart=\"newSection\"/>"
|
61
|
-
end
|
62
|
-
|
63
|
-
with_value(:somethingElse) do
|
64
|
-
it_should_raise_an_exception
|
65
|
-
end
|
23
|
+
values = %i(continuous newPage newSection)
|
24
|
+
it_should_assign_and_output_xml values
|
25
|
+
it_should_not_allow_invalid_value
|
66
26
|
end
|
67
27
|
|
68
28
|
for_attribute(:start) do
|
69
|
-
|
70
|
-
|
71
|
-
|
72
|
-
|
73
|
-
|
74
|
-
with_value(-5) do
|
75
|
-
it_should_assign_successfully
|
76
|
-
it_should_output "<w:lnNumType w:start=\"-5\"/>"
|
77
|
-
end
|
78
|
-
|
79
|
-
with_value(123.4) do
|
80
|
-
it_should_raise_an_exception
|
81
|
-
end
|
82
|
-
|
83
|
-
with_value(:twelve) do
|
84
|
-
it_should_raise_an_exception
|
85
|
-
end
|
29
|
+
values = [5, -5]
|
30
|
+
it_should_assign_and_output_xml values
|
31
|
+
it_should_not_allow_floats
|
32
|
+
it_should_not_allow_invalid_value
|
86
33
|
end
|
87
34
|
|
88
35
|
with_no_attributes_set do
|