Re: [rspec-users] class << self considered harmful... really?

2008-11-26 Thread Ben Mabey
Avdi Grimm wrote: On Wed, Nov 26, 2008 at 12:17 PM, Matt Wynne <[EMAIL PROTECTED]> wrote: And class variables are problematic in Rails in development mode because of class reloading. And more generally dangerous for threading reasons, right? All of the above. My rule of thumb

[rspec-users] Restful Authentication and Cucumber

2008-11-26 Thread Andrei Erdoss
Hello, I am using Restful Authentication and I would like to login in Cucumber. I am having trouble keeping the user logged in. I tried finding a solution for this everywhere. Only source is this article: http://afreshcup.com/2008/10/09/authentication-in-cucumber-tests/ This is how my feature loo

Re: [rspec-users] class << self considered harmful... really?

2008-11-26 Thread Aslak Hellesøy
When (if) this thread ends, let's start a discussion about indentation conventions! kthxbye Avdi Grimm wrote: On Wed, Nov 26, 2008 at 12:17 PM, Matt Wynne <[EMAIL PROTECTED]> wrote: And class variables are problematic in Rails in development mode because of class reloading. And more

Re: [rspec-users] Variance in behaviour: rake features vs. autotest

2008-11-26 Thread Ben Mabey
James Byrne wrote: James Byrne wrote: James Byrne wrote: $ autotest ... script/cucumber features --format progress --format autotest --out /tmp/autotest-cucumber.1527.0 FFFF__F__F__F__F_P_F_P_FP_P_F_P_P_F_P_P_F_P_P_F_P_P_ On closer inspection, this looks very much like the

Re: [rspec-users] Variance in behaviour: rake features vs. autotest

2008-11-26 Thread James Byrne
James Byrne wrote: > James Byrne wrote: > >> $ autotest >> ... >> script/cucumber features --format progress --format autotest --out >> /tmp/autotest-cucumber.1527.0 >> FFFF__F__F__F__F_P_F_P_FP_P_F_P_P_F_P_P_F_P_P_F_P_P_ >> > > On closer inspection, this looks very much like the problem tha

Re: [rspec-users] rails associations

2008-11-26 Thread David Parker
Nick Hoffman wrote: > > Hi David. To write specs for ActiveRecord associations, I find Matthew > Heidemann's #stub_association! extremely helpful. There was a > discussion about it last week, actually: >http://www.ruby-forum.com/topic/171076 > > I hope that helps. Cheers, > Nick That's actua

Re: [rspec-users] Rake features vs. cucumber features

2008-11-26 Thread James Byrne
Andrew Premdas wrote: > Maybe > > cucumber features -r features > YES -- 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] Cucumber Problems with setup selenium/webrat + languages

2008-11-26 Thread Aslak Hellesøy
Please add a ticket since I suffer from amnesia. Sendt fra min iPhone Den 26. nov.. 2008 kl. 17.30 skrev Fernando García Samblas <[EMAIL PROTECTED] m>: On Tue, Nov 25, 2008 at 1:23 PM, Alberto Perdomo <[EMAIL PROTECTED] > wrote: Hi all, i've gotten started

Re: [rspec-users] Spec'ing via features

2008-11-26 Thread Andrew Premdas
Fixtures = yuk!! Try object_daddy or maybe factory_girl instead :) Andrew 2008/11/26 Tim Walker <[EMAIL PROTECTED]>: > Great post James. Very, helpful. Perhaps should be on the cucumber > Wiki? I hope someone follows up on the load fixtures question. Lots to > go play with now!!! Tim > > On Wed,

Re: [rspec-users] Rake features vs. cucumber features

2008-11-26 Thread Andrew Premdas
Maybe cucumber features -r features 2008/11/26 James Byrne <[EMAIL PROTECTED]>: > aslak hellesoy wrote: > >> >> When this is implemented it will be easier to diagnose and fix problems >> like this. It will give you a hint about other --require options you >> might want to add. >> >> Cheers, >> A

Re: [rspec-users] Spec'ing via features

