Re: [rspec-users] undefined local variable or method `params' for #

2009-04-13 Thread aslak hellesoy
On Tue, Apr 14, 2009 at 8:24 AM, Salil Gaikwad wrote: > following is the method of the helper > > module ApplicationHelper > def tab_class(tab) >'class="active"' if tab == params[:controller] > end > end > > i write the spec method as follows > > describe ApplicationHelper do > it "should

[rspec-users] undefined local variable or method `params' for #

2009-04-13 Thread Salil Gaikwad
following is the method of the helper module ApplicationHelper def tab_class(tab) 'class="active"' if tab == params[:controller] end end i write the spec method as follows describe ApplicationHelper do it "should be active if controller is same" do tab_class('royalty_statement').s

Re: [rspec-users] [Cucumber] any examples of navigating cucumber parse tree from external script

2009-04-13 Thread aslak hellesoy
On Tue, Apr 14, 2009 at 6:06 AM, Korny Sietsma wrote: > In case anyone followed this: I got everything working pretty nicely - now > I have a cucumber formatter that automatically updates a confluence wiki. > > I still have to cover some bits like table outputs and the like, but the > basics are

Re: [rspec-users] [Cucumber] any examples of navigating cucumber parse tree from external script

2009-04-13 Thread Korny Sietsma
In case anyone followed this: I got everything working pretty nicely - now I have a cucumber formatter that automatically updates a confluence wiki. I still have to cover some bits like table outputs and the like, but the basics are pretty nice - I use cucumber to parse the features and create a w

Re: [rspec-users] Spec run heuristics (Re: Cucover: coverage-aware 'lazy' cucumber runs)

