[rspec-users] Changes in specs for routes in rspec 1.1.99.x

2009-03-02 Thread Juanma Cervera
Trying the next release of rspec, I have had to make changes in the existing specs for routing. I have written an script with sed that makes this automatically (two files) spec/upgrade.sed /route_for/s/id = 1/id = 1/g /route_for.*create/s/== \(['].*[']\)/== {:path = \1, :method

Re: [rspec-users] [cucumber] noob Q deleteing from a list.

2009-03-02 Thread Joseph Wilk
John Ivanoff wrote: Thanks for all the help. With the puts response.body I was able so see what was going on. I know that I am now deleting the third frooble Now when Then I should see the following froobles: I get this error -- Then I should see the

Re: [rspec-users] Cucumber for large projects

2009-03-02 Thread aidy lewis
Hi Tom, We have written an extension that counts your tests and provides a link(s) to the failure backtrace in the Cucumber HTML. There seem to be issues when Cucumber writes to the HTML over around 800 steps, so we are waiting for version 0.2. Aidy On 26/02/2009, Tom ten Thij

Re: [rspec-users] testing multiple sessions in cucumber/webrat

2009-03-02 Thread Bart Zonneveld
On 28-feb-2009, at 21:04, Joe Van Dyk wrote: Is it possible to have a scenario where you are testing the interaction between two different session? If you mean something along these lines: User A uploads a picture, User B logs in to see the picture uploaded by User A that is possible. I

Re: [rspec-users] Is there a way to generate spec for existing controllers?

2009-03-02 Thread Bart Zonneveld
On 2-mrt-2009, at 4:08, Phlip wrote: David Chelimsky wrote: ty wrote: We just start using RSpec and rspec_on_rails for a existing Rails project. No unit tests, right? After run script/generate rspec. It only generate the structure folders. We've got quite a few controllers and models.

Re: [rspec-users] be_valid (validates_format_of ..., :on = :create)

2009-03-02 Thread Bart Zonneveld
On 28-feb-2009, at 11:45, MAwiniarski wrote: Greetings, How to write Example which will check if model's variable's format is valid using :on = :create, like this: class User ActiveRecord::Base ... validates_format_of :email, :with = /.../, :on = :create ... Using following code is

Re: [rspec-users] [rails] An authorization question

2009-03-02 Thread Andrew Premdas
Personally I think this should be in the model layer. As you've pointed it you get alot of repetition if its in the controller layer. But putting business logic in the controller layer goes against the fundamentals of MVC, and is a bit of a Rails anti-pattern (fat controller). So given that the

[rspec-users] Feature Size-Scope-Scale

2009-03-02 Thread James Byrne
The more I work with BDD the more I realize how different this is from my previous experience. I now consider that part of the difficulty I have lies in establishing the proper scale for the features that I propose. My question lies in that vein. What size should a feature be? I have read a

Re: [rspec-users] Feature Size-Scope-Scale

2009-03-02 Thread Bart Zonneveld
On 2-mrt-2009, at 16:07, James Byrne wrote: The more I work with BDD the more I realize how different this is from my previous experience. I now consider that part of the difficulty I have lies in establishing the proper scale for the features that I propose. My question lies in that vein.

Re: [rspec-users] be_valid (validates_format_of ..., :on = :create)

2009-03-02 Thread David Chelimsky
On Mon, Mar 2, 2009 at 8:20 AM, Bart Zonneveld zuperinfin...@gmail.com wrote: On 28-feb-2009, at 11:45, MAwiniarski wrote: Greetings, How to write Example which will check if model's variable's format is valid using :on = :create, like this: class User ActiveRecord::Base ...  

Re: [rspec-users] Cucumber Feature Scenario critique

2009-03-02 Thread James Byrne
Andrew Premdas wrote: James, I'd question whether you need to give a monkey's about 'entity'. Whilst it maybe an essential concept in the overall legal framework that doesn't mean it has to be in YOUR world. If your software is about recording services provided to some client and related

Re: [rspec-users] be_valid (validates_format_of ..., :on = :create)

2009-03-02 Thread Bart Zonneveld
On 2-mrt-2009, at 16:50, David Chelimsky wrote: On Mon, Mar 2, 2009 at 8:20 AM, Bart Zonneveld zuperinfin...@gmail.com wrote: On 28-feb-2009, at 11:45, MAwiniarski wrote: Greetings, How to write Example which will check if model's variable's format is valid using :on = :create, like

Re: [rspec-users] Feature Size-Scope-Scale

2009-03-02 Thread Stephen Eley
On Mon, Mar 2, 2009 at 10:07 AM, James Byrne li...@ruby-forum.com wrote: I have read a great deal about scaling features in terms of hours of work.  However, at my present level of inefficiency, that will probably result in features that are too small just as I now believe that the features I

Re: [rspec-users] be_valid (validates_format_of ..., :on = :create)

2009-03-02 Thread David Chelimsky
On Mon, Mar 2, 2009 at 10:23 AM, Bart Zonneveld zuperinfin...@gmail.com wrote: On 2-mrt-2009, at 16:50, David Chelimsky wrote: On Mon, Mar 2, 2009 at 8:20 AM, Bart Zonneveld zuperinfin...@gmail.com wrote: On 28-feb-2009, at 11:45, MAwiniarski wrote: Greetings, How to write Example which

Re: [rspec-users] be_valid (validates_format_of ..., :on = :create)

2009-03-02 Thread Mark Wilden
On Mon, Mar 2, 2009 at 8:23 AM, Bart Zonneveld zuperinfin...@gmail.com wrote: On a second note, I noticed rspec default generated model specs now use Model.create!(@valid_attributes) as their default all is valid test. What's the advantage of this approach? I just write @model.attributes =

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

2009-03-02 Thread Mark Wilden
On Sun, Mar 1, 2009 at 9:07 PM, Stephen Eley sfe...@gmail.com wrote: For date testing, I've just discovered and successfully used Notahat's time_travel plugin: http://github.com/notahat/time_travel/ We have just been stubbing Time.now, but I'll think about time_travel. One advantage would be

Re: [rspec-users] Cucumber Feature Scenario critique

2009-03-02 Thread Mark Wilden
On Mon, Mar 2, 2009 at 7:31 AM, James Byrne li...@ruby-forum.com wrote:  Whether or not a client is a stand-alone design element or is dependent upon a superior element of abstraction is really quite beside the point insofar as the presentation of the system to the user is concerned. I like

Re: [rspec-users] [rails] An authorization question

2009-03-02 Thread James Byrne
Andrew Premdas wrote: So given that the rules should be in the model then the question is which part of the model should have this responsibility and how do you call it. Three choices come to mind here 1) Place the rule inside User 2) Place the rule inside the affected model 3) Create

Re: [rspec-users] [rails] An authorization question

2009-03-02 Thread James Byrne
Mark Wilden wrote: Actually, it's the other way around. http://www.pragprog.com/articles/tell-dont-ask I have read this article and it leaves me rather more confused than not. I gather that I am missing something fundamental. Consider that when I write x.to_s I am telling the object

Re: [rspec-users] [rails] An authorization question

2009-03-02 Thread James Byrne
Mark Wilden wrote: Actually, it's the other way around. http://www.pragprog.com/articles/tell-dont-ask Sigh... -- Posted via http://www.ruby-forum.com/. ___ rspec-users mailing list rspec-users@rubyforge.org

Re: [rspec-users] [rails] An authorization question

2009-03-02 Thread Phlip
James Byrne wrote: Is this a semantic confusion on my part? Should I consider that what I do with x.exists? is tell the object to answer a question? Consider... if x.exists? x.important_method() else # nothing! end Now lets upgrade the variable x. Sometimes it points to a

Re: [rspec-users] [rails] An authorization question

2009-03-02 Thread r_j_h_box-sf
- Original Message From: James Byrne li...@ruby-forum.com Mark Wilden wrote: Actually, it's the other way around. http://www.pragprog.com/articles/tell-dont-ask I have read this article and it leaves me rather more confused than not. That's the danger of

Re: [rspec-users] [rails] An authorization question

2009-03-02 Thread James Byrne
unknown wrote: sam.authorized?(controller_or_model, action)? I'll suggest that it's the controllers who are responsible for telling what role or other requirements need to be satisfied to get their services, and that it's the job of the user object (maybe by delegating to some role

Re: [rspec-users] [rails] An authorization question

