Sha256: f8282b1a3bda3835359c258874664457668c8df1dcca4ba6e67aa34033b54d1a

Contents?: true

Size: 1.03 KB

Versions: 3

Compression:

Stored size: 1.03 KB

Contents

require 'spec_helper'

describe "exactly_match_xml(xml)" do
  subject {
    <<-XML
      <xml>
        <one>1</one>
        <two>2</two>
      </xml>
    XML
  }

  context "when xml is equal with subject" do
    it "should pass" do
      should exactly_match_xml(<<-XML)
        <xml>
          <one>1</one>
          <two>2</two>
        </xml>
      XML
    end
  end

  context "when xml structure is equal with subject but elements have different content" do
    it "should fail" do
      should_not exactly_match_xml(<<-XML)
        <xml>
          <one>4</one>
          <two>5</two>
        </xml>
      XML
    end
  end

  context "when xml has less elements" do
    it "should fail" do
      should_not exactly_match_xml(<<-XML)
        <xml>
          <one>1</one>
        </xml>
      XML
    end
  end

  context "when xml has more elements" do
    it "should fail" do
      should_not exactly_match_xml(<<-XML)
        <xml>
          <one>1</one>
          <two>2</two>
          <three>3</three>
        </xml>
      XML
    end
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
test_xml-0.0.4 spec/lib/test_xml/spec/matchers/exactly_match_xml_spec.rb
test_xml-0.0.3 spec/lib/test_xml/spec/matchers/exactly_match_xml_spec.rb
test_xml-0.0.2 spec/lib/test_xml/spec/matchers/exactly_match_xml_spec.rb