require 'spec_helper' module GutenbergRdf class Rdf describe Media do let(:xml) do ' 293684 text/plain; charset=utf-8 2010-02-16T08:29:52.373092 ' end let(:media) { Media.new(REXML::Document.new(xml).elements['rdf:RDF/pgterms:ebook/dcterms:hasFormat/pgterms:file']) } it "expects the file URI" do expect(media.uri).to eql 'http://www.gutenberg.org/ebooks/98765.txt.utf-8' end it "expects the file media type" do expect(media.media_type).to eql 'text/plain' end it "expects the file encoding" do expect(media.encoding).to eql 'utf-8' end it "expects modified to be a DateTime" do expect(media.modified.class).to be DateTime end it "should return the modified datetime" do expect(media.modified.to_s).to eql '2010-02-16T08:29:52-07:00' end end end end