Skip to content

Instantly share code, notes, and snippets.

@greggersh
Created May 22, 2012 19:20
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save greggersh/2771074 to your computer and use it in GitHub Desktop.
Save greggersh/2771074 to your computer and use it in GitHub Desktop.
Stubbing Nokogiri
doc = Nokogiri::XML(open(Rails.root + 'spec/support/tesoriere.xml'))
Nokogiri::XML::Document.stub!(:parse)
Nokogiri::XML::Document.should_receive(:parse).and_return(doc)
# from http://tesoriere.com/2011/05/19/testing-with-remote-xml-in-rails-3.1-using-nokogiri-and-stubs/
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment