Re: [rspec-users] Stories - Use view matchers rather than assigns[].should?

2008-04-10 Thread Ashley Moran
On 10 Apr 2008, at 04:20, Tim Haines wrote: Thanks Pat and David. I'm implementing paging (via will_paginate) and thought I should start with a story. I think I grok what you're saying Pat - the stories should only be looking at externally visible stuff - i.e. what a real user can

Re: [rspec-users] Netbeans and .story files

2008-04-10 Thread Ashley Moran
On 10 Apr 2008, at 02:32, Tim Haines wrote: Here's the url - http://www.netbeans.org/issues/show_bug.cgi?id=131684 Looks good! I like this bit: priority 1b - In the project pane, allow stories to sit as the first folder in the list, and rspec as the second - both above controllers. The

Re: [rspec-users] Stories - Use view matchers rather than assigns[].should?

2008-04-10 Thread Pat Maddox
On Wed, Apr 9, 2008 at 8:20 PM, Tim Haines [EMAIL PROTECTED] wrote: Thanks Pat and David. I'm implementing paging (via will_paginate) and thought I should start with a story. I think I grok what you're saying Pat - the stories should only be looking at externally visible stuff - i.e. what a

Re: [rspec-users] Stories - Use view matchers rather than assigns[].should?

2008-04-10 Thread Ashley Moran
On 10 Apr 2008, at 17:00, David Chelimsky wrote: otooh - having some scenarios logging in using a post and some by poking around under the hood creates an untested logical binding between the post and the poking. This has the same risk associated with it that raises so much concern about

Re: [rspec-users] Stories - Use view matchers rather than assigns[].should?

2008-04-10 Thread Pat Maddox
On Thu, Apr 10, 2008 at 9:21 AM, Ashley Moran [EMAIL PROTECTED] wrote: On 10 Apr 2008, at 17:00, David Chelimsky wrote: otooh - having some scenarios logging in using a post and some by poking around under the hood creates an untested logical binding between the post and the poking.

Re: [rspec-users] Stories - Use view matchers rather than assigns[].should?

2008-04-10 Thread David Chelimsky
On Apr 10, 2008, at 12:48 PM, Pat Maddox wrote: Keep in mind that not every step of every story needs to be a round-trip request. It's even good to write some stories that don't make requests at all! I definitely agree with this, however I do see a difference between accessing models

Re: [rspec-users] Multi-line steps

2008-04-10 Thread Glenn Ford
On Apr 9, 2008, at 5:04 PM, Pat Maddox wrote: On 4/9/08, Ashley Moran [EMAIL PROTECTED] wrote: On 9 Apr 2008, at 14:14, aslak hellesoy wrote: Just a style comment: I usually strive for a single When (in this case Fred uploads the csv file). The other ones are Givens. Hmm, I've

[rspec-users] mock_model

2008-04-10 Thread Anthony Broad-Crawford
Our company just had an interesting conversation around mock_model and I want to ask the same question to this audience. When creating mock_models what is the purpose of passing in the class constant? user = mock_model(User) To the best that we can tell the method mock_model doesn't

Re: [rspec-users] Multi-line steps

2008-04-10 Thread Ashley Moran
On 10 Apr 2008, at 18:28, Glenn Ford wrote: Given database is in this state When user does this stuff in browser Then database should be in this new state I like the way you phrased this Glenn. Maybe the distinction is that Given is everything outside the control of the user, or, if the

Re: [rspec-users] mock_model

2008-04-10 Thread David Chelimsky
On Thu, Apr 10, 2008 at 4:55 PM, Ashley Moran [EMAIL PROTECTED] wrote: David: +1 for stub_model, but could you make it autodetect if the stub is for an attribute or a method? It would be nice to do away with the :attr and :stub distinction. Not sure what you mean here - that is handled

Re: [rspec-users] Stories - Use view matchers rather than assigns[].should?

2008-04-10 Thread Ashley Moran
On 10 Apr 2008, at 17:59, David Chelimsky wrote: I definitely agree with this, however I do see a difference between accessing models directly through their API (which I do) and accessing the internals of the request cycle (which I don't). Ok that's what I was doing - not interfering with

Re: [rspec-users] Multi-line steps

2008-04-10 Thread Rick DeNatale
On Thu, Apr 10, 2008 at 5:25 PM, aslak hellesoy [EMAIL PROTECTED] wrote: This is a very technical way to express a scenario. It wouldn't make much sense to a typical domain expert (unless they know about databases). I generally try to write scenarios using the domain language,

Re: [rspec-users] Multi-line steps

2008-04-10 Thread Glenn Ford
This actually sounds more confusing to me when viewed in the context of my own stories, and it seems similar to what's going on here. I write a lot about the user's interaction with the site and what should happen, so I have a lot of stories that look like: Given database is in this

Re: [rspec-users] Stories - Use view matchers rather than assigns[].should?

2008-04-10 Thread Pat Maddox
On Thu, Apr 10, 2008 at 2:57 PM, Ashley Moran [EMAIL PROTECTED] wrote: Sorry wasn't clear what I meant. I was thinking something like Given ... When I run User.create!(:foo = bar) Then the Users page should have a row with bar in the foo column Gah, that looks hideous. When I

Re: [rspec-users] mock_model

2008-04-10 Thread Ashley Moran
On 10 Apr 2008, at 22:28, David Chelimsky wrote: Not sure what you mean here - that is handled transparently by stub_model so you don't have to make any such distinction. Take a look at http://github.com/dchelimsky/rspec-rails/tree/master/lib/spec/rails/example/rails_example_group.rb and

Re: [rspec-users] Stories - Use view matchers rather than assigns[].should?

2008-04-10 Thread Ashley Moran
On 10 Apr 2008, at 23:06, Pat Maddox wrote: Given ... When I run User.create!(:foo = bar) Then the Users page should have a row with bar in the foo column Gah, that looks hideous. I think you misunderstood the point - it's supposed to look hideous :) What I meant was if you have

[rspec-users] Creating stories for the second resource. Very wet approach

2008-04-10 Thread Tim Haines
Hi y'all I'm about to start writing up the stories for my second resource. The second resource is so similar to the first that I feel a good way for me to start might be to copy and paste the stories and edit from there. This seems very anti-dry though. Am I missing something obvious, or would

[rspec-users] newbq: Organizing your stories

2008-04-10 Thread Tim Haines
Hi, I'm a little unhappy with how my stories are organised, and am wondering if anyone has found any particular method nicest. I'm working within an admin namespace, and currently have a plain text story file for each controller in the admin folder. I also have a steps subfolder, with one step

Re: [rspec-users] how to stub the :current_user and any methods associated with it

2008-04-10 Thread newbie
Thanks for the direction. I'm glad to hear that I'm going in the right direction. I just have a final question and I seem to be hitting a stub/mocking road block at the moment. In my controller I have this... def index @entries = current_user.entries end How would I rspec this out correctly?

Re: [rspec-users] Multi-line steps

2008-04-10 Thread Rick DeNatale
On Thu, Apr 10, 2008 at 6:10 PM, Glenn Ford [EMAIL PROTECTED] wrote: Quoting Aslak Given the customers joe, paul and lisa are registered users When a user signs up as lisa Then the user should be informed that the name is taken And the user lisa should not be able to log in You're

Re: [rspec-users] Stories - Use view matchers rather than assigns[].should?

2008-04-10 Thread Rick DeNatale
On Thu, Apr 10, 2008 at 6:38 PM, Pat Maddox [EMAIL PROTECTED] wrote: On Thu, Apr 10, 2008 at 3:30 PM, Ashley Moran But say that actually, Given a user named Pat and Given the user is 22 years old are implemented as DB API calls - in this case is there merit to having a special set

Re: [rspec-users] Stories - Use view matchers rather than assigns[].should?

2008-04-10 Thread Kamal Fariz
When I create a user with foo=bar is better because it doesn't expose the implementation. Just the model concept and any relevant attributes. I hide model details from Stories by using webrat and form field labels. When I create a user with Username: kamal, Password: test And click submit

Re: [rspec-users] Stories - Use view matchers rather than assigns[].should?

2008-04-10 Thread Tim Haines
I read about webrat and stories 30 mins ago - http://www.benmabey.com/2008/02/04/rspec-plain-text-stories-webrat-chunky-bacon/- good article. Tim. On 11/04/2008, Kamal Fariz [EMAIL PROTECTED] wrote: When I create a user with foo=bar is better because it doesn't expose the implementation.

Re: [rspec-users] newbq: Organizing your stories

2008-04-10 Thread Zach Dennis
On Thu, Apr 10, 2008 at 8:46 PM, Tim Haines [EMAIL PROTECTED] wrote: Hi, I'm a little unhappy with how my stories are organised, and am wondering if anyone has found any particular method nicest. I'm working within an admin namespace, and currently have a plain text story file for each