require "spec_helper" describe OpenXml::Docx::Properties::LatentStyles do include PropertyTestMacros it_should_use tag: :latentStyles, name: "latent_styles" context "when trying to add exceptions, it" do before(:each) do @instance = described_class.new end it "should raise an exception if the exception to be added isn't an exception at all" do expect { instance << [] }.to raise_error(ArgumentError) end end context "when there are no exceptions" do before(:each) do @instance = described_class.new end it "should still output its XML" do expect(xml(instance)).to eq("") end end context "when there are exceptions" do before(:each) do @instance = described_class.new instance << OpenXml::Docx::Properties::LatentStylesException.new("StyleName1") instance << OpenXml::Docx::Properties::LatentStylesException.new("StyleName2") end it "should output the correct XML" do expect(xml(instance)).to eq("\n \n \n ") end end for_attribute(:count) do before(:each) do @instance = described_class.new end context "when the value is 1" do before(:each) do @value = 1 end it "should accept the value" do expect { instance.send("#{attribute}=", value) }.to_not raise_error end it "should output the correct value" do instance.send("#{attribute}=", value) expect(xml(instance)).to eq("") end end with_value(-1) do it_should_raise_an_exception end with_value(1.3) do it_should_raise_an_exception end with_value(:a_lot) do it_should_raise_an_exception end end for_attribute(:default_locked_state) do before(:each) do @instance = described_class.new end context "when the value is true" do before(:each) do @value = true end it "should accept the value" do expect { instance.send("#{attribute}=", value) }.to_not raise_error end it "should output the correct value" do instance.send("#{attribute}=", value) expect(xml(instance)).to eq("") end end end for_attribute(:default_qformat) do before(:each) do @instance = described_class.new end context "when the value is true" do before(:each) do @value = true end it "should accept the value" do expect { instance.send("#{attribute}=", value) }.to_not raise_error end it "should output the correct value" do instance.send("#{attribute}=", value) expect(xml(instance)).to eq("") end end end for_attribute(:default_semi_hidden) do before(:each) do @instance = described_class.new end context "when the value is true" do before(:each) do @value = true end it "should accept the value" do expect { instance.send("#{attribute}=", value) }.to_not raise_error end it "should output the correct value" do instance.send("#{attribute}=", value) expect(xml(instance)).to eq("") end end end for_attribute(:default_ui_priority) do before(:each) do @instance = described_class.new end context "when the value is 1" do before(:each) do @value = 1 end it "should accept the value" do expect { instance.send("#{attribute}=", value) }.to_not raise_error end it "should output the correct value" do instance.send("#{attribute}=", value) expect(xml(instance)).to eq("") end end context "when the value is -1" do before(:each) do @value = -1 end it "should accept the value" do expect { instance.send("#{attribute}=", value) }.to_not raise_error end it "should output the correct value" do instance.send("#{attribute}=", value) expect(xml(instance)).to eq("") end end with_value(1.3) do it_should_raise_an_exception end with_value(:a_lot) do it_should_raise_an_exception end end for_attribute(:default_unhide_when_used) do before(:each) do @instance = described_class.new end context "when the value is true" do before(:each) do @value = true end it "should accept the value" do expect { instance.send("#{attribute}=", value) }.to_not raise_error end it "should output the correct value" do instance.send("#{attribute}=", value) expect(xml(instance)).to eq("") end end end # for_attribute(:equal_width) do # before(:each) do # @instance = described_class.new # @instance << OpenXml::Docx::Properties::Column.new(1, 1) # end # # context "when the value is true" do # before(:each) do # @value = true # end # # it "should accept the value" do # expect { instance.send("#{attribute}=", value) }.to_not raise_error # end # # it "should output the correct value" do # instance.send("#{attribute}=", value) # expect(xml(instance)).to eq("\n \n ") # end # end # # for_attribute(:number) do # before(:each) do # @instance = described_class.new # @instance << OpenXml::Docx::Properties::Column.new(1, 1) # end # # context "when the value is 1" do # before(:each) do # @value = 1 # end # # it "should accept the value" do # expect { instance.send("#{attribute}=", value) }.to_not raise_error # end # # it "should output the correct value" do # instance.send("#{attribute}=", value) # expect(xml(instance)).to eq("\n \n ") # end # end # # context "when the value is -1" do # before(:each) do # @value = -1 # end # # it "should accept the value" do # expect { instance.send("#{attribute}=", value) }.to_not raise_error # end # # it "should output the correct value" do # instance.send("#{attribute}=", value) # expect(xml(instance)).to eq("\n \n ") # end # end # # with_value(1.3) do # it_should_raise_an_exception # end # # with_value(:a_lot) do # it_should_raise_an_exception # end # end # # for_attribute(:separator) do # before(:each) do # @instance = described_class.new # @instance << OpenXml::Docx::Properties::Column.new(1, 1) # end # # context "when the value is true" do # before(:each) do # @value = true # end # # it "should accept the value" do # expect { instance.send("#{attribute}=", value) }.to_not raise_error # end # # it "should output the correct value" do # instance.send("#{attribute}=", value) # expect(xml(instance)).to eq("\n \n ") # end # end # end # # for_attribute(:space) do # before(:each) do # @instance = described_class.new # @instance << OpenXml::Docx::Properties::Column.new(1, 1) # end # # context "when the value is 1" do # before(:each) do # @value = 1 # end # # it "should accept the value" do # expect { instance.send("#{attribute}=", value) }.to_not raise_error # end # # it "should output the correct value" do # instance.send("#{attribute}=", value) # expect(xml(instance)).to eq("\n \n ") # end # end # # context "when the value is -1" do # before(:each) do # @value = -1 # end # # it "should accept the value" do # expect { instance.send("#{attribute}=", value) }.to_not raise_error # end # # it "should output the correct value" do # instance.send("#{attribute}=", value) # expect(xml(instance)).to eq("\n \n ") # end # end # # with_value(1.3) do # it_should_raise_an_exception # end # # with_value(:a_lot) do # it_should_raise_an_exception # end # end # end end