Re: [rspec-users] Best practices for sharing state between story steps?

2008-09-08 Thread Jonathan Linowes
On Sep 7, 2008, at 7:58 PM, Sam Stokes wrote: What approaches do people use to achieve this? Perhaps I'm bucking what others have advised against, so take it for what it's worth. I make some limited use of global (instance) variables that correspond to english language pronouns. I have

Re: [rspec-users] Best practices for sharing state between story steps?

2008-09-08 Thread Sam Stokes
Jonathan Linowes wrote: > I make some limited use of global (instance) variables that > correspond to english language pronouns. I have things like > @current_user (corresponds to "I"), @current_project (corresponds to > "the project"), etc. I am careful to be consistent. There's only a > handful o

Re: [rspec-users] scenarios on production data

2008-09-08 Thread Jonathan Linowes
On 4 Sep 2008, at 18:55, Jonathan Linowes wrote: I'm just thinking out loud here... It could be useful to have a way to run scenarios on a copy of a fully populated production database, as an alternative to normal use. Not sure how that'd work, maybe replace the Given's but leave the Whens a

Re: [rspec-users] scenarios on production data

2008-09-08 Thread Dan North
2008/9/8 Jonathan Linowes <[EMAIL PROTECTED]> > On 4 Sep 2008, at 18:55, Jonathan Linowes wrote: >> >> I'm just thinking out loud here... >>> It could be useful to have a way to run scenarios on a copy of a fully >>> populated production database, as an alternative to normal use. >>> Not sure how

[rspec-users] How to unit test code that connects to the external resources?

2008-09-08 Thread Yi Wen
By external resources, I mean, the code start a http connection and GET xmls from the url specified. I will definitely not rely my unit test on an external url or anything like that. But how do I unit test the method? I mean, I can basically mock the Net::HTTP, but then the test will pretty much be

Re: [rspec-users] scenarios on production data

2008-09-08 Thread Jonathan Linowes
On Sep 8, 2008, at 12:35 PM, Dan North wrote: 2008/9/8 Jonathan Linowes <[EMAIL PROTECTED]> On 4 Sep 2008, at 18:55, Jonathan Linowes wrote: I'm just thinking out loud here... It could be useful to have a way to run scenarios on a copy of a fully populated production database, as an alternat

Re: [rspec-users] scenarios on production data

2008-09-08 Thread Tero Tilus
2008-09-05 16:50, Ashley Moran: > Every time someone asks me this my answer is always the same... > > Don't. I think I happen have a case where it would be plausible to run specs/stories against production data. I need a sanity checker to detect "data smells" of various magnitude from (a copy of

Re: [rspec-users] What does a skilled BDD-/RSpec-er want in a job?

2008-09-08 Thread Ashley Moran
On Sep 08, 2008, at 1:09 am, Pat Maddox wrote: btw, a job ad that would catch my eye would be one that lists the tools you use, what open source contributions you've made to them, and what other open source stuff you've done in the form of plugins, mini apps, whatever. Hi Pat, Mark, Sco

Re: [rspec-users] scenarios on production data

2008-09-08 Thread Tero Tilus
2008-09-05 16:10, Nick Hoffman: > I know what you mean about it feeling reassuring to know that your > tests/specs passed when run on production data. However, if your > specs, scenarios, tests, etc cover all behaviours, situations, edge > cases, etc, then you needn't worry. All is well. I think y

Re: [rspec-users] Best practices for sharing state between story steps?

2008-09-08 Thread Jim Morris
Sam Stokes wrote: Jonathan Linowes wrote: I make some limited use of global (instance) variables that correspond to english language pronouns. I have things like @current_user (corresponds to "I"), @current_project (corresponds to "the project"), etc. I am careful to be consistent. There's only

Re: [rspec-users] How to unit test code that connects to the external resources?

2008-09-08 Thread Chuck Remes
On Sep 8, 2008, at 12:12 PM, Yi Wen wrote: By external resources, I mean, the code start a http connection and GET xmls from the url specified. I will definitely not rely my unit test on an external url or anything like that. But how do I unit test the method? I mean, I can basically mock

Re: [rspec-users] How to unit test code that connects to the external resources?

