spec/properties/indentation_spec.rb in openxml-docx-0.8.0 vs spec/properties/indentation_spec.rb in openxml-docx-0.9.0
- old
+ new
@@ -4,166 +4,62 @@
include PropertyTestMacros
it_should_use tag: :ind, name: "indentation"
for_attribute(:end) do
- with_value(1220) do
- it_should_assign_successfully
- it_should_output "<w:ind w:end=\"1220\"/>"
- end
-
- with_value(-1220) do
- it_should_assign_successfully
- it_should_output "<w:ind w:end=\"-1220\"/>"
- end
-
- with_value(1220.3) do
- it_should_raise_an_exception
- end
-
- with_value(:bad) do
- it_should_raise_an_exception
- end
+ values = [1220, -1220]
+ it_should_assign_and_output_xml values
+ it_should_not_allow_floats
+ it_should_not_allow_invalid_value
end
for_attribute(:end_characters) do
- with_value(1220) do
- it_should_assign_successfully
- it_should_output "<w:ind w:endChars=\"1220\"/>"
- end
-
- with_value(-1220) do
- it_should_assign_successfully
- it_should_output "<w:ind w:endChars=\"-1220\"/>"
- end
-
- with_value(1220.3) do
- it_should_raise_an_exception
- end
-
- with_value(:bad) do
- it_should_raise_an_exception
- end
+ values = [1220, -1220]
+ it_should_assign_and_output_xml values
+ it_should_not_allow_floats
+ it_should_not_allow_invalid_value
end
for_attribute(:first_line) do
- with_value(1220) do
- it_should_assign_successfully
- it_should_output "<w:ind w:firstLine=\"1220\"/>"
- end
-
- with_value(-1220) do
- it_should_assign_successfully
- it_should_output "<w:ind w:firstLine=\"-1220\"/>"
- end
-
- with_value(1220.3) do
- it_should_raise_an_exception
- end
-
- with_value(:bad) do
- it_should_raise_an_exception
- end
+ values = [1220, -1220]
+ it_should_assign_and_output_xml values
+ it_should_not_allow_floats
+ it_should_not_allow_invalid_value
end
for_attribute(:first_line_characters) do
- with_value(1220) do
- it_should_assign_successfully
- it_should_output "<w:ind w:firstLineChars=\"1220\"/>"
- end
-
- with_value(-1220) do
- it_should_assign_successfully
- it_should_output "<w:ind w:firstLineChars=\"-1220\"/>"
- end
-
- with_value(1220.3) do
- it_should_raise_an_exception
- end
-
- with_value(:bad) do
- it_should_raise_an_exception
- end
+ values = [1220, -1220]
+ it_should_assign_and_output_xml values
+ it_should_not_allow_floats
+ it_should_not_allow_invalid_value
end
for_attribute(:hanging) do
- with_value(1220) do
- it_should_assign_successfully
- it_should_output "<w:ind w:hanging=\"1220\"/>"
- end
-
- with_value(-1220) do
- it_should_assign_successfully
- it_should_output "<w:ind w:hanging=\"-1220\"/>"
- end
-
- with_value(1220.3) do
- it_should_raise_an_exception
- end
-
- with_value(:bad) do
- it_should_raise_an_exception
- end
+ values = [1220, -1220]
+ it_should_assign_and_output_xml values
+ it_should_not_allow_floats
+ it_should_not_allow_invalid_value
end
for_attribute(:hanging_characters) do
- with_value(1220) do
- it_should_assign_successfully
- it_should_output "<w:ind w:hangingChars=\"1220\"/>"
- end
-
- with_value(-1220) do
- it_should_assign_successfully
- it_should_output "<w:ind w:hangingChars=\"-1220\"/>"
- end
-
- with_value(1220.3) do
- it_should_raise_an_exception
- end
-
- with_value(:bad) do
- it_should_raise_an_exception
- end
+ values = [1220, -1220]
+ it_should_assign_and_output_xml values
+ it_should_not_allow_floats
+ it_should_not_allow_invalid_value
end
for_attribute(:start) do
- with_value(1220) do
- it_should_assign_successfully
- it_should_output "<w:ind w:start=\"1220\"/>"
- end
-
- with_value(-1220) do
- it_should_assign_successfully
- it_should_output "<w:ind w:start=\"-1220\"/>"
- end
-
- with_value(1220.3) do
- it_should_raise_an_exception
- end
-
- with_value(:bad) do
- it_should_raise_an_exception
- end
+ values = [1220, -1220]
+ it_should_assign_and_output_xml values
+ it_should_not_allow_floats
+ it_should_not_allow_invalid_value
end
for_attribute(:start_characters) do
- with_value(1220) do
- it_should_assign_successfully
- it_should_output "<w:ind w:startChars=\"1220\"/>"
- end
-
- with_value(-1220) do
- it_should_assign_successfully
- it_should_output "<w:ind w:startChars=\"-1220\"/>"
- end
-
- with_value(1220.3) do
- it_should_raise_an_exception
- end
-
- with_value(:bad) do
- it_should_raise_an_exception
- end
+ values = [1220, -1220]
+ it_should_assign_and_output_xml values
+ it_should_not_allow_floats
+ it_should_not_allow_invalid_value
end
with_no_attributes_set do
it_should_output "", assign: false
end