Sha256: e466bf508b99fcf0017289e4079b0ee6b1140f40ec90f5eb7723389f8d004f53

Contents?: true

Size: 1.71 KB

Versions: 5

Compression:

Stored size: 1.71 KB

Contents

require 'spec_helper'

describe Xommelier::OpenSearch::Description do
  describe '.to_xml' do
    let(:hash) do
      {
        short_name:        'Web Search',
        description:       'Use Example.com to search the Web.',
        urls:              [{template: 'http://example.com/?q={searchTerms}&pw={startPage?}&format=atom',
                             type:     'application/atom+xml'},
                            {template: 'http://example.com/?q={searchTerms}&pw={startPage?}&format=rss',
                             type:     'application/rss+xml'},
                            {template: 'http://example.com/?q={searchTerms}&pw={startPage?}',
                             type:     'text/html'}],
        query:             {role: 'example', search_terms: 'cat'},
        tags:              'example web',
        contact:           'admin@example.com',
        long_name:         'Example.com Web Search',
        developer:         'Example.com Development Team',
        attribution:       "\n    Search data Copyright 2005, Example.com, Inc., All Rights Reserved\n  ",
        syndication_right: 'open',
        language:          'en-us',
        input_encoding:    'UTF-8',
        output_encoding:   'UTF-8',
        adult_content:     false,
        images:            [{height: 64, width: 64, type: 'image/png', text: 'http://example.com/websearch.png'},
                            {height: 16, width: 16, type: 'image/vnd.microsoft.icon', text: 'http://example.com/websearch.ico'}]
      }
    end
    subject(:description) { Xommelier::OpenSearch::Description.new(hash) }

    its(:to_hash) { should == hash }
    it_behaves_like 'Valid XML Document'
    its(:to_xml) { should == load_xml_file('opensearch.full') }
  end
end

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
xommelier-0.1.30 spec/functional/xommelier/open_search/description/building_spec.rb
xommelier-0.1.29 spec/functional/xommelier/open_search/description/building_spec.rb
xommelier-0.1.28 spec/functional/xommelier/open_search/description/building_spec.rb
xommelier-0.1.27 spec/functional/xommelier/open_search/description/building_spec.rb
xommelier-0.1.26 spec/functional/xommelier/open_search/description/building_spec.rb