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

2008-09-15 Thread Matt Wynne
On 15 Sep 2008, at 21:14, 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_project

Re: [rspec-users] w3 validation

2008-09-15 Thread Matt Wynne
On 15 Sep 2008, at 23:16, 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 it

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

2008-09-15 Thread Nubee Rails
Please help me to understand why runner is not picking steps. http://pastie.org/273126 -- Posted via http://www.ruby-forum.com/. ___ rspec-users mailing list rspec-users@rubyforge.org http://rubyforge.org/mailman/listinfo/rspec-users

Re: [rspec-users] Helpers that call helpers not working in specs?

2008-09-15 Thread Christopher Bailey
Thanks, that did the trick. And for including ApplicationHelper, I would say it should include it - because that would parallel Rails' standard behavior. On Mon, Sep 15, 2008 at 3:34 PM, David Chelimsky <[EMAIL PROTECTED]>wrote: > On Mon, Sep 15, 2008 at 4:06 PM, Christopher Bailey > <[EMAIL PRO

Re: [rspec-users] Adding Test Spy into Rspec mocking framework

2008-09-15 Thread Brian Takita
On Mon, Sep 15, 2008 at 9:54 AM, Joseph Wilk <[EMAIL PROTECTED]> wrote: >>Doesn't RR already support test spy? > I don't believe so. There is nothing on the github page or anything I > can spot in the current code in git. The github docs do mention it as > something they are aiming to do. No, spies

Re: [rspec-users] Helpers that call helpers not working in specs?

2008-09-15 Thread David Chelimsky
On Mon, Sep 15, 2008 at 4:06 PM, Christopher Bailey <[EMAIL PROTECTED]> wrote: > If I don't include them, then the helpers in LocationsHelper can't find/use > the helpers in ApplicationHelper. Maybe this will help illustrate: > test code: > describe LocationsHelper do > describe "location tree"

Re: [rspec-users] w3 validation

2008-09-15 Thread Zach Dennis
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 it to the w3 validator, and checks the the r

[rspec-users] w3 validation

2008-09-15 Thread Jonathan Linowes
Hi, suggestions how to add w3 validation to a story step? eg Then the page should be valid tia linoj ___ rspec-users mailing list rspec-users@rubyforge.org http://rubyforge.org/mailman/listinfo/rspec-users

Re: [rspec-users] Adding Test Spy into Rspec mocking framework

2008-09-15 Thread Zach Dennis
On Mon, Sep 15, 2008 at 2:28 PM, Pat Maddox <[EMAIL PROTECTED]> wrote: > On Mon, Sep 15, 2008 at 12:54 PM, Joseph Wilk <[EMAIL PROTECTED]> wrote: >>>Doesn't RR already support test spy? >> I don't believe so. There is nothing on the github page or anything I >> can spot in the current code in git.

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

2008-09-15 Thread aslak hellesoy
On Mon, Sep 15, 2008 at 11:01 PM, Joseph Wilk <[EMAIL PROTECTED]> wrote: > Tim Glen wrote: >> 1. Is there a way to stub out the model to return some fixture-type >> records? >> 2. Does anyone have an idea as to how we could refactor this into a >> better pattern? Those 2 "projects" are pretty speci

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

2008-09-15 Thread David Chelimsky
On Mon, Sep 15, 2008 at 4:01 PM, Joseph Wilk <[EMAIL PROTECTED]> wrote: > Tim Glen wrote: >> 1. Is there a way to stub out the model to return some fixture-type >> records? >> 2. Does anyone have an idea as to how we could refactor this into a >> better pattern? Those 2 "projects" are pretty specif

Re: [rspec-users] RCov / RSpec segfaults on Ubuntu

2008-09-15 Thread Matt Wynne
Thankyou Chad and Aslak, those patches seem to have worked perfectly - time to apply the threshold crank! [rubs hands gleefully] On 13 Sep 2008, at 16:50, Chad Humphries wrote: I've got a version of rcov up at github (sudo gem install spicycode-rcov --source=http://gems.github.com/) incorpora

Re: [rspec-users] Helpers that call helpers not working in specs?

