Luis Lavena
2007-May-04 22:47 UTC
[rspec-users] Custom Matcher and NAME NOT GENERATED annoyance
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 -------------- 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
aslak hellesoy
2007-May-04 23:30 UTC
[rspec-users] Custom Matcher and NAME NOT GENERATED annoyance
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 > >
Luis Lavena
2007-May-04 23:35 UTC
[rspec-users] Custom Matcher and NAME NOT GENERATED annoyance
On 5/4/07, aslak hellesoy <aslak.hellesoy at gmail.com> wrote:> This is a bug in RSpec. Could you file a bug report (for the record) > while I''m fixing it please? > > Aslak >Filled :-) [#10594] Failing Custom Matcher show NAME NOT GENERATED description http://rubyforge.org/tracker/index.php?func=detail&aid=10594&group_id=797&atid=3149 Thank you Aslak for the quick reply. -- 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