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

aslak hellesoy aslak.hellesoy at gmail.com
Fri May 4 19:30:40 EDT 2007


This is a bug in RSpec. Could you file a bug report (for the record)
while I'm fixing it please?

Aslak

On 5/5/07, Luis Lavena <luislavena at gmail.com> wrote:
> 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.
> Example:
>
> describe "A User (in general)" do
>   before(:each) do
>     @user = User.new
>   end
>
>   it { @user.should have_many(:contest_public_votes) }
>   it { @user.should have_many(:design_industry_user_interests) }
>   it { @user.should have_one(:user_extension) }
> end
>
> 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
>
> _______________________________________________
> rspec-users mailing list
> rspec-users at rubyforge.org
> http://rubyforge.org/mailman/listinfo/rspec-users
>
>


More information about the rspec-users mailing list