Sha256: 873e4e3b5bc87ce5100adfdfec31f5122007fba59b9b02f0c82f8eb18f6fc1d2

Contents?: true

Size: 1.07 KB

Versions: 1

Compression:

Stored size: 1.07 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')).remove_namespaces!.css('metadata').xpath('.//identifier').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')).remove_namespaces!.css('metadata').xpath('.//identifier').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')).remove_namespaces!.css('metadata').xpath('.//identifier').first).to_hash.keys }
      it { should include :identifier }
      it { should include :scheme }
    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/identifier_spec.rb