I’ve just started a new project so I’m starting with 1.2RC and the experimenting with BDD with rspec.
I won’t delve into either as folks with more FU than myself have explored both topics.
Specifically though I have run into problems with rspec and the new simply_helpful - thankfully Lourens of methodmissing has nailed down a monkey patch.
Laurens also supplies a monkey patch to permit testing of various return types - but, alas, since rspec is maturing at the speed of light it doesn’t work with rspec 0.7.4.
Following is a mod of Lauren’s patch that’ll get your specifies testing RSS, XML, et al.
1 2 3 4 5 6 7 8 9 |
class Test::Unit::TestCase %w(get put post head delete).each{|m| define_method(m.to_sym) do |*args| @request.env['REQUEST_METHOD'] = m.upcase @request.env['CONTENT_TYPE'] = Mime::EXTENSION_LOOKUP[(args[2].nil? ? 'html' : args[2].to_s )] process( args[0], args[1] || {} ) end } end |
put this in your spechelper.rb, after require ‘rspecon_rails’ and before your Test::Rails::Testcase definition.


November 12th, 2008 at 10:02 PM
x0hu22dy56awftst