require 'spec_helper' describe "contain_xml(xml)" do subject { <<-XML 1 2 XML } context "when xml is equal" do it "should pass" do should contain_xml(<<-XML) 1 2 XML end end context "when xml has less elements" do it "should pass" do should contain_xml(<<-XML) 1 XML end end context "when xml structure is equal but elements have different content" do it "should fail" do should_not contain_xml(<<-XML) 4 5 XML end end context "when xml has more elements" do it "should fail" do should_not contain_xml(<<-XML) 1 2 3 XML end end context "when xml has elements with the same name within parent element" do subject { <<-XML one two XML } it "should pass" do should contain_xml(<<-XML) one two XML end end end