Sha256: 1b0376b5d23c10773e59c9cf78495cae828a2ec727a081a11fe2b87091625ac4

Contents?: true

Size: 955 Bytes

Versions: 5

Compression:

Stored size: 955 Bytes

Contents

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

describe ApricotEatsGorilla do
  include SpecHelper

  # setup
  describe "setup" do
    it "yields self to a given block" do
      ApricotEatsGorilla.setup do |yielded|
        yielded.should == ApricotEatsGorilla
      end
    end
  end

  # []
  describe "[]" do
    before { reset_library_options }

    it "converts a given XML into a Hash" do
      xml = "<root><name>Jungle Julia</name></root>"
      ApricotEatsGorilla[xml].should == { :name => "Jungle Julia" }
    end

    it "converts a given XML with a custom root node into a Hash" do
      xml = "<root><something><name>Jungle Julia</name></something></root>"
      ApricotEatsGorilla[xml, "//something"].should == { :name => "Jungle Julia" }
    end

    it "converts a given Hash into XML" do
      hash = { "apricot" => "eats gorilla" }
      ApricotEatsGorilla[hash] == "<apricot>eats gorilla</apricot>"
    end
  end

end

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
apricoteatsgorilla-0.5.13 spec/apricoteatsgorilla/apricoteatsgorilla_spec.rb
apricoteatsgorilla-0.5.12 spec/apricoteatsgorilla/apricoteatsgorilla_spec.rb
apricoteatsgorilla-0.5.11 spec/apricoteatsgorilla/apricoteatsgorilla_spec.rb
apricoteatsgorilla-0.5.10 spec/apricoteatsgorilla/apricoteatsgorilla_spec.rb
apricoteatsgorilla-0.5.9 spec/apricoteatsgorilla/apricoteatsgorilla_spec.rb