2009-03-02 Thread Zach Dennis
On Mon, Mar 2, 2009 at 4:50 PM, Zach Dennis zach.den...@gmail.com wrote: On Mon, Mar 2, 2009 at 3:59 PM, James Byrne li...@ruby-forum.com wrote: unknown wrote: sam.authorized?(controller_or_model, action)? I'll suggest that it's the controllers who are responsible for telling what role or

Re: [rspec-users] [rails] An authorization question

2009-03-02 Thread Zach Dennis
On Mon, Mar 2, 2009 at 3:59 PM, James Byrne li...@ruby-forum.com wrote: unknown wrote: sam.authorized?(controller_or_model, action)? I'll suggest that it's the controllers who are responsible for telling what role or other requirements need to be satisfied to get their services, and that

Re: [rspec-users] Rspecing an enumerator from outside-in woes

2009-03-02 Thread Shot (Piotr Szotkowski)
Once again – thanks a ton for your response! I wish ‘The RSpec Book’ answered my use cases; I bought it hoping I’ll learn all this stuff from it, but it seems the most interesting chapters are not written yet. :) Matt Wynne: Assuming you wanted to keep your focus on the Decomposer class, but

Re: [rspec-users] Is there a way to generate spec for existing controllers?

2009-03-02 Thread Zach Dennis
On Sun, Mar 1, 2009 at 10:08 PM, Phlip phlip2...@gmail.com wrote: David Chelimsky wrote: ty wrote: We just start using RSpec and rspec_on_rails for a existing Rails project. No unit tests, right? After run script/generate rspec. It only generate the structure folders. We've got quite a

Re: [rspec-users] Rspecing an enumerator from outside-in woes

2009-03-02 Thread Matt Wynne
On 2 Mar 2009, at 23:32, Shot (Piotr Szotkowski) wrote: Once again – thanks a ton for your response! I wish ‘The RSpec Book’ answered my use cases; I bought it hoping I’ll learn all this stuff from it, but it seems the most interesting chapters are not written yet. :) Matt Wynne:

Re: [rspec-users] Cucumber for large projects

2009-03-02 Thread Matt Wynne
On 26 Feb 2009, at 15:33, Tom ten Thij wrote: We will be using Cucumber for a fairly large project. Are there any areas that cucumber is lacking when there are many scenarios? I believe the best candidate for showing our client the scenario results is the html output. It strikes me that that

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

2009-03-02 Thread Tim Walker
Absolutely. I'd respectfully suggest that this is more a requirement of the way the step definition or test fixture that implements the feature needs to behave than the intent of describing time based logic in a natural language such that product owners, ba's etc. can write them (i.e. Cucumber,

Re: [rspec-users] [rails] An authorization question

2009-03-02 Thread Stephen Eley
On Mon, Mar 2, 2009 at 5:16 PM, Zach Dennis zach.den...@gmail.com wrote: Forgot to mention what we did do. We ended up with the following... def index  if user.has_role?(admin)    user.in_role(admin).invoices  elsif user.has_role?(associate)    user.in_role(associate).invoices  else    

Re: [rspec-users] [rails] An authorization question

2009-03-02 Thread Zach Dennis
On Mon, Mar 2, 2009 at 11:35 PM, Stephen Eley sfe...@gmail.com wrote: On Mon, Mar 2, 2009 at 5:16 PM, Zach Dennis zach.den...@gmail.com wrote: Forgot to mention what we did do. We ended up with the following... def index if user.has_role?(admin) user.in_role(admin).invoices elsif

Re: [rspec-users] [rails] An authorization question

2009-03-02 Thread Mark Wilden
On Mon, Mar 2, 2009 at 8:35 PM, Stephen Eley sfe...@gmail.com wrote: �...@invoices = Invoice.by_role(user) It doesn't seem right to me that invoices know about users and roles. I think of invoices are being closer to the metal -- closer to the essence of the application -- than petty concerns

Re: [rspec-users] [rails] An authorization question

2009-03-02 Thread Stephen Eley
On Tue, Mar 3, 2009 at 1:04 AM, Mark Wilden m...@mwilden.com wrote: On Mon, Mar 2, 2009 at 8:35 PM, Stephen Eley sfe...@gmail.com wrote: �...@invoices = Invoice.by_role(user) It doesn't seem right to me that invoices know about users and roles. I would try something like