Sha256: 45b61e2b647fed6ca20a4161018ae41ae4cf8e06674128af879ba77c383ce4f2

Contents?: true

Size: 1.95 KB

Versions: 2

Compression:

Stored size: 1.95 KB

Contents

# coding: utf-8
# 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

2 entries across 2 versions & 1 rubygems

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