Sha256: 0129276dc80907b8419fdb8756d9f2709896900804b002fc963c051ee6606412

Contents?: true

Size: 1.93 KB

Versions: 1

Compression:

Stored size: 1.93 KB

Contents

# frozen_string_literal: true

################################################
# © Alexander Semyonov, 2011—2013, MIT License #
# Author: Alexander Semyonov <al@semyonov.us>  #
################################################

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) { described_class.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

1 entries across 1 versions & 1 rubygems

Version Path
xommelier-0.1.35 spec/functional/xommelier/open_search/description/building_spec.rb