Sha256: f36e139d8021afbb1b3a9ea99bbf090fb34c067ef833970c4e4e9088a4541080

Contents?: true

Size: 791 Bytes

Versions: 5

Compression:

Stored size: 791 Bytes

Contents

require 'spec_helper'

module Dozuki
  describe XML do
    describe "parse" do

      let(:args){["xml", :other, :args]}
      let(:nokogiri_node) {mock "nokogiri node"}
      let(:dozuki_xml_node)  {mock "dozuki xml node"}

      before(:each) do
        Nokogiri::XML.stub(:parse).and_return(nokogiri_node)
        Node.stub(:new).and_return(dozuki_xml_node)
      end

      subject{XML.parse(*args)}

      it "should parse the xml using nokogiri" do
        Nokogiri::XML.should_receive(:parse).with(*args).and_return(nokogiri_node)
        subject
      end

      it "should create a new Node with the nokogiri doc" do
        Node.should_receive(:new).with(nokogiri_node).and_return(dozuki_xml_node)
        subject
      end

      it {should == dozuki_xml_node}

    end
  end
end

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
dozuki-0.4.0 spec/dozuki/xml_spec.rb
dozuki-0.3.0 spec/dozuki/xml_spec.rb
dozuki-0.2.0 spec/dozuki/xml_spec.rb
dozuki-0.1.0 spec/dozuki/xml_spec.rb
dozuki-0.0.3 spec/dozuki/xml_spec.rb