2008-09-08 Thread Yi Wen
def run url = URI.parse(run_path) http = Net::HTTP.new(url.host, url.port) http.use_ssl = use_ssl_for_run http.start { req = Net::HTTP::Get.new run_path req.basic_auth self.class.user, self.class.password @response = http.reque

Re: [rspec-users] How to unit test code that connects to the external resources?

2008-09-08 Thread Josh Knowles
On 9/8/08, Yi Wen <[EMAIL PROTECTED]> wrote: > By external resources, I mean, the code start a http connection and GET xmls > from the url specified. Take a look at the video from Ruby Hoedown in which Joe O'brien and Jim Weirich dicuss this topic: http://rubyhoedown2008.confreaks.com/02-joe-obrie

[rspec-users] help on skipping a before_filter for a story

2008-09-08 Thread Eric Harris-Braun
Hi folks, I'm hoping for a bit of help on best-practices for skipping a before_filter when running a particular step. Specifically the authentication filter. What happens is that the post (see code below) returns a redirect response to the login page triggered by the of my authentication filter,

Re: [rspec-users] help on skipping a before_filter for a story

2008-09-08 Thread David Chelimsky
On Mon, Sep 8, 2008 at 7:49 PM, Eric Harris-Braun <[EMAIL PROTECTED]> wrote: > Hi folks, > > I'm hoping for a bit of help on best-practices for skipping a > before_filter when running a particular step. Specifically the > authentication filter. What happens is that the post (see code below) > ret

Re: [rspec-users] help on skipping a before_filter for a story

2008-09-08 Thread Jonathan Linowes
On Sep 8, 2008, at 8:49 PM, Eric Harris-Braun wrote: Hi folks, I'm hoping for a bit of help on best-practices for skipping a before_filter when running a particular step. Specifically the authentication filter. What happens is that the post (see code below) returns a redirect response to the

Re: [rspec-users] help on skipping a before_filter for a story

2008-09-08 Thread David Chelimsky
On Mon, Sep 8, 2008 at 9:47 PM, Jonathan Linowes <[EMAIL PROTECTED]> wrote: > > On Sep 8, 2008, at 8:49 PM, Eric Harris-Braun wrote: > >> Hi folks, >> >> I'm hoping for a bit of help on best-practices for skipping a >> before_filter when running a particular step. Specifically the >> authenticatio

Re: [rspec-users] help on skipping a before_filter for a story

2008-09-08 Thread Jonathan Linowes
never mind, i misread your question, thought you were talking about a controller spec rather than a story stories are intended to exercise the full stack, so I actually log in, with a step like this: Given "I am logged in " do user = create_registered_user( :login => 'user', :password

Re: [rspec-users] help on skipping a before_filter for a story

2008-09-08 Thread Eric Harris-Braun
Thanks David for the very detailed response. I see what you mean about why this should be hard to do. In fact perhaps what I should do instead is simply specify the user-login part in my story instead of skipping it. I didn't at first because its a pain, i.e. sending the sessions/create post and

Re: [rspec-users] Best practices for sharing state between story steps?

2008-09-08 Thread Sam Stokes
Zach Dennis wrote: > This thread may help give you some insight... > > http://www.mail-archive.com/rspec-users@rubyforge.org/msg05382.html Thanks for pointing me there. The first insight it's given me is that I'm actually asking two different (though related) questions: 1) What's the best way t

Re: [rspec-users] help on skipping a before_filter for a story

2008-09-08 Thread David Chelimsky
On Mon, Sep 8, 2008 at 10:49 PM, Eric Harris-Braun <[EMAIL PROTECTED]> wrote: > Thanks David for the very detailed response. > > I see what you mean about why this should be hard to do. In fact > perhaps what I should do instead is simply specify the user-login part > in my story instead of skippi

Re: [rspec-users] help on skipping a before_filter for a story

2008-09-08 Thread Ben Mabey
Eric Harris-Braun wrote: > Hi folks, > > I'm hoping for a bit of help on best-practices for skipping a > before_filter when running a particular step. Specifically the > authentication filter. What happens is that the post (see code below) > returns a redirect response to the login page triggered