spec/bamboo-client/http/xml_spec.rb in bamboo-client-0.0.3 vs spec/bamboo-client/http/xml_spec.rb in bamboo-client-0.0.4

- old
+ new

@@ -17,12 +17,12 @@ doc.should be_kind_of(Xml::Doc) end end describe Xml::Doc do - let(:wrapped) { - m = mock("nokogiri document") + let(:wrapped) { + m = mock("nokogiri document") m.stub!(:css).with("errors error").and_return [] m } let(:doc) { Xml::Doc.new(wrapped)} @@ -30,9 +30,14 @@ wrapped.should_receive(:css). with("some selector"). and_return(mock("node", :text => "bar")) doc.text_for("some selector").should == "bar" + end + + it "checks for errors in the given document" do + wrapped.should_receive(:css).with("errors error").and_return [mock(:text => "error!")] + lambda { doc.text_for "some selector" }.should raise_error(Bamboo::Client::Error) end it "returns an instance of the given class for each node matching the selector" do wrapped.should_receive(:css).with("selector").and_return(['node1', 'node2'])