David Chelimsky
2007-May-05 02:57 UTC
[rspec-users] autogenerated it (was ''Custom Matcher and NAME NOT GENERATED annoyance'')
> On 5/5/07, Luis Lavena <luislavena at gmail.com> wrote: > > 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 > >When I''ve used the autogenerated names, I''ve used specify: specify { @user.should have_many(:contest_public_votes) } specify { @user.should have_many(:design_industry_user_interests) } specify { @user.should have_one(:user_extension) } That reads better than ''it'' in my view, but I''m not happy w/ ''specify'' either. What other words would make sense in this situation? One thing that occurs to me in this particular example is ''the'': describe User do the { @user.should have_many(:contest_public_votes) } the { @user.should have_many(:design_industry_user_interests) } the { @user.should have_one(:user_extension) } But I don''t know if that would work that often. Other ideas? David
Luis Lavena
2007-May-05 03:03 UTC
[rspec-users] autogenerated it (was ''Custom Matcher and NAME NOT GENERATED annoyance'')
On 5/4/07, David Chelimsky <dchelimsky at gmail.com> wrote:> > On 5/5/07, Luis Lavena <luislavena at gmail.com> wrote: > > > 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 > > > > > When I''ve used the autogenerated names, I''ve used specify: > > specify { @user.should have_many(:contest_public_votes) } > specify { @user.should have_many(:design_industry_user_interests) } > specify { @user.should have_one(:user_extension) } > > That reads better than ''it'' in my view, but I''m not happy w/ ''specify'' > either. What other words would make sense in this situation? One thing > that occurs to me in this particular example is ''the'': > > describe User do > the { @user.should have_many(:contest_public_votes) } > the { @user.should have_many(:design_industry_user_interests) } > the { @user.should have_one(:user_extension) } > > But I don''t know if that would work that often. > > Other ideas? >David, ''the'' is a good term to describe it, but there aren''t too many cases (er, examples) that could use that alias of it. I only see use for one expectation, auto-generated ones. -- 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
David Chelimsky
2007-May-05 03:08 UTC
[rspec-users] autogenerated it (was ''Custom Matcher and NAME NOT GENERATED annoyance'')
On 5/4/07, Luis Lavena <luislavena at gmail.com> wrote:> On 5/4/07, David Chelimsky <dchelimsky at gmail.com> wrote: > > > On 5/5/07, Luis Lavena <luislavena at gmail.com> wrote: > > > > 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 > > > > > > > > When I''ve used the autogenerated names, I''ve used specify: > > > > specify { @user.should have_many(:contest_public_votes) } > > specify { @user.should have_many(:design_industry_user_interests) } > > specify { @user.should have_one(:user_extension) } > > > > That reads better than ''it'' in my view, but I''m not happy w/ ''specify'' > > either. What other words would make sense in this situation? One thing > > that occurs to me in this particular example is ''the'': > > > > describe User do > > the { @user.should have_many(:contest_public_votes) } > > the { @user.should have_many(:design_industry_user_interests) } > > the { @user.should have_one(:user_extension) } > > > > But I don''t know if that would work that often. > > > > Other ideas? > > > > David, > > ''the'' is a good term to describe it, but there aren''t too many cases > (er, examples) that could use that alias of it. > > I only see use for one expectation, auto-generated ones.That''s what I''m talking about. In other words, "it" definitely works for non-auto-generated names: describe Thing do it "should do stuff" do I''m specifically looking for an alias that works well for auto-generated names, so if "the" only works well in that situation I''m OK w/ that. The thing I''m wondering is whether "the" would work for the majority of auto-generated-name examples, and whether it pushes you psychologically towards a certain type of example. It makes sense when you say: describe Thing do the { @thing.should do_something } or..... describe Thing do a { @thing.should do_something } But what other shapes do we need to consider?> > -- > 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-05 03:22 UTC
[rspec-users] autogenerated it (was ''Custom Matcher and NAME NOT GENERATED annoyance'')
On 5/5/07, David Chelimsky <dchelimsky at gmail.com> wrote: [...]> > I only see use for one expectation, auto-generated ones. > > That''s what I''m talking about. In other words, "it" definitely works > for non-auto-generated names: > > describe Thing do > it "should do stuff" do > > I''m specifically looking for an alias that works well for > auto-generated names, so if "the" only works well in that situation > I''m OK w/ that. > > The thing I''m wondering is whether "the" would work for the majority > of auto-generated-name examples, and whether it pushes you > psychologically towards a certain type of example. It makes sense when > you say: > > describe Thing do > the { @thing.should do_something } > > or..... > > describe Thing do > a { @thing.should do_something } > > But what other shapes do we need to consider? >''a'' or ''the'' could cover almost everything when talking of a specific model/object instance, like the examples I provided. for other cases, like the ones present in examples/ folder (auto_spec_description_example.rb) will sound a bit awkward: it { 3.should be < 5 } it { ["a"].should include("a") } it { [1,2,3].should respond_to(:size) } WTH, even ''it'' sounds weird in that context. -- 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
David Chelimsky
2007-May-05 03:26 UTC
[rspec-users] autogenerated it (was ''Custom Matcher and NAME NOT GENERATED annoyance'')
On 5/4/07, Luis Lavena <luislavena at gmail.com> wrote:> On 5/5/07, David Chelimsky <dchelimsky at gmail.com> wrote: > [...] > > > I only see use for one expectation, auto-generated ones. > > > > That''s what I''m talking about. In other words, "it" definitely works > > for non-auto-generated names: > > > > describe Thing do > > it "should do stuff" do > > > > I''m specifically looking for an alias that works well for > > auto-generated names, so if "the" only works well in that situation > > I''m OK w/ that. > > > > The thing I''m wondering is whether "the" would work for the majority > > of auto-generated-name examples, and whether it pushes you > > psychologically towards a certain type of example. It makes sense when > > you say: > > > > describe Thing do > > the { @thing.should do_something } > > > > or..... > > > > describe Thing do > > a { @thing.should do_something } > > > > But what other shapes do we need to consider? > > > > ''a'' or ''the'' could cover almost everything when talking of a specific > model/object instance, like the examples I provided. > > for other cases, like the ones present in examples/ folder > (auto_spec_description_example.rb) will sound a bit awkward: > > it { 3.should be < 5 } > > it { ["a"].should include("a") } > > it { [1,2,3].should respond_to(:size) } > > > WTH, even ''it'' sounds weird in that context.Those examples have not grown w/ the framework - we need to revisit them.> > -- > 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 >