Sha256: 5da3f07b841660801c1e8c7b6481781f66242c42d6852eb3082a8e7c99313cc6

Contents?: true

Size: 1.05 KB

Versions: 1

Compression:

Stored size: 1.05 KB

Contents

require File.dirname(__FILE__) + '/../../spec_helper'

describe "OEmbed::Formatter::XML::Backends::XmlSimple" do
  include OEmbedSpecHelper

  before(:all) do
    lambda {
      OEmbed::Formatter::XML.backend = 'XmlSimple'
    }.should raise_error(LoadError)
    
    require 'xmlsimple'
    
    lambda {
      OEmbed::Formatter::XML.backend = 'XmlSimple'
    }.should_not raise_error
  end

  it "should support XML" do
    proc { OEmbed::Formatter.supported?(:xml) }.
    should_not raise_error(OEmbed::FormatNotSupported)
  end
  
  it "should be using the XmlSimple backend" do
    OEmbed::Formatter::XML.backend.should == OEmbed::Formatter::XML::Backends::XmlSimple
  end
  
  it "should decode an XML String" do
    decoded = OEmbed::Formatter.decode(:xml, valid_response(:xml))
    # We need to compare keys & values separately because we don't expect all
    # non-string values to be recognized correctly.
    decoded.keys.should == valid_response(:object).keys
    decoded.values.map{|v|v.to_s}.should == valid_response(:object).values.map{|v|v.to_s}
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
ruby-oembed-0.8.1 spec/formatter/xml/xmlsimple_backend_spec.rb