Re: [rspec-users] Can some one please explain why one of those two examples fails?

2012-03-17 Thread Mike Mazur
Hi, On Thu, Mar 15, 2012 at 20:46, Mohamad El-Husseini husseini@gmail.com wrote: Thanks, Mike. I appreciate the explanation. It's tricky knowing what runs when, and what variable is in what scope. It seems like code smell to add an instance variable to the before block. I don't

Re: [rspec-users] Can some one please explain why one of those two examples fails?

2012-03-15 Thread Mohamad El-Husseini
Thanks, Mike. I appreciate the explanation. It's tricky knowing what runs when, and what variable is in what scope. It seems like code smell to add an instance variable to the before block. I don't understand what advantage one approach has over the other. What would you use, the first, that

Re: [rspec-users] Can some one please explain why one of those two examples fails?

2012-03-15 Thread Michael Kintzer
In your first example, last_token is declared in a before block, which means you need to mark it as an instance variable of the ExampleGroup '@' to reference it in the examples within the context. You don't need to do that when you use let. Also you don't need to declare the redundant let

Re: [rspec-users] Can some one please explain why one of those two examples fails?

2012-03-15 Thread Zach Dennis
On Thu, Mar 15, 2012 at 8:46 AM, Mohamad El-Husseini husseini@gmail.com wrote: Thanks, Mike. I appreciate the explanation. It's tricky knowing what runs when, and what variable is in what scope. It seems like code smell to add an instance variable to the before block. I don't understand

Re: [rspec-users] Can some one please explain why one of those two examples fails?

2012-03-13 Thread Mike Mazur
Hi, On Wed, Mar 14, 2012 at 07:55, Mohamad El-Husseini husseini@gmail.com wrote: The following are what I believe two ways of doing the same thing. Only the first example fails, while the latter passes. In your failing example: context generates a unique password_reset_token each time