received unexpected message :split [ an error in an rspec controller test ]
By: Johnathon Wright on: April 23, 2009
original code:
--- ruby it 'should add a flight given the correct data' do details = Factory.build(:flight).attributes @mockflight.shouldreceive(:save).andreturn(true) Flight.shouldreceive(:new).with(details).andreturn(@mockflight) post 'create', :flight => details response.should redirectto( @mockflight )
end
correction:
- response.should redirectto( @mockflight )
+ response.should redirectto( flighturl(@mock_flight) )
notes: - @mockflight is defined in a before(:all) block. - flighturl is generated by the following line in config/routes.rb: map.resources :flights