On Rails RSS

Looking at Ruby on Rails from a BDD perspective.
Jul
19th
Thu
permalink

Getting to the internals

What if you want to write an example of behaviour which is internal to the class. You can use the mock framework to set expectations or you can expose the the internals. I do not mind modifying the code and making things public to make it testable, however I like the way I can just open a class in my examples. I can leave the production code as is and still be able to look at the internals of the class.


module PaymentSpecHelper
  Payment.send(:define_method, :gateway){@gateway}
end
include PaymentSpecHelper

Webfeed (RSS/ATOM/RDF) registered at http://www.feeds4all.com