[rspec-users] How to write a step for a feature with a select control

2008-09-16 Thread Damian Jones
I was wondering what the correct procedure would be for spec'ing the following story line When I pick "My Option" from "My Field" "My Field" would be an Article Category select control, when running my feature the control does not have any data bound to it. I am guessing I would somehow bind the

Re: [rspec-users] How to write a step for a feature with a select control

2008-09-16 Thread Joseph Wilk
Damian Jones wrote: > I was wondering what the correct procedure would be for spec'ing the > following story line > > When I pick "My Option" from "My Field" > > "My Field" would be an Article Category select control, when running my > feature the control does not have any data bound to it. > >

Re: [rspec-users] runner does not pick steps. help please

2008-09-16 Thread David Chelimsky
On Tue, Sep 16, 2008 at 12:30 AM, Nubee Rails <[EMAIL PROTECTED]> wrote: > Please help me to understand why runner is not picking steps. > http://pastie.org/273126 Need a little more information: What command are you using to run the scenarios? Where is filter defined and captured? _

Re: [rspec-users] How to write a step for a feature with a select control

2008-09-16 Thread David Chelimsky
Hi Damian, On Tue, Sep 16, 2008 at 6:43 AM, Joseph Wilk <[EMAIL PROTECTED]> wrote: > Damian Jones wrote: >> I was wondering what the correct procedure would be for spec'ing the >> following story line First, a bit of remedial terminology ;) For better or worse, we generally use "spec'ing" to des

Re: [rspec-users] Factoring out code that creates specs

2008-09-16 Thread David Chelimsky
Hi Matt, On Mon, Sep 15, 2008 at 12:28 PM, Matt Wynne <[EMAIL PROTECTED]> wrote: > It's all gone a bit meta. > I've started noticing patterns in my specs, where I want more than one class > to satisfy a specific bunch of behaviours. > I know I can use it_should_behave_like and this works in simple

Re: [rspec-users] How to write a step for a feature with a select control

2008-09-16 Thread Damian Jones
Hi David, Once again, thanks, that is exactly what I was looking for. Thanks for clearing up the terminology also, I was hoping someone would do that. Cheers, Damian -- Posted via http://www.ruby-forum.com/. ___ rspec-users mailing list rspec-users@r

Re: [rspec-users] runner does not pick steps. help please

2008-09-16 Thread Nubee Rails
David Chelimsky wrote: > On Tue, Sep 16, 2008 at 12:30 AM, Nubee Rails <[EMAIL PROTECTED]> > wrote: >> Please help me to understand why runner is not picking steps. >> http://pastie.org/273126 > > Need a little more information: > > What command are you using to run the scenarios? > > Where is

Re: [rspec-users] runner does not pick steps. help please

2008-09-16 Thread Nubee Rails
David Chelimsky wrote: > On Tue, Sep 16, 2008 at 12:30 AM, Nubee Rails <[EMAIL PROTECTED]> > wrote: >> Please help me to understand why runner is not picking steps. >> http://pastie.org/273126 > > Need a little more information: > > What command are you using to run the scenarios? > > Where is

Re: [rspec-users] Cucumber - stub! or mock?

2008-09-16 Thread Tim Glen
I've got some code that I (mostly) inherited. It essentially has a couple of AR class methods that look for a specific record by id: class Project < ActiveRecord::Base class << self def specific_project @another_specific_project ||= Project.find(10) if Project.exists?(10) end

Re: [rspec-users] How to write a step for a feature with a select control

2008-09-16 Thread Damian Jones
David Chelimsky wrote: > 2. add the data in the current step > > When(/^I pick "(.*)" from (.*)$/) do |option_value, field_name| > field_name.gsub(' > ','').constantize.find_or_create_by_name(option_value) > selects option_value, :from => field_name > end HI David, I tried the method above

Re: [rspec-users] How to write a step for a feature with a select control

