If I have a javascript ajax request happening that fetches json data
from a remote service, and I want to be running an integration test with
rspec-- what would be the best way to stub out that service?
The ideas that I've come up is:
manually add a route + open up application controller from within my
spec and dynamically create an action that returns mock json... Then
make my .js a .js.erb file, and do something like:
$.ajax({ url: <%= Rails.env.test? ?
"/my_added_route_that_hits_the_controller_method_that_returns_json" :
"http://somewebservice.com/feed" %> });
Can anyone come up with any better solutions?
Patrick J. Collins
http://collinatorstudios.com
_______________________________________________
rspec-users mailing list
[email protected]
http://rubyforge.org/mailman/listinfo/rspec-users