Sha256: 57114957a9226f2303cd49c03df424ba71cf4f6912493f1c3d12e2edcff86580

Contents?: true

Size: 1.1 KB

Versions: 4

Compression:

Stored size: 1.1 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')).css('metadata').xpath('.//dc: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')).css('metadata').xpath('.//dc: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')).css('metadata').xpath('.//dc:creator').first).to_hash.keys }
      it { should include :name }
      it { should include :file_as }
      it { should include :role }
    end
  end
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
epubinfo-0.3.0 spec/lib/epubinfo/models/person_spec.rb
epubinfo-0.2.4 spec/lib/epubinfo/models/person_spec.rb
epubinfo-0.2.3 spec/lib/epubinfo/models/person_spec.rb
epubinfo-0.2.2 spec/lib/epubinfo/models/person_spec.rb