2008-09-16 Thread David Chelimsky
On Tue, Sep 16, 2008 at 9:55 AM, Damian Jones <[EMAIL PROTECTED]> wrote: > David Chelimsky wrote: > >> 2. add the data in the current step >> >> When(/^I pick "(.*)" from (.*)$/) do |option_value, field_name| >> field_name.gsub(' >> ','').constantize.find_or_create_by_name(option_value) >> sele

Re: [rspec-users] How to write a step for a feature with a select control

2008-09-16 Thread Damian Jones
Sorry David, I don't really understand. > When(/^I pick "(.*)" from (.*)$/) do |option_value, field_name| > field_name.gsub(' ','').constantize.find_or_create_by_name(option_value) > selects option_value, :from => field_name > end >> field_name.gsub(' ','').constantize.find_or_create_by_nam

Re: [rspec-users] runner does not pick steps. help please

2008-09-16 Thread Matt Wynne
On 16 Sep 2008, at 15:34, Nubee Rails wrote: David Chelimsky wrote: On Tue, Sep 16, 2008 at 12:30 AM, Nubee Rails <[EMAIL PROTECTED]> wrote: Please help me to understand why runner is not picking steps. http://pastie.org/273126 Need a little more information: What command are you using to r

Re: [rspec-users] Cucumber - stub! or mock?

2008-09-16 Thread Matt Wynne
On 16 Sep 2008, at 15:41, Tim Glen wrote: Matt - in terms of subclassing it, I have the entire stable of projects, 1 "internal" project and 1 "slush fund" project. If I'm subclassing the project, I assume that I still need to have a record for them in the database that needs to be findable.

Re: [rspec-users] w3 validation

2008-09-16 Thread Jonathan Linowes
On Sep 15, 2008, at 6:16 PM, Zach Dennis wrote: On Mon, Sep 15, 2008 at 5:32 PM, Jonathan Linowes <[EMAIL PROTECTED]> wrote: Hi, suggestions how to add w3 validation to a story step? eg Then the page should be valid You could write a "then" step that takes the current response.body, uploads

[rspec-users] Prepare for newbie-ness

2008-09-16 Thread Martin Streicher
A few questions from someone new to rspec. 1/ I have several complex yet largely independent models using rspec to test internals and computation methods. I am about to tackle models that have several ties to each other and to the "primitive", independent models. One model has stuff like

Re: [rspec-users] Mocking a 3rd party call, but with a few exceptions

2008-09-16 Thread Christopher Bailey
I've played around a bit on this. The constant setting with the service locator pattern looked good, but I couldn't get the undoing/resetting of the constant to work properly, not sure what I was doing wrong there. This appears to be a solution though: In my spec_helper.rb (which is required by al

Re: [rspec-users] Prepare for newbie-ness

2008-09-16 Thread Mark Wilden
On Tue, Sep 16, 2008 at 10:00 AM, Martin Streicher < [EMAIL PROTECTED]> wrote: > > 3/ Has any documented how to run the debugger via rspec to help track down > errors? > We TDD/BDD/Agile practitioners aren't supposed to use a debugger, so don't tell anyone I said this. But all I have to do (on a

Re: [rspec-users] How to write a step for a feature with a select control

2008-09-16 Thread Damian Jones
OK, I managed to get it to work using David's option 1. > 1. add the data in a previous step > > Given /an? (.*) named "(.*)"$/ do |class_name, object_name| > class_name.gsub(' > ','').constantize.find_or_create_by_name(object_name) > end My Scenario now goes: Given an Article Category nam

Re: [rspec-users] Factoring out code that creates specs

2008-09-16 Thread Matt Wynne
On 16 Sep 2008, at 14:28, David Chelimsky wrote: Hi Matt, On Mon, Sep 15, 2008 at 12:28 PM, Matt Wynne <[EMAIL PROTECTED]> wrote: It's all gone a bit meta. I've started noticing patterns in my specs, where I want more than one class to satisfy a specific bunch of behaviours. I know I can

Re: [rspec-users] Prepare for newbie-ness

2008-09-16 Thread David Chelimsky
On Tue, Sep 16, 2008 at 1:59 PM, Mark Wilden <[EMAIL PROTECTED]> wrote: > On Tue, Sep 16, 2008 at 10:00 AM, Martin Streicher > <[EMAIL PROTECTED]> wrote: >> >> 3/ Has any documented how to run the debugger via rspec to help track down >> errors? > > We TDD/BDD/Agile practitioners aren't supposed to

Re: [rspec-users] How to write a step for a feature with a select control

2008-09-16 Thread David Chelimsky
On Tue, Sep 16, 2008 at 2:00 PM, Damian Jones <[EMAIL PROTECTED]> wrote: > OK, > > I managed to get it to work using David's option 1. > >> 1. add the data in a previous step >> >> Given /an? (.*) named "(.*)"$/ do |class_name, object_name| >> class_name.gsub(' >> ','').constantize.find_or_create

[rspec-users] autospec is not picking latest changes

2008-09-16 Thread Luis Lavena
Hey Guys. I just updated a project form 1.1.4 that was working with autotest 3.10 without issues: 1) Updated spec/model/project_spec.rb and it fired only that spec. 2) Updated app/model/project.rb and it fired only the matching spec file. After the update of rspec and rspec-rails as plugins a fe