2008-09-15 Thread Christopher Bailey
If I don't include them, then the helpers in LocationsHelper can't find/use the helpers in ApplicationHelper. Maybe this will help illustrate: test code: describe LocationsHelper do describe "location tree" do it "should not show siblings for state, country, or root level locations" do

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

2008-09-15 Thread Joseph Wilk
Tim Glen wrote: > 1. Is there a way to stub out the model to return some fixture-type > records? > 2. Does anyone have an idea as to how we could refactor this into a > better pattern? Those 2 "projects" are pretty specific to the > production data and will "never be edited," but it still doesn't m

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

2008-09-15 Thread Pat Maddox
On Mon, Sep 15, 2008 at 4:14 PM, Tim Glen <[EMAIL PROTECTED]> 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_projec

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

2008-09-15 Thread Tim Glen
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_project ||= Project.find(10) if Project.exists?(1

Re: [rspec-users] Adding Test Spy into Rspec mocking framework

2008-09-15 Thread Pat Maddox
On Mon, Sep 15, 2008 at 12:54 PM, Joseph Wilk <[EMAIL PROTECTED]> wrote: >>Doesn't RR already support test spy? > I don't believe so. There is nothing on the github page or anything I > can spot in the current code in git. The github docs do mention it as > something they are aiming to do. > >> o =

Re: [rspec-users] Helpers that call helpers not working in specs?

2008-09-15 Thread David Chelimsky
On Mon, Sep 15, 2008 at 12:26 PM, Christopher Bailey <[EMAIL PROTECTED]> wrote: > I'm trying to test some of my helpers. I have one helper (in module > LocationsHelper) that calls a helper/method in ApplicationHelper. If I > include ApplicationHelper and LocationHelper in my spec, and then I call

[rspec-users] Helpers that call helpers not working in specs?

2008-09-15 Thread Christopher Bailey
I'm trying to test some of my helpers. I have one helper (in module LocationsHelper) that calls a helper/method in ApplicationHelper. If I include ApplicationHelper and LocationHelper in my spec, and then I call the helper using the "helper." scope: helper.location_tree('Portland') then it com

[rspec-users] Factoring out code that creates specs

2008-09-15 Thread Matt Wynne
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 cases, but I want to be able to iterate around an array of values and generate

Re: [rspec-users] Adding Test Spy into Rspec mocking framework

2008-09-15 Thread Joseph Wilk
>Doesn't RR already support test spy? I don't believe so. There is nothing on the github page or anything I can spot in the current code in git. The github docs do mention it as something they are aiming to do. > o = stub("stub", :foo => true) > o.foo > o.should have_received(:foo) That sounds

Re: [rspec-users] Cucumber - Ambiguous steps

2008-09-15 Thread aslak hellesoy
On Mon, Sep 15, 2008 at 4:00 PM, David Chelimsky <[EMAIL PROTECTED]> wrote: > On Mon, Sep 15, 2008 at 8:55 AM, Joseph Wilk-2 > <[EMAIL PROTECTED]> wrote: >> >>>I like this much better. -Guiding people to use regexen properly is >>>better than redefining their semantics. >> >> Well put. Do you mind

Re: [rspec-users] Cucumber - Ambiguous steps

2008-09-15 Thread David Chelimsky
On Mon, Sep 15, 2008 at 8:55 AM, Joseph Wilk-2 <[EMAIL PROTECTED]> wrote: > >>I like this much better. -Guiding people to use regexen properly is >>better than redefining their semantics. > > Well put. Do you mind if I add this David? Well - it turns out that this is slightly more complicated. The

Re: [rspec-users] Cucumber - Ambiguous steps

2008-09-15 Thread Joseph Wilk-2
>I like this much better. -Guiding people to use regexen properly is >better than redefining their semantics. Well put. Do you mind if I add this David? Thanks, Joseph Wilk -- View this message in context: http://www.nabble.com/Cucumber---Ambiguous-steps-tp19480001p19493430.html Sent from th

Re: [rspec-users] Cucumber - Ambiguous steps

2008-09-15 Thread Joseph Wilk
David Chelimsky wrote: > On Mon, Sep 15, 2008 at 8:21 AM, David Chelimsky <[EMAIL PROTECTED]> > wrote: >> anyone have good examples where they would? >>> you just stick a $ at the end of the Regexp? >>> >>> That's how regexen work. I don't see why they should work any >>> differently when used

Re: [rspec-users] Cucumber - Ambiguous steps

2008-09-15 Thread aslak hellesoy
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 PROTECTED]> wrote: >>> On Mon, Sep 15, 2008 at 3:07 PM, Joseph Wilk <[EMAIL PROTECT

Re: [rspec-users] Cucumber - Ambiguous steps

2008-09-15 Thread David Chelimsky
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 PROTECTED]> wrote: >> On Mon, Sep 15, 2008 at 3:07 PM, Joseph Wilk <[EMAIL PROTECTED]> wrote: >>> David Chelimsky wrote: On Mon, Sep 15, 2008 at 3:54 AM, Jose

