Permalink
Switch branches/tags
Nothing to show
Find file
Fetching contributors…
Cannot retrieve contributors at this time
64 lines (51 sloc) 1.67 KB
require File.join(File.dirname(__FILE__), 'spec_helper')
# This is not a validation of my definition of Atom, just a sort of integration test.
describe Objectify::Atom do
before :all do
@feed = Objectify::Atom::Feed.new(sample_feed('wikipedia.atom'))
end
describe 'the feed' do
it 'should have 2 links' do
@feed.links.length.should == 2
end
it 'should have 50 entries' do
@feed.entries.length.should == 50
end
it 'should be generated by Mediawiki' do
@feed.generator.inner_text.should == 'MediaWiki 1.15alpha'
end
end
describe 'the first link' do
it 'should have all attributes' do
link = @feed.links.first
link.rel.should == 'self'
link.type.should == 'application/atom+xml'
# the href has been unescaped.
link.href.should == "http://en.wikipedia.org/w/index.php?title=Special:RecentChanges&feed=atom"
end
end
describe 'the first entry' do
before do
@entry = @feed.entries.first
end
it 'should be updated at...' do
@entry.updated.should == DateTime.parse('2009-02-23T19:08:18')
end
it 'should be titled ...' do
@entry.title.should == 'Audio commentary'
end
it 'should have a summary' do
@entry.summary.length.should == 5692
end
it 'should inspect nicely' do
@entry.inspect.should == '<Objectify::Atom::Entry title, author:Objectify::Atom::Author, id, summary, links:1, updated>'
end
it 'should have the author name' do
@entry.author.name.should == 'Richiekim'
end
it 'should be nil if the element was not included' do
@entry.category.should be_nil
@entry.published.should be_nil
end
end
end