Sure -- the class looks like this:

class PreTimesheet < ActiveResource::Base
  self.site = 'http://localhost:3000/remote_admin'
  self.user = 'user'
  self.password = 'password'
  self.format = :json
end

And one of my efforts to stub the return values looks like this:

class PreTimesheet < ActiveResource::Base
  self.format = :json
  self.site = "file://public/pre_timesheets"
end

(Where there is a set of RESTful files describing the resource under
public/pre_timesheets, eg: pre_timesheets/pre_timesheets.json,
pre_timesheets/pre_timesheets/1.json, etc.)
I didn't expect my effort outlined above to work, but that's the sort of
thing I've been reduced to trying!
Cheers,
   Doug.



2009/11/3 Alex Barlow <[email protected]>

>
> Some code example would be helpfull to give a return back
>
> Sent from my iPhone
>
> On 3 Nov 2009, at 14:28, doug livesey <[email protected]> wrote:
>
> > Hi -- I have an ActiveResource class in my rails app that I want to
> > test in Cucumber.
> > The best way I can think of to do this is just to swap in the JSON
> > that the web service returns with my own controlled JSON data.
> > Can this be done, that anyone knows of?
> > &, if not, is there a better way to be trying to do this?
> > Cheers,
> >    Doug.
> >
> > >
>
> >
>

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"NWRUG" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to 
[email protected]
For more options, visit this group at 
http://groups.google.com/group/nwrug-members?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to