Re: [rspec-users] Cucumber - Ambiguous steps

2008-09-15 Thread David Chelimsky
On Mon, Sep 15, 2008 at 8:13 AM, aslak hellesoy <[EMAIL PROTECTED]> wrote: > On Mon, Sep 15, 2008 at 3:07 PM, Joseph Wilk <[EMAIL PROTECTED]> wrote: >> David Chelimsky wrote: >>> On Mon, Sep 15, 2008 at 3:54 AM, Joseph Wilk <[EMAIL PROTECTED]> >>> wrote: You can still use non-regular expressio

Re: [rspec-users] Cucumber - Ambiguous steps

2008-09-15 Thread aslak hellesoy
On Mon, Sep 15, 2008 at 3:07 PM, Joseph Wilk <[EMAIL PROTECTED]> wrote: > David Chelimsky wrote: >> On Mon, Sep 15, 2008 at 3:54 AM, Joseph Wilk <[EMAIL PROTECTED]> >> wrote: >>> You can still use non-regular expression steps in Cucumber: >>> >>> I've been unable to think of a good example where I

Re: [rspec-users] Cucumber - Ambiguous steps

2008-09-15 Thread Joseph Wilk
David Chelimsky wrote: > On Mon, Sep 15, 2008 at 3:54 AM, Joseph Wilk <[EMAIL PROTECTED]> > wrote: >> You can still use non-regular expression steps in Cucumber: >> >> I've been unable to think of a good example where I would want only a >> partial match of a step. Throwing away the unmatched char

Re: [rspec-users] Cucumber - Ambiguous steps