2008-11-26 Thread Tim Walker
Great post James. Very, helpful. Perhaps should be on the cucumber Wiki? I hope someone follows up on the load fixtures question. Lots to go play with now!!! Tim On Wed, Nov 26, 2008 at 11:04 AM, James Byrne <[EMAIL PROTECTED]> wrote: > Tim Walker wrote: >> Question: In Cucumber when you're writin

Re: [rspec-users] Variance in behaviour: rake features vs. autotest

2008-11-26 Thread James Byrne
James Byrne wrote: > $ autotest > ... > script/cucumber features --format progress --format autotest --out > /tmp/autotest-cucumber.1527.0 > FFFF__F__F__F__F_P_F_P_FP_P_F_P_P_F_P_P_F_P_P_F_P_P_ > On closer inspection, this looks very much like the problem that I have with running cucumber f

Re: [rspec-users] Autospec running over and over, without changes?

2008-11-26 Thread James Byrne
Scott Burton wrote: > Hi all; > > I have several Rails projects where RSpec is working correctly, and > one in which it is not. Running autospec continuously reloads all > files, running my tests over and over again, without making any > changes. Each time it reloads, it runs a smaller subset of s

[rspec-users] Variance in behaviour: rake features vs. autotest

2008-11-26 Thread James Byrne
$ rake features ... 56 steps passed $ set AUTOFEATURE=true BASH=/bin/bash ... $ autotest ... script/cucumber features --format progress --format autotest --out /tmp/autotest-cucumber.1527.0 FFFF__F__F__F__F_P_F_P_FP_P_F_P_P_F_P_P_F_P_P_F_P_P_ Pending Scenarios: 1) Identify and record legal

Re: [rspec-users] Autospec running over and over, without changes?

2008-11-26 Thread Peter Fitzgibbons
> Do you have a .autotest file in that project? I have same issue without .autotest file. Any further ideas ? -- View this message in context: http://www.nabble.com/Autospec-running-over-and-over%2C-without-changes--tp20140013p20708237.html Sent from the rspec-users mailing list archive at Na

Re: [rspec-users] Spec'ing via features

2008-11-26 Thread James Byrne
Tim Walker wrote: > Question: In Cucumber when you're writing code to satisfy steps and > accessing the model objects directly, what support for asserts, > responses, etc. > do people use. (the equivalent of ActionController::TestCase and > ActiveSupport::TestCase), Fixtures, etc. > > Thanks, >

Re: [rspec-users] class << self considered harmful... really?

2008-11-26 Thread Avdi Grimm
On Wed, Nov 26, 2008 at 12:17 PM, Matt Wynne <[EMAIL PROTECTED]> wrote: >> And class variables are problematic in Rails in development mode because >> of class reloading. > > And more generally dangerous for threading reasons, right? All of the above. My rule of thumb is: don't use them unless I

Re: [rspec-users] class << self considered harmful... really?

2008-11-26 Thread Matt Wynne
On 26 Nov 2008, at 16:51, Mark Wilden wrote: On Wed, Nov 26, 2008 at 8:39 AM, Avdi Grimm <[EMAIL PROTECTED]> wrote: In fact I hardly ever use @@variables And class variables are problematic in Rails in development mode because of class reloading. And more generally dangerous for threading

Re: [rspec-users] ActiveRecord::RecordNotFound error Cucumber/Webrat

2008-11-26 Thread Andrei Erdoss
Thank you, that worked. I have a new issue. I tried finding a solution for this everywhere. Only source is this article: http://afreshcup.com/2008/10/09/authentication-in-cucumber-tests/ I am using Restful Authentication and I would like to login in Cucumber. This is how my feature looks like: S

Re: [rspec-users] class << self considered harmful... really?

2008-11-26 Thread Mark Wilden
On Wed, Nov 26, 2008 at 8:47 AM, Avdi Grimm <[EMAIL PROTECTED]> wrote: >class << self > attr_accessor :class_var >end > Also, with Rails, you could do cattr_accessor :class_var which has the same readability benefits as 'def self.foo' ///ark _

Re: [rspec-users] class << self considered harmful... really?

