Google Mail Calendar Documents Reader Web more »
Recently Visited Groups | Help | Sign in
Google Groups Home
Using ActiveResource classes in Cucumber -- stubbing the JSON returned? Or something ...
There are currently too many topics in this group that display first. To make this topic appear first, remove this option from another topic.
There was an error processing your request. Please try again.
flag
  5 messages - Collapse all  -  Translate all to Translated (View all originals)
The group you are posting to is a Usenet group. Messages posted to this group will make your email address visible to anyone on the Internet.
Your reply message has not been sent.
Your post was successful
 
From:
To:
Cc:
Follow-up To:
Add Cc | Add Follow-up to | Edit Subject
Subject:
Validation:
For verification purposes please type the characters you see in the picture below or the numbers you hear by clicking the accessibility icon. Listen and type the numbers that you hear
 
doug livesey  
View profile   Translate to Translated (View Original)
 More options 3 Nov, 14:28
From: doug livesey <biot...@gmail.com>
Date: Tue, 3 Nov 2009 14:28:50 +0000
Local: Tues 3 Nov 2009 14:28
Subject: Using ActiveResource classes in Cucumber -- stubbing the JSON returned? Or something ...

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.


    Reply    Reply to author    Forward  
You must Sign in before you can post messages.
To post a message, you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Alex Barlow  
View profile   Translate to Translated (View Original)
 More options 3 Nov, 14:32
From: Alex Barlow <alexbarlo...@me.com>
Date: Tue, 03 Nov 2009 14:32:37 +0000
Local: Tues 3 Nov 2009 14:32
Subject: Re: [NWRUG] Using ActiveResource classes in Cucumber -- stubbing the JSON returned? Or something ...
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:


    Reply    Reply to author    Forward  
You must Sign in before you can post messages.
To post a message, you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
doug livesey  
View profile   Translate to Translated (View Original)
 More options 3 Nov, 14:40
From: doug livesey <biot...@gmail.com>
Date: Tue, 3 Nov 2009 14:40:07 +0000
Local: Tues 3 Nov 2009 14:40
Subject: Re: [NWRUG] Re: Using ActiveResource classes in Cucumber -- stubbing the JSON returned? Or something ...

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 <alexbarlo...@me.com>


    Reply    Reply to author    Forward  
You must Sign in before you can post messages.
To post a message, you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Alex Barlow  
View profile   Translate to Translated (View Original)
 More options 3 Nov, 15:23
From: Alex Barlow <alexbarlo...@me.com>
Date: Tue, 03 Nov 2009 15:23:22 +0000
Local: Tues 3 Nov 2009 15:23
Subject: Re: [NWRUG] Re: Using ActiveResource classes in Cucumber -- stubbing the JSON returned? Or something ...

Hmm, not quite sure how you would go about this either to be perfectly  
honest.

Personally its the way i would go about remote admin anyway, i assume  
that is what your trying to achieve?

On 3 Nov 2009, at 14:40, doug livesey wrote:


    Reply    Reply to author    Forward  
You must Sign in before you can post messages.
To post a message, you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
doug livesey  
View profile   Translate to Translated (View Original)
 More options 3 Nov, 15:52
From: doug livesey <biot...@gmail.com>
Date: Tue, 3 Nov 2009 15:52:43 +0000
Local: Tues 3 Nov 2009 15:52
Subject: Re: [NWRUG] Re: Using ActiveResource classes in Cucumber -- stubbing the JSON returned? Or something ...

Caius Durling suggested the fakeweb gem on the cukes mailing list, and that
seems to be the answer!
Cheers,
   Doug.


    Reply    Reply to author    Forward  
You must Sign in before you can post messages.
To post a message, you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
End of messages
« Back to Discussions « Newer topic     Older topic »

Create a group - Google Groups - Google Home - Terms of Service - Privacy Policy
©2009 Google