Sha256: 1f9034957bb1dd0310bed0add46e99a4aea0e02962b426cf5e4285bc4ed96685

Contents?: true

Size: 1.27 KB

Versions: 3

Compression:

Stored size: 1.27 KB

Contents

require 'spec_helper'

describe 'Atom feed building' do
  let(:feed) do
    Xommelier::Atom::Feed.new.tap do |feed|
      feed.id = 'urn:uuid:60a76c80-d399-11d9-b93C-0003939e0af6'
      feed.title = 'Example Feed'
      feed.link = Xommelier::Atom::Link.new(href: 'http://example.org/')
      feed.updated = Time.utc(2003, 12, 13, 18, 30, 02)
      feed.author = Xommelier::Atom::Person.new(name: 'John Doe')
      feed.entry = Xommelier::Atom::Entry.new(
        title: 'Atom-Powered Robots Run Amok',
        id: 'urn:uuid:1225c695-cfb8-4ebb-aaaa-80da344efa6a',
        updated: Time.utc(2003, 12, 13, 18, 30, 02),
        summary: 'Some text.'
      ).tap do |entry|
        entry.link = Xommelier::Atom::Link.new(href: 'http://example.org/2003/12/13/atom03')
      end
    end
  end

  let(:built_xml)  { feed.to_xml }
  let(:parsed_xml) { Nokogiri::XML(built_xml) }
  let(:rng)        { Nokogiri::XML::RelaxNG(load_xml_file('atom.rng')) }
  let(:xsd)        { Nokogiri::XML::Schema(load_xml_file('atom.xsd')) }

  subject { built_xml }

  it { feed.should be_valid }

  it { should == load_xml_file('simple_feed.atom').read }
  it('should conform to RelaxNG schema') { rng.valid?(parsed_xml).should == true }
  it('should conform to XML Schema') { xsd.valid?(parsed_xml).should == true }
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
xommelier-0.1.11 spec/functional/atom_feed_building_spec.rb
xommelier-0.1.10 spec/functional/atom_feed_building_spec.rb
xommelier-0.1.9 spec/functional/atom_feed_building_spec.rb