Sha256: c6301b684759e5d8c3e1c7379e0c021a0730798163473cd2e814e4ad2cff1832
Contents?: true
Size: 1.11 KB
Versions: 5
Compression:
Stored size: 1.11 KB
Contents
# coding: utf-8 require File.dirname(__FILE__) + '/spec_helper.rb' context "ONIX::Title" do before(:each) do data_path = File.join(File.dirname(__FILE__),"..","data") file1 = File.join(data_path, "title.xml") @doc = Nokogiri::XML::Document.parse(File.read(file1)) @root = @doc.root end specify "should correctly convert to a string" do t = ONIX::Title.from_xml(@root.to_s) t.to_xml.to_s[0,7].should eql("<Title>") end specify "should provide read access to first level attibutes" do t = ONIX::Title.from_xml(@root.to_s) t.title_type.should eql(1) t.title_text.should eql("Good Grief") t.subtitle.should eql("A Constructive Approach to the Problem of Loss") end specify "should provide write access to first level attibutes" do t = ONIX::Title.new t.title_type = 1 t.to_xml.to_s.include?("<TitleType>01</TitleType>").should be_true t.title_text = "Good Grief" t.to_xml.to_s.include?("<TitleText>Good Grief</TitleText>").should be_true t.subtitle = "Blah" t.to_xml.to_s.include?("<Subtitle>Blah</Subtitle>").should be_true end end
Version data entries
5 entries across 5 versions & 2 rubygems
Version | Path |
---|---|
onix-0.8.3 | spec/title_spec.rb |
milkfarm-onix-0.8.3 | spec/title_spec.rb |
onix-0.8.2 | spec/title_spec.rb |
onix-0.8.1 | spec/title_spec.rb |
onix-0.8.0 | spec/title_spec.rb |