2009-04-13 Thread Stephen Eley
On Mon, Apr 13, 2009 at 7:46 AM, aslak hellesoy wrote: > > So if someone develops a better AutoTest with a plugin architecture, and > that doesn't have to run as a long/lived process, then I'd be very > interested in writing the neural network part - possibly backed by FANN > (http://leenissen.dk/

[rspec-users] Fwd: How do you mock an object to expect A then B then A?

2009-04-13 Thread Nigel Thorne
Hi Folks, I want to assert on an order of interaction between two objects where one method gets repeated. Here is a simple example... # this fails "Mock 'x' expected :a with (any args) once, but received it twice" x = mock("x") x.should_receive(:a).once.ordered x.should_receive(:b).once.ordered

[rspec-users] How do you mock an object to expect A then B then A?

2009-04-13 Thread Nigel Thorne
Hi Folks, I want to assert on an order of interaction between two objects where one method gets repeated. Here is a simple example... # this fails "Mock 'x' expected :a with (any args) once, but received it twice" x = mock("x") x.should_receive(:a).once.ordered x.should_receive(:b).once.ordered

Re: [rspec-users] Problem seeing and accessing RSpec gems

2009-04-13 Thread Stephen Eley
On Mon, Apr 13, 2009 at 4:46 PM, Sarah Gray wrote: > Jeff,  always a good idea -- it didn't work in this case, but I've seen it > before.  I ended up uninstalling my rails gem (and the action* gems) and > reinstalling; then, reinstalling rspec and rspec-rails.  After that, rspec > worked without t

Re: [rspec-users] [cucumber, jruby] Same steps are being added multiple times?

2009-04-13 Thread aslak hellesoy
On Tue, Apr 14, 2009 at 12:08 AM, John Goodsen wrote: > OK, I'll reproduce in a simple example and create a ticket... > > Excellent - I'll get to it ASAP > > On Sat, Apr 11, 2009 at 3:56 AM, aslak hellesoy > wrote: > >> >> >> On Fri, Apr 10, 2009 at 5:29 PM, John Goodsen wrote: >> >>> so I'm s

Re: [rspec-users] [cucumber, jruby] Same steps are being added multiple times?

2009-04-13 Thread John Goodsen
OK, I'll reproduce in a simple example and create a ticket... On Sat, Apr 11, 2009 at 3:56 AM, aslak hellesoy wrote: > > > On Fri, Apr 10, 2009 at 5:29 PM, John Goodsen wrote: > >> so I'm still stumped... how do I tell keep cucumber from loading the >> *SAME* steps more than once when I run multi

Re: [rspec-users] Spec run heuristics (Re: Cucover: coverage-aware 'lazy' cucumber runs)

2009-04-13 Thread aslak hellesoy
On Mon, Apr 13, 2009 at 10:09 PM, Matt Wynne wrote: > > On 13 Apr 2009, at 12:46, aslak hellesoy wrote: > > A couple of years ago I was on a project that had fallen into the trap of >> too many integration tests (exactly the horror scenario that J.B. >> Rainsberger describes: http://www.jbrains.

[rspec-users] Cucumber features for RSS feeds

2009-04-13 Thread James Byrne
I am moving into yet another area that I possess absolutely no experience with. In this case the realm of RSS feeds and Rails as the consumer. My first feature/scenario looks like this and, given the effort I had to make to grasp the basics of features and scenarios in the crud world, I thought it

Re: [rspec-users] Problem seeing and accessing RSpec gems

2009-04-13 Thread Sarah Gray
Jeff, always a good idea -- it didn't work in this case, but I've seen it before. I ended up uninstalling my rails gem (and the action* gems) and reinstalling; then, reinstalling rspec and rspec-rails. After that, rspec worked without the issues I'd seen before. Don't know why. Thanks. On Mon,

Re: [rspec-users] Problem seeing and accessing RSpec gems

2009-04-13 Thread Jeff Talbot
I'm sure you have tried this, but it's such a simple step that I'll throw it out. I've had a couple instances in the past where gems were not being loaded and after troubleshooting for a while, I found that all problems were magically solved by firing up a new instance of my shell (new terminal wi

Re: [rspec-users] Problem seeing and accessing RSpec gems

2009-04-13 Thread David Chelimsky
On Mon, Apr 13, 2009 at 5:04 PM, Sarah Gray wrote: > When uninstalling rspec, should you: > Remove executables: > autospec, spec > in addition to the gem? [Yn] > And, is there possible fallout from doing this step wrong? As long as you're going to reinstall it, then there should not be any fallou

Re: [rspec-users] Spec run heuristics (Re: Cucover: coverage-aware 'lazy' cucumber runs)

2009-04-13 Thread Matt Wynne
On 13 Apr 2009, at 12:46, aslak hellesoy wrote: A couple of years ago I was on a project that had fallen into the trap of too many integration tests (exactly the horror scenario that J.B. Rainsberger describes: http://www.jbrains.ca/permalink/239). The whole suite had hundreds of slow wati

Re: [rspec-users] Spec run heuristics (Re: Cucover: coverage-aware 'lazy' cucumber runs)

2009-04-13 Thread Matt Wynne
On 12 Apr 2009, at 23:51, Ben Mabey wrote: Stephen Eley wrote: On Sat, Apr 11, 2009 at 2:02 PM, Ashley Moran wrote: I was just idly thinking, could a code-coverage based system could be combined with some sort of failure (fragility) history to balance the time cost of heavy feature runs

Re: [rspec-users] Problem seeing and accessing RSpec gems

2009-04-13 Thread Sarah Gray
When uninstalling rspec, should you: Remove executables: autospec, spec in addition to the gem? [Yn] And, is there possible fallout from doing this step wrong? On Mon, Apr 13, 2009 at 2:48 PM, David Chelimsky wrote: > On Mon, Apr 13, 2009 at 4:34 PM, Sarah Gray wrote: > > rails -v > > 2.3.2

Re: [rspec-users] Problem seeing and accessing RSpec gems

2009-04-13 Thread David Chelimsky
On Mon, Apr 13, 2009 at 4:34 PM, Sarah Gray wrote: > rails -v > 2.3.2 Me too. Not sure what to tell you. Anybody else? > (Sorry about that long stack trace in the last message!) > > On Mon, Apr 13, 2009 at 2:29 PM, David Chelimsky > wrote: >> >> On Mon, Apr 13, 2009 at 3:36 PM, Sarah Gray wro

Re: [rspec-users] Spec run heuristics (Re: Cucover: coverage-aware 'lazy' cucumber runs)

2009-04-13 Thread Matt Wynne
On 11 Apr 2009, at 19:02, Ashley Moran wrote: I was just idly thinking, could a code-coverage based system could be combined with some sort of failure (fragility) history to balance the time cost of heavy feature runs with the benefits of having something run end-to-end? We've had reverse

Re: [rspec-users] [cucumber] Cucumber and restful_authentication

2009-04-13 Thread Andrew Premdas
You could look at fbrp (http://github.com/diabolo/fbrp/tree/master) which has lots of tests like this. You could add a debug statement when you visit a page that you actually have to be logged in, to see if you actually are logged in. I suspect of the top of my head that you are not logged in when

Re: [rspec-users] Problem seeing and accessing RSpec gems

2009-04-13 Thread David Chelimsky
On Mon, Apr 13, 2009 at 3:36 PM, Sarah Gray wrote: > David, thanks, that does appear to be true, which is helpful to know, > thanks. But the "gem which" problem was really the canary in the coal mine > for the fact that the gems aren't being recognized when I am attempting to > configure them: > $

Re: [rspec-users] Problem seeing and accessing RSpec gems

2009-04-13 Thread David Chelimsky
On Mon, Apr 13, 2009 at 2:22 PM, Sarah Gray wrote: > Hello RSpec-list: > I'm having trouble getting rspec and rspec-rails correctly installed on my > system. (I had to uninstall, unfortunately).The upshot is that even when > they are installed -- i.e. when I can see them on my system -- they don't

[rspec-users] Problem seeing and accessing RSpec gems

2009-04-13 Thread Sarah Gray
Hello RSpec-list: I'm having trouble getting rspec and rspec-rails correctly installed on my system. (I had to uninstall, unfortunately).The upshot is that even when they are installed -- i.e. when I can see them on my system -- they don't appear known to gem which which and, more importantly, the

Re: [rspec-users] App can't start on production server due to RSpec missing

2009-04-13 Thread Fernando Perez
>> A quick fix is to install rspec and rspec-rails gems on production >> server, but I don't get why the app wants them installed. > > This is a tricky business. > > We put that in there in response to a user who works on a team. One > team member had pulled code and tried t run specs and got an

Re: [rspec-users] Spec run heuristics (Re: Cucover: coverage-aware 'lazy' cucumber runs)

2009-04-13 Thread Ben Mabey
Kero van Gelder wrote: That would be very cool, you have lots of good ideas there. Being able to plug in your own file-change strategy would be killer. Another cool idea I ran across the other idea is being able to specify in your examples that which ones are "focussed". Meaning, autotest

Re: [rspec-users] How to write a spec file for a helper

2009-04-13 Thread Pat Maddox
On Mon, Apr 13, 2009 at 8:17 AM, David Chelimsky wrote: > On Mon, Apr 13, 2009 at 12:09 PM, Salil Gaikwad wrote: >> How to write a spec file for a following helper >> >> module ArtistsHelper >> >> def round_to(x) >>    (self * 10**x).round.to_f / 10**x >> end >> >> end > > in spec/helpers/artists

Re: [rspec-users] how to write a spec for an actionmailer method

2009-04-13 Thread Ben Mabey
David Chelimsky wrote: On Mon, Apr 13, 2009 at 12:06 PM, Salil Gaikwad wrote: how to write a spec for an actionmailer method. Check out http://github.com/bmabey/email-spec/ Cheers, David Specifically, look at this example for an idea on how to use it with RSpec: http://github.c

Re: [rspec-users] How to write a spec file for a helper

2009-04-13 Thread David Chelimsky
On Mon, Apr 13, 2009 at 12:09 PM, Salil Gaikwad wrote: > How to write a spec file for a following helper > > module ArtistsHelper > > def round_to(x) >    (self * 10**x).round.to_f / 10**x > end > > end in spec/helpers/artists_helper_spec.rb: describe AristsHelper do it "rounds to " do

Re: [rspec-users] how to write a spec for an actionmailer method

2009-04-13 Thread David Chelimsky
On Mon, Apr 13, 2009 at 12:06 PM, Salil Gaikwad wrote: > how to write a spec for an actionmailer method. Check out http://github.com/bmabey/email-spec/ Cheers, David > > following is the method of action controller. > > class Notifier < ActionMailer::Base > >  def conta(username ,adresseemail,c

[rspec-users] How to write a spec file for a helper

2009-04-13 Thread Salil Gaikwad
How to write a spec file for a following helper module ArtistsHelper def round_to(x) (self * 10**x).round.to_f / 10**x end end Regards salil -- Posted via http://www.ruby-forum.com/. ___ rspec-users mailing list rspec-users@rubyforge.org http://

[rspec-users] how to write a spec for an actionmailer method

2009-04-13 Thread Salil Gaikwad
how to write a spec for an actionmailer method. following is the method of action controller. class Notifier < ActionMailer::Base def conta(username ,adresseemail,code) @subject = 'Admin Confirmation Mail' @recipients = adresseemail @body["Username"]= username @body["adressee

Re: [rspec-users] Spec run heuristics (Re: Cucover: coverage-aware 'lazy' cucumber runs)

2009-04-13 Thread aslak hellesoy
On Sun, Apr 12, 2009 at 6:47 AM, Stephen Eley wrote: > On Sat, Apr 11, 2009 at 2:02 PM, Ashley Moran > wrote: > > > > I was just idly thinking, could a code-coverage based system could be > > combined with some sort of failure (fragility) history to balance the > time > > cost of heavy feature r

Re: [rspec-users] Passing self to matchers

2009-04-13 Thread David Chelimsky
On Mon, Apr 13, 2009 at 4:19 AM, Brandon Olivares wrote: > Hi, > > I've noticed in several matchers that the matcher method passes self to the > constructor of the class. Then that's used to call several of the methods > used. For instance, in RouteFor, self is passed, and it is used to call > ass

Re: [rspec-users] Spec run heuristics (Re: Cucover: coverage-aware 'lazy' cucumber runs)

2009-04-13 Thread Kero van Gelder
> That would be very cool, you have lots of good ideas there. Being able > to plug in your own file-change strategy would be killer. Another cool > idea I ran across the other idea is being able to specify in your > examples that which ones are "focussed". Meaning, autotest will only > r

[rspec-users] Passing self to matchers

2009-04-13 Thread Brandon Olivares
Hi, I've noticed in several matchers that the matcher method passes self to the constructor of the class. Then that's used to call several of the methods used. For instance, in RouteFor, self is passed, and it is used to call assert_recognizes. I'm just curious why this is, and when this is requi