Sha256: d525aee298956e3dd7e00985ee7a8a1a6da14414b32cfea54f3748e7cef1e5c2

Contents?: true

Size: 1.16 KB

Versions: 1

Compression:

Stored size: 1.16 KB

Contents

require File.join(File.dirname(__FILE__), "..", "..", "spec_helper.rb")

describe Smoke::Output::XML do
  before do
    @tree = :tree
    @items = [
      {:id => 1, :class => "first", :type => "mammal", :animal => "monkey"}, 
      {:id => 2, :class => "second", :type => "mammal", :animal => "elephant"}
    ]
    @xml = Smoke::Output::XML.generate(@tree, @items)
    @document = Nokogiri::XML(@xml)
  end
  
  it "should respond to generate" do
    Smoke::Output::XML.should respond_to(:generate)
  end
  
  it "should start the tree off with a named key" do
    @document.css("tree").should_not be_nil
  end
  
  it "should contain items" do
    @document.css("items").each do |item|
      item.content.should =~ /monkey/
    end
  end
end

describe "Smoke XML output with real data" do
  before :all do
    @url = "http://domain.tld/feed.json"
    FakeWeb.register_uri(@url, :response => File.join(SPEC_DIR, 'supports', 'flickr-photo.json'))
    
    Smoke.data :real_xml_output do
      url "http://domain.tld/feed.json", :type => :json
      path :photos, :photo
    end
  end
  
  it "should not error" do
    Smoke.real_xml_output.output(:xml).should include "<?xml"
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
smoke-0.5.16 spec/smoke/output/xml_spec.rb