Topic: rSpec examples to learn from

I am looking for some open source Ruby/Rails projects that are rSpec'd. Anyone know of some?

I thought about how mothers feed their babies with tiny little spoons and forks, so I wondered what do Chinese mothers use. Toothpicks?

Re: rSpec examples to learn from

I'm not sure if there's anything open sourced, but Luke Redpath is an rSpec (or perhaps more correctly, BDD) fan. See this: … pec-part-1

Perhaps you can find more examples...

Re: rSpec examples to learn from

Well, you got me thinking about the whole BDD thing and I revisited it. They've done a lot of work on making it work with Rails, so I created a spec for an existing User model. That raised some questions for me.

Here's the specdoc:

A user.
- should be invalid without a user name
- should be invalid without a password
- should be invalid without an email address
- an admin user should be created if no users are present
- there should be two active users
- there should be one inactive user
- password should be hashed producing salt and digest
- known user should authenticate
- bogus user should not authenticate
- logged in user's name should be retrievable

I'm pretty happy with the spec except the part about two active users and one inactive user. I need to test class methods that find collections of active and inactive users, so I created an arbitrary number of each in my fixture. Does this testing rather than specing seem reasonable? If now, what is an alternative way to test finders like these.