2008-11-26 Thread Mark Wilden
On Wed, Nov 26, 2008 at 8:39 AM, Avdi Grimm <[EMAIL PROTECTED]> wrote: > In fact I hardly ever use @@variables And class variables are problematic in Rails in development mode because of class reloading. ///ark ___ rspec-users mailing list rspec-user

Re: [rspec-users] class << self considered harmful... really?

2008-11-26 Thread Avdi Grimm
On Wed, Nov 26, 2008 at 8:23 AM, Shot (Piotr Szotkowski) <[EMAIL PROTECTED]> wrote: > If you don't use class << self, you have to work on class variables and > you can't use the attr_* shorthands to access the singleton's variables. It's true you need to use class << self to use attr_* macros, bu

Re: [rspec-users] Cucumber Problems with setup selenium/webrat + languages

2008-11-26 Thread Fernando García Samblas
> On Tue, Nov 25, 2008 at 1:23 PM, Alberto Perdomo > <[EMAIL PROTECTED] > wrote: > > Hi all, > > i've gotten started with cucumber thanks to Fernando and Raimond who > gave a brilliant talk about cucumber at the Conferencia Rails in > Madrid a few weeks ag

Re: [rspec-users] class << self considered harmful... really?

2008-11-26 Thread Avdi Grimm
On Wed, Nov 26, 2008 at 8:23 AM, Shot (Piotr Szotkowski) <[EMAIL PROTECTED]> wrote: > Such methods have access to the eigenclass's instance variables, and so > class << self works very nice when working with singletons (like Log or > Config). I've never had trouble accessing class-level instance

Re: [rspec-users] Rake features vs. cucumber features

2008-11-26 Thread aslak hellesoy
On Wed, Nov 26, 2008 at 4:56 PM, James Byrne <[EMAIL PROTECTED]> wrote: > aslak hellesoy wrote: > > > > > When this is implemented it will be easier to diagnose and fix problems > > like this. It will give you a hint about other --require options you > > might want to add. > > > > Cheers, > > Asl

Re: [rspec-users] Rake features vs. cucumber features

2008-11-26 Thread James Byrne
aslak hellesoy wrote: > > When this is implemented it will be easier to diagnose and fix problems > like this. It will give you a hint about other --require options you > might want to add. > > Cheers, > Aslak Thank you. I have add my heartfelt thanks for your work on cucumber. I tried to

Re: [rspec-users] class << self considered harmful... really?

2008-11-26 Thread Mark Wilden
On Wed, Nov 26, 2008 at 6:51 AM, Matt Wynne <[EMAIL PROTECTED]> wrote: > > That's one of the things that attracted me to using class << self to > contain all these methods - it just seemed easier to me to visualise what > was going on. > That makes sense. If you're doing things where being inside

Re: [rspec-users] Rake features vs. cucumber features

2008-11-26 Thread aslak hellesoy
On Wed, Nov 26, 2008 at 3:42 PM, James Byrne <[EMAIL PROTECTED]> wrote: > What exactly is the difference between these two invocations, beside the > fact that one is a rake task and one loads and runs the gem directly? I > am getting a slew of errors when I run "# cucumber features" whereas "# >

Re: [rspec-users] Rake features vs. cucumber features

2008-11-26 Thread Matt Wynne
I suspect your rails environment isn't being explicitly loaded by any code inside the features folder. When you run a rake task, that all happens anyway, so Entity will be a known type etc. Did you generate env.rb using the cucumber generator script? If not run one inside an empty rails app

Re: [rspec-users] class << self considered harmful... really?

2008-11-26 Thread Matt Wynne
On 26 Nov 2008, at 14:38, Peter Jaros wrote: On Wed, Nov 26, 2008 at 8:23 AM, Shot (Piotr Szotkowski) <[EMAIL PROTECTED]> wrote: If you don't use class << self, you have to work on class variables and you can't use the attr_* shorthands to access the singleton's variables. Actually, in

Re: [rspec-users] class << self considered harmful... really?

