mocking

Testing part of a method with rspec

In this usps ruby gem, how should we write the following address specs: it "should build the HTTP request" # given a hard-coded address it "should parse the XML response" # given a hard-coded response I know how to get the specs to work by breaking the standardize function up into parts, but I don't want to do that because it's unnece...

RSpec - generic failure message instead of useful output

This is using RSpec2 - no matter what happens I seem to get the following error when an expectation is not matched. I'm sure (though I cannot try for a while) in version 1 the following code would state that the method 'methods' was not called. The code snippet below demo's this problem - when un-commenting the method in initialize, the...

Can you recommend me a way to create a sample portion of a data-base as an xml file to be consumed by Unit Tests?

Hi, Can you recommend me a way or tell me the most common practice to create a sample portion of a data-base as an xml file so that I can use it from my unit tests without worrying about Db state to be persistent? Is there any frame work to overcome such a scenerio including the functionality that after each test I can get back to the ...

How do you mock out a static method of a domain object in Grails?

have a Grails domain object that has a custom static function to grab data from the database class Foo { /* member variables, mapping, constraints, etc. */ static findByCustomCriteria(someParameter, List listParameter) { /* code to get stuff from the database... */ /* Return value is a map ...