Re: [rspec-users] autospec is not picking latest changes

2008-09-16 Thread Luis Lavena
On Tue, Sep 16, 2008 at 4:18 PM, Luis Lavena <[EMAIL PROTECTED]> wrote: > Hey Guys. > > I just updated a project form 1.1.4 that was working with autotest > 3.10 without issues: > > 1) Updated spec/model/project_spec.rb and it fired only that spec. > 2) Updated app/model/project.rb and it fired onl

Re: [rspec-users] autospec is not picking latest changes

2008-09-16 Thread Matt Wynne
try script/autospec instead - I always use that these days. not sure what the difference is. On 16 Sep 2008, at 20:20, Luis Lavena wrote: On Tue, Sep 16, 2008 at 4:18 PM, Luis Lavena <[EMAIL PROTECTED]> wrote: Hey Guys. I just updated a project form 1.1.4 that was working with autotest 3.10

Re: [rspec-users] autospec is not picking latest changes

2008-09-16 Thread Luis Lavena
On Tue, Sep 16, 2008 at 4:41 PM, Matt Wynne <[EMAIL PROTECTED]> wrote: > try script/autospec instead - I always use that these days. not sure what > the difference is. Thank you for your feedback Matt, Tried both, the same result. The funny thing is that another Rails 2.1.1 application works wit

Re: [rspec-users] autospec is not picking latest changes

2008-09-16 Thread Mark Wilden
On Tue, Sep 16, 2008 at 12:45 PM, Luis Lavena <[EMAIL PROTECTED]> wrote: > > The funny thing is that another Rails 2.1.1 application works without > problems under the same scenario with both autotest and > script/autospec. > That sounds like a plugin difference, then. ///ark ___

Re: [rspec-users] autospec is not picking latest changes

2008-09-16 Thread Luis Lavena
On Tue, Sep 16, 2008 at 5:22 PM, Mark Wilden <[EMAIL PROTECTED]> wrote: > On Tue, Sep 16, 2008 at 12:45 PM, Luis Lavena <[EMAIL PROTECTED]> wrote: >> >> The funny thing is that another Rails 2.1.1 application works without >> problems under the same scenario with both autotest and >> script/autospe

Re: [rspec-users] autospec is not picking latest changes

2008-09-16 Thread Mark Wilden
On Tue, Sep 16, 2008 at 1:45 PM, Luis Lavena <[EMAIL PROTECTED]> wrote: > > Only two plugins installed: rspec and rspec-rails :-D > Sure - I was just suggesting you check that they were the same versions in both projects. That would be one way the projects could behave differently with autotest.

Re: [rspec-users] Cucumber - Ambiguous steps