2008-09-15 Thread aslak hellesoy
On Mon, Sep 15, 2008 at 2:56 PM, David Chelimsky <[EMAIL PROTECTED]> wrote: > On Mon, Sep 15, 2008 at 7:49 AM, aslak hellesoy > <[EMAIL PROTECTED]> wrote: >> On Mon, Sep 15, 2008 at 2:40 PM, David Chelimsky <[EMAIL PROTECTED]> wrote: >>> On Mon, Sep 15, 2008 at 3:54 AM, Joseph Wilk <[EMAIL PROTECTE

Re: [rspec-users] Cucumber - Ambiguous steps

2008-09-15 Thread David Chelimsky
On Mon, Sep 15, 2008 at 7:49 AM, aslak hellesoy <[EMAIL PROTECTED]> wrote: > On Mon, Sep 15, 2008 at 2:40 PM, David Chelimsky <[EMAIL PROTECTED]> wrote: >> On Mon, Sep 15, 2008 at 3:54 AM, Joseph Wilk <[EMAIL PROTECTED]> wrote: >> Then /I should see "(.*)" in the page/ do |text| That

Re: [rspec-users] Adding Test Spy into Rspec mocking framework

2008-09-15 Thread David Chelimsky
On Mon, Sep 15, 2008 at 7:18 AM, David Chelimsky <[EMAIL PROTECTED]> wrote: > On Mon, Sep 15, 2008 at 5:09 AM, Joseph Wilk <[EMAIL PROTECTED]> wrote: >> Thanks to a pointer from lizkeogh.com site I've been discovering the joy >> of the Mockito (http://mockito.org/) mocking framework for Java. It >>

Re: [rspec-users] Cucumber - Ambiguous steps

2008-09-15 Thread aslak hellesoy
On Mon, Sep 15, 2008 at 2:40 PM, David Chelimsky <[EMAIL PROTECTED]> wrote: > On Mon, Sep 15, 2008 at 3:54 AM, Joseph Wilk <[EMAIL PROTECTED]> wrote: > Then /I should see "(.*)" in the page/ do |text| >>> >>> That should raise an AmbiguousStep error if you also have /I should >>> see "(.*)"/. >

Re: [rspec-users] Adding Test Spy into Rspec mocking framework

2008-09-15 Thread Pat Maddox
On Mon, Sep 15, 2008 at 8:43 AM, David Chelimsky <[EMAIL PROTECTED]> wrote: > On Mon, Sep 15, 2008 at 7:39 AM, Pat Maddox <[EMAIL PROTECTED]> wrote: >>> So I'm proposing the idea of adding 'should_have_received' and test_spy >>> in Rspec: >>> >>> --- >>> x = test_spy('like a mock but more into espi

Re: [rspec-users] Cucumber - Ambiguous steps

2008-09-15 Thread David Chelimsky
On Mon, Sep 15, 2008 at 3:54 AM, Joseph Wilk <[EMAIL PROTECTED]> wrote: Then /I should see "(.*)" in the page/ do |text| >> >> That should raise an AmbiguousStep error if you also have /I should >> see "(.*)"/. > > Oops sorry, thanks for spotting that David. > > It seems that it would be good

Re: [rspec-users] Adding Test Spy into Rspec mocking framework

2008-09-15 Thread David Chelimsky
On Mon, Sep 15, 2008 at 7:39 AM, Pat Maddox <[EMAIL PROTECTED]> wrote: >> So I'm proposing the idea of adding 'should_have_received' and test_spy >> in Rspec: >> >> --- >> x = test_spy('like a mock but more into espionage') >> >> #Action which does not fail on unexpected method but just records cal

Re: [rspec-users] Adding Test Spy into Rspec mocking framework

2008-09-15 Thread Pat Maddox
> So I'm proposing the idea of adding 'should_have_received' and test_spy > in Rspec: > > --- > x = test_spy('like a mock but more into espionage') > > #Action which does not fail on unexpected method but just records calls. > some.action(x) > > x.should_have_received(:method).and_returned_with('so

Re: [rspec-users] Adding Test Spy into Rspec mocking framework

2008-09-15 Thread David Chelimsky
On Mon, Sep 15, 2008 at 5:09 AM, Joseph Wilk <[EMAIL PROTECTED]> wrote: > Thanks to a pointer from lizkeogh.com site I've been discovering the joy > of the Mockito (http://mockito.org/) mocking framework for Java. It > verifies behaviour after the action. It struck me how this matched the > format

[rspec-users] Adding Test Spy into Rspec mocking framework

2008-09-15 Thread Joseph Wilk
Thanks to a pointer from lizkeogh.com site I've been discovering the joy of the Mockito (http://mockito.org/) mocking framework for Java. It verifies behaviour after the action. It struck me how this matched the format I use in my Ruby cucumber features. Within Rspec if we could use post behaviour

Re: [rspec-users] Cucumber - Ambiguous steps

2008-09-15 Thread Damian Jones
This is what I was trying to accomplish Then I should see "My product name" And I should see "My product description" And I should see "My product name was successfully saved." After reading all the comments above, the follwing step name solves my problem Then /I should see "(.*?)"$/ do |text|

Re: [rspec-users] Cucumber - Ambiguous steps

2008-09-15 Thread Joseph Wilk
>>> Then /I should see "(.*)" in the page/ do |text| > > That should raise an AmbiguousStep error if you also have /I should > see "(.*)"/. Oops sorry, thanks for spotting that David. It seems that it would be good practice to use $ and ^ in all your regular expression steps in order to minimis