Sha256: d6351e0e5a7e6c70efede641fcd0761026b0fdc546711e343bc45a7c6c88d32f
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::Language" do before(:each) do data_path = File.join(File.dirname(__FILE__),"..","data") file1 = File.join(data_path, "language.xml") @doc = Nokogiri::XML::Document.parse(File.read(file1)) @root = @doc.root end specify "should correctly convert to a string" do lan = ONIX::Language.from_xml(@root.to_s) lan.to_xml.to_s[0,10].should eql("<Language>") end specify "should provide read access to first level attibutes" do lan = ONIX::Language.from_xml(@root.to_s) lan.language_role.should eql(1) lan.language_code.should eql("eng") lan.country_code.should eql("US") end specify "should provide write access to first level attibutes" do lan = ONIX::Language.new lan.language_role = 2 lan.to_xml.to_s.include?("<LanguageRole>02</LanguageRole>").should be_true lan.language_code = "aar" lan.to_xml.to_s.include?("<LanguageCode>aar</LanguageCode>").should be_true lan.country_code = "AD" lan.to_xml.to_s.include?("<CountryCode>AD</CountryCode>").should be_true end end
Version data entries
5 entries across 5 versions & 2 rubygems
Version | Path |
---|---|
onix-0.8.3 | spec/language_spec.rb |
milkfarm-onix-0.8.3 | spec/language_spec.rb |
onix-0.8.2 | spec/language_spec.rb |
onix-0.8.1 | spec/language_spec.rb |
onix-0.8.0 | spec/language_spec.rb |