Sha256: 1159f03d6c2f9e872ca4f8ead880d84fc8347fe76364012c5822de6f602bc20b

Contents?: true

Size: 1.07 KB

Versions: 5

Compression:

Stored size: 1.07 KB

Contents

require 'spec_helper'
require 'medie'

describe Medie::OpenSearch::Descriptor do
   
  context "unmarshalling one url documents" do
  
    before do
      xml = '<?xml version="1.0" encoding="UTF-8"?>
      <OpenSearchDescription xmlns="http://a9.com/-/spec/opensearch/1.1/">
        <ShortName>Restbuy</ShortName>
        <Description>Restbuy search engine.</Description>
        <Tags>restbuy</Tags>
        <Contact>admin@restbuy.com</Contact>
        <Url type="application/atom+xml"  template="http://localhost:3000/products?q={searchTerms}&amp;pw={startPage?}&amp;format=atom" />
      </OpenSearchDescription>'
      @descriptor = Medie::OpenSearch::Driver.new.unmarshal(xml)
    end
  
    it "should unmarshall opensearch xml descriptions" do
      @descriptor.use("application/atom+xml").host.should == URI.parse("http://localhost:3000/products")
      @descriptor.use("application/atom+xml").params_pattern.should == "q={searchTerms}&pw={startPage?}&format=atom"
      @descriptor.use("application/atom+xml").headers["Accept"].should == "application/atom+xml"
    end
  
  end

end

Version data entries

5 entries across 5 versions & 2 rubygems

Version Path
restfulie-nosqlite-1.0.4 spec/unit/client/ext/open_search_spec.rb
restfulie-1.1.1 spec/unit/client/ext/open_search_spec.rb
restfulie-1.1.0 spec/unit/client/ext/open_search_spec.rb
restfulie-nosqlite-1.0.3 spec/unit/client/ext/open_search_spec.rb
restfulie-1.0.3 spec/unit/client/ext/open_search_spec.rb