spec/parts/document_spec.rb in rocx-0.6.0 vs spec/parts/document_spec.rb in rocx-0.7.0
- old
+ new
@@ -27,6 +27,69 @@
@doc = described_class.new
end
it_should_output_correct_xml part: "empty_document"
end
+
+ context "with only one section" do
+ before(:each) do
+ @doc = described_class.new
+
+ section = Rocx::Section.new
+ section.bidi = true
+
+ doc << section
+
+ paragraph = Rocx::Elements::Paragraph.new
+
+ first_run = Rocx::Elements::Run.new
+ first_run << Rocx::Elements::Text.new("This is just a test run.")
+ paragraph << first_run
+
+ second_run = Rocx::Elements::Run.new
+ second_run << Rocx::Elements::Text.new("But this isn't!")
+ paragraph << second_run
+
+ doc << paragraph
+ end
+
+ it_should_output_correct_xml part: "document_with_one_section"
+ end
+
+ context "with multiple sections" do
+ before(:each) do
+ @doc = described_class.new
+
+ section = Rocx::Section.new
+ section.bidi = true
+
+ doc << section
+
+ paragraph = Rocx::Elements::Paragraph.new
+
+ first_run = Rocx::Elements::Run.new
+ first_run << Rocx::Elements::Text.new("This is just a test run.")
+ paragraph << first_run
+
+ second_run = Rocx::Elements::Run.new
+ second_run << Rocx::Elements::Text.new("But this isn't!")
+ paragraph << second_run
+
+ doc << paragraph
+
+ section = Rocx::Section.new
+ section.text_direction = :lr
+
+ doc << section
+
+ paragraph = Rocx::Elements::Paragraph.new
+
+ first_run = Rocx::Elements::Run.new
+ first_run << Rocx::Elements::Text.new("This is just a test run.")
+ paragraph << first_run
+
+ doc << paragraph
+ end
+
+ it_should_output_correct_xml part: "document_with_multiple_sections"
+ end
end