2008-09-16 Thread Zach Dennis
On Mon, Sep 15, 2008 at 9:34 AM, aslak hellesoy <[EMAIL PROTECTED]> wrote: > On Mon, Sep 15, 2008 at 3:27 PM, David Chelimsky <[EMAIL PROTECTED]> wrote: >> On Mon, Sep 15, 2008 at 8:21 AM, David Chelimsky <[EMAIL PROTECTED]> wrote: >>> On Mon, Sep 15, 2008 at 8:13 AM, aslak hellesoy >>> <[EMAIL PRO

Re: [rspec-users] RSpec story failing because create is not rendering 'show'

2008-09-16 Thread Zach Dennis
On Sat, Sep 13, 2008 at 2:24 PM, Damian Jones <[EMAIL PROTECTED]> wrote: > Ok I got my story to pass by changing the follwing snippet > > When /I create a product named (.*) described with (.*)/ do |name, > description| > visits new_product_path > fills_in "product[name]", :with => name > fills_

Re: [rspec-users] autospec is not picking latest changes

2008-09-16 Thread Luis Lavena
On Tue, Sep 16, 2008 at 6:05 PM, Mark Wilden <[EMAIL PROTECTED]> wrote: > On Tue, Sep 16, 2008 at 1:45 PM, Luis Lavena <[EMAIL PROTECTED]> wrote: >> >> Only two plugins installed: rspec and rspec-rails :-D > > Sure - I was just suggesting you check that they were the same versions in > both project

Re: [rspec-users] Prepare for newbie-ness

2008-09-16 Thread Scott Taylor
On Sep 16, 2008, at 3:05 PM, David Chelimsky wrote: On Tue, Sep 16, 2008 at 1:59 PM, Mark Wilden <[EMAIL PROTECTED]> wrote: On Tue, Sep 16, 2008 at 10:00 AM, Martin Streicher <[EMAIL PROTECTED]> wrote: 3/ Has any documented how to run the debugger via rspec to help track down errors? We

Re: [rspec-users] Cucumber - stub! or mock?

2008-09-16 Thread Scott Taylor
On Sep 15, 2008, at 4:14 PM, Tim Glen wrote: Hey all, I've got some code that I (mostly) inherited. It essentially has a couple of AR class methods that look for a specific record by id: class Project < ActiveRecord::Base class << self def specific_project @another_specific_projec

[rspec-users] Cucumber: pending specs

2008-09-16 Thread Scott Taylor
Shouldn't pending 'a message' work in cucumber? Is this a bug? Currently it's raising Rspec's PendingExpectationError. SCott ___ rspec-users mailing list rspec-users@rubyforge.org http://rubyforge.org/mailman/listinfo/rspec-users

Re: [rspec-users] Cucumber: pending specs

2008-09-16 Thread David Chelimsky
On Tue, Sep 16, 2008 at 8:16 PM, Scott Taylor <[EMAIL PROTECTED]> wrote: > > Shouldn't pending 'a message' work in cucumber? Is this a bug? Currently > it's raising Rspec's PendingExpectationError. This came up last week: http://groups.google.com/group/rspec/browse_thread/thread/84743f0ef89a8

[rspec-users] Help

2008-09-16 Thread Victor Asteinza
rt -- An HTML attachment was scrubbed... URL: <http://rubyforge.org/pipermail/rspec-users/attachments/20080916/b911d613/attachment-0001.html > -- Message: 3 Date: Tue, 16 Sep 2008 17:45:25 -0300 From: "Luis Lavena" <[EMAIL PROTECTED]> Su

Re: [rspec-users] Prepare for newbie-ness

2008-09-16 Thread Mark Wilden
On Tue, Sep 16, 2008 at 6:11 PM, Scott Taylor <[EMAIL PROTECTED] > wrote: > Yeah - I use a debugger all the time I regard using the debugger as a bit of a smell. It often means my code isn't clear enough to just bench-step through. In a way, it's like commenting. Complicated code often needs co