Sha256: 5ccaad9cb18f878646d81bb4808406bb3e0c769dbeff110426ef1e60b15ab9d6

Contents?: true

Size: 1.7 KB

Versions: 6

Compression:

Stored size: 1.7 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 { should be_valid }
    its(:to_xml) { should == load_xml_file('opensearch.full') }
  end
end

Version data entries

6 entries across 6 versions & 1 rubygems

Version Path
xommelier-0.1.25 spec/functional/xommelier/open_search/description/building_spec.rb
xommelier-0.1.24 spec/functional/xommelier/open_search/description/building_spec.rb
xommelier-0.1.23 spec/functional/xommelier/open_search/description/building_spec.rb
xommelier-0.1.22 spec/functional/xommelier/open_search/description/building_spec.rb
xommelier-0.1.21 spec/functional/xommelier/open_search/description/building_spec.rb
xommelier-0.1.20 spec/functional/xommelier/open_search/description/building_spec.rb