Sha256: e9c703394ebdc09b5876e9257937cc971989eac088f56f480edf5e2b7669197d

Contents?: true

Size: 1.11 KB

Versions: 4

Compression:

Stored size: 1.11 KB

Contents

require 'spec_helper'

describe EPUBInfo::Models::Identifier do
  describe '#initialize' do
    context 'EPUB2' do
      subject { EPUBInfo::Models::Identifier.new(Nokogiri::XML(File.new('spec/support/xml/metamorphosis_metadata_epub2.opf')).css('metadata').xpath('.//dc:identifier', EPUBInfo::Utils::DC_NAMESPACE).first) }

      its(:identifier) { should == 'http://www.gutenberg.org/ebooks/5200' }
      its(:scheme) { should == 'URI' }
    end

    context 'EPUB3' do
      subject { EPUBInfo::Models::Identifier.new(Nokogiri::XML(File.new('spec/support/xml/wasteland_metadata_epub3.opf')).css('metadata').xpath('.//dc:identifier', EPUBInfo::Utils::DC_NAMESPACE).first) }

      its(:identifier) { should == 'code.google.com.epub-samples.wasteland-basic' }
    end
  end

  describe '#to_hash' do
    context 'keys' do
      subject { EPUBInfo::Models::Identifier.new(Nokogiri::XML(File.new('spec/support/xml/metamorphosis_metadata_epub2.opf')).css('metadata').xpath('.//dc:identifier', EPUBInfo::Utils::DC_NAMESPACE).first).to_hash.keys }
      it { should include :identifier }
      it { should include :scheme }
    end
  end
end

Version data entries

4 entries across 4 versions & 1 rubygems

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