2008-11-26 Thread Mark Wilden
On Wed, Nov 26, 2008 at 5:23 AM, Shot (Piotr Szotkowski) <[EMAIL PROTECTED]>wrote: > > Such methods have access to the eigenclass's instance variables, and so > class << self works very nice when working with singletons (like Log or > Config). > > If you don't use class << self, you have to work

[rspec-users] Rake features vs. cucumber features

2008-11-26 Thread James Byrne
What exactly is the difference between these two invocations, beside the fact that one is a rake task and one loads and runs the gem directly? I am getting a slew of errors when I run "# cucumber features" whereas "# rake features" passes all the tests. I have manually run "#rake db:test:prepare"

Re: [rspec-users] class << self considered harmful... really?

2008-11-26 Thread Peter Jaros
On Wed, Nov 26, 2008 at 8:23 AM, Shot (Piotr Szotkowski) <[EMAIL PROTECTED]> wrote: > If you don't use class << self, you have to work on class variables and > you can't use the attr_* shorthands to access the singleton's variables. Actually, instance variables in a "def self.*" method still ref

Re: [rspec-users] ActiveRecord::RecordNotFound error Cucumber/Webrat

2008-11-26 Thread David Chelimsky
On Wed, Nov 26, 2008 at 5:04 AM, Andrei Erdoss <[EMAIL PROTECTED]> wrote: > Hello, > > I am bit new to Cucumber and Webrat and I have one issue that I can't seem > to fix on my own. I would appreciate your help. > > I have a controller called places and a model called Place. I use the > acts_as_tre

[rspec-users] ActiveRecord::RecordNotFound error Cucumber/Webrat

2008-11-26 Thread Andrei Erdoss
Hello, I am bit new to Cucumber and Webrat and I have one issue that I can't seem to fix on my own. I would appreciate your help. I have a controller called places and a model called Place. I use the acts_as_tree plugin in order for a place to have more places within it. Ex. Georgia would have Co

Re: [rspec-users] SOLVED Observer not calling inside a spec

2008-11-26 Thread Mikel Lindsaar
On Thu, Nov 27, 2008 at 12:54 AM, David Chelimsky <[EMAIL PROTECTED]>wrote: > Ouch! > > Good lesson though. Keep your test data close, and your mocks and stubs > closer. > > Thanks for reporting and congrats on being able to move on :) Yeah... finding it involved walking through the entire call

Re: [rspec-users] SOLVED Observer not calling inside a spec

2008-11-26 Thread David Chelimsky
On Wed, Nov 26, 2008 at 7:48 AM, Mikel Lindsaar <[EMAIL PROTECTED]> wrote: > Hands up all the people in here who feel stupid > > Thanks. > Problem was that I had an errant stub!(:notify) in a factory method. That > factory method was only called on certain classes. Those classes were the > ones

Re: [rspec-users] SOLVED Observer not calling inside a spec

2008-11-26 Thread Mikel Lindsaar
Hands up all the people in here who feel stupid Thanks. Problem was that I had an errant stub!(:notify) in a factory method. That factory method was only called on certain classes. Those classes were the ones failing. My bad. -- http://lindsaar.net/ Rails, RSpec and Life blog

Re: [rspec-users] class << self considered harmful... really?

2008-11-26 Thread Shot (Piotr Szotkowski)
Mark Wilden: > I'd be interested, however, in hearing about the benefits of opening > the eigenclass to define class methods (apart from ease in searching, > which may be best handled with ctags). Such methods have access to the eigenclass’s instance variables, and so class << self works very nic

Re: [rspec-users] Observer not calling inside a spec

2008-11-26 Thread Mikel Lindsaar
OK, in the app I have some name spaced classes under a 'int' directory. Some of these classes have observers and they have the same name as the top level classes. If I make a new observer in the top level that shares a name with an observer inside the namespace, the specs work. If I create an ob

Re: [rspec-users] Observer not calling inside a spec

2008-11-26 Thread Mikel Lindsaar
And the weirdness continues... Making a new observer against a different (empty) model works as expected. Deleting the entire person model down to just the class declaration, still does not work. >:| -- http://lindsaar.net/ Rails, RSpec and Life blog ___

Re: [rspec-users] Observer not calling inside a spec

2008-11-26 Thread Mikel Lindsaar
On Wed, Nov 26, 2008 at 10:10 PM, Mikel Lindsaar <[EMAIL PROTECTED]> wrote: > Am I missing a load path somewhere? > OK, I've ruled this out. I did: class PersonObserver < ActiveRecord::Observer raise end $ ruby spec/observers/person_observer.rb Throws an exception as expected... so l

Re: [rspec-users] Observer not calling inside a spec

2008-11-26 Thread Mikel Lindsaar
On Wed, Nov 26, 2008 at 9:41 PM, David Chelimsky <[EMAIL PROTECTED]>wrote: > On Wed, Nov 26, 2008 at 4:32 AM, Mikel Lindsaar <[EMAIL PROTECTED]> > wrote: > > Sorry David, stupid typo. I am duplicating the text from another screen > > that is not on the 'net directly. The second spec does not exi

[rspec-users] ActiveRecord::RecordNotFound error Cucumber/Webrat

2008-11-26 Thread Andrei Erdoss
Hello, I am bit new to Cucumber and Webrat and I have one issue that I can't seem to fix on my own. I would appreciate your help. I have a controller called places and a model called Place. I use the acts_as_tree plugin in order for a place to have more places within it. Ex. Georgia would have Co

Re: [rspec-users] Observer not calling inside a spec

2008-11-26 Thread David Chelimsky
On Wed, Nov 26, 2008 at 4:32 AM, Mikel Lindsaar <[EMAIL PROTECTED]> wrote: > >> I see two examples with identical code. Do they both fail, or just the >> 2nd one? If so, there was a bug in which mocked inherited class >> methods were not properly restored after the example. This is fixed in >> git,

Re: [rspec-users] Observer not calling inside a spec

2008-11-26 Thread Mikel Lindsaar
> I see two examples with identical code. Do they both fail, or just the > 2nd one? If so, there was a bug in which mocked inherited class > methods were not properly restored after the example. This is fixed in > git, but not released. > > Would you mind building the gem from the latest and see if

Re: [rspec-users] Observer not calling inside a spec

2008-11-26 Thread David Chelimsky
On Wed, Nov 26, 2008 at 4:08 AM, Mikel Lindsaar <[EMAIL PROTECTED]> wrote: > OK, I can't figure this out. > RSpec 1.1.8 > RSpecRails 1.1.8 > Rails 2.1.1 > I have a model > #app/models/person.rb > class Person < ActiveRecord::Base ># The model has a lot of code in it, but even deleting >#

[rspec-users] Observer not calling inside a spec

2008-11-26 Thread Mikel Lindsaar
OK, I can't figure this out. RSpec 1.1.8 RSpecRails 1.1.8 Rails 2.1.1 I have a model #app/models/person.rb class Person < ActiveRecord::Base # The model has a lot of code in it, but even deleting # all the contents down to an empty model like this # still produces the error end #app

Re: [rspec-users] could one scenario depend on another in cucumber?

2008-11-26 Thread Matt Wynne
On 26 Nov 2008, at 09:41, Pau Cor wrote: yes, try this: Scenario: User Registry and Account Activation By Mobile GivenScenario: User Registry I think I might be right in saying that technique is likely to be deprecated in the future. I don't think it's recommended anymore. See my earlie

Re: [rspec-users] could one scenario depend on another in cucumber?

2008-11-26 Thread Pau Cor
Newman Huang wrote: > I think it is a common test case you would meet. For example, you want > to test a user registry scenario. You write: > > Scenario: User Registry >When I dosth >Then I dosth >... > > And now business has some changes. Register should have to activate his > accoun

Re: [rspec-users] could one scenario depend on another in cucumber?

2008-11-26 Thread Matt Wynne
On 26 Nov 2008, at 03:27, Newman Huang wrote: I think it is a common test case you would meet. For example, you want to test a user registry scenario. You write: Scenario: User Registry When I dosth Then I dosth ... And now business has some changes. Register should have to activate h