Sha256: 953bf6b17a7ff44e957af7bad926ce1d15e58021d512bb552c8c0641a47451dc

Contents?: true

Size: 1.15 KB

Versions: 1

Compression:

Stored size: 1.15 KB

Contents

require 'spec_helper'

describe EPUBInfo::Models::Person do
  describe '#initialize' do
    context 'creator' do
      subject { EPUBInfo::Models::Person.new(Nokogiri::XML(File.new('spec/support/xml/metamorphosis_metadata_epub2.opf')).remove_namespaces!.css('metadata').xpath('.//creator').first) }

      its(:name) { should == 'Franz Kafka' }
      its(:file_as) { should == 'Kafka, Franz' }
      its(:role) { should be_nil }
    end

    context 'contributor' do
      subject { EPUBInfo::Models::Person.new(Nokogiri::XML(File.new('spec/support/xml/metamorphosis_metadata_epub2.opf')).remove_namespaces!.css('metadata').xpath('.//contributor').first) }

      its(:name) { should == 'David Wyllie' }
      its(:file_as) { should == 'Wyllie, David' }
      its(:role) { should == 'trl' }
    end
  end

  describe '#initialize' do
    context 'keys' do
      subject { EPUBInfo::Models::Person.new(Nokogiri::XML(File.new('spec/support/xml/metamorphosis_metadata_epub2.opf')).remove_namespaces!.css('metadata').xpath('.//creator').first).to_hash.keys }
      it { should include :name }
      it { should include :file_as }
      it { should include :role }
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
epubinfo_with_toc-0.5.7 spec/lib/epubinfo/models/person_spec.rb