[rspec-users] Custom Matcher and NAME NOT GENERATED annoyance

Luis Lavena luislavena at gmail.com
Fri May 4 18:47:21 EDT 2007

Hello RSpec users,

Have been using RSpec since 0.8.2 (not too long ago, I must say). and
been creating my custom matchers since was defined as "good practice".

Also, auto-generated names for the examples is very helpful, I'm
trying to take advantage of it.

Since I often prior code/define all the "examples", I have created a
few matchers to fulfill associations and validations of attributes.

describe "A User (in general)" do
  before(:each) do
    @user = User.new

  it { @user.should have_many(:contest_public_votes) }
  it { @user.should have_many(:design_industry_user_interests) }
  it { @user.should have_one(:user_extension) }

That creates the following descriptions:

A User (in general)
- should has_many contest_public_votes
- should has_many design_industry_user_interests
- should has_one user_extension

A new User
- should not be valid without first_name
- should not be valid without last_name
- should not be valid without login
- should not be valid without email
- should not be valid without password
- should not be valid without password_confirmation
- should not be valid without city
- should not be valid without postal_code
- should not be valid without country
- should not be valid with duplicate login
- should not be valid with duplicate email

(I omitted the second description).

Anyway, the problem started with latest release, which if someone my
matcher shows a problem, NAME NOT GENERATED was put in the description
instead of my fancy, nicely done name ;-)

Attached I have included a faulty matcher that shows the issue.

If someone could point me in the right direction to patch rspec, I'll
really apreciate.

Is not critical, but is a bit "disturbing" during the matchers
creation process ;-)

Regards and thanks in advance,

Luis Lavena
Multimedia systems
Leaders are made, they are not born. They are made by hard effort,
which is the price which all of us must pay to achieve any goal that
is worthwhile.
Vince Lombardi
-------------- next part --------------
A non-text attachment was scrubbed...
Name: matcher_spec.rb
Type: application/octet-stream
Size: 980 bytes
Desc: not available
Url : http://rubyforge.org/pipermail/rspec-users/attachments/20070504/11cc961f/attachment.obj 

More information about the rspec-users mailing list