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.
> 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.
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.
> Some code example would be helpfull to give a return back
> Sent from my iPhone
> On 3 Nov 2009, at 14:28, doug livesey <biot...@gmail.com> 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.
> 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.
> Some code example would be helpfull to give a return back
> Sent from my iPhone
> On 3 Nov 2009, at 14:28, doug livesey <biot...@gmail.com> 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.