Hi List, Being pretty lazy here, but I figure you can help very quickly and others might benefit from the results. I write old crumbly rspec (see gist http://gist.github.com/411689), and I would like to improve, can you take my crumbly spec and make it shiny? Also if you can post any links to recent relevant blog articles that would be much appreciated Best one I can find at the moment is: http://eggsonbread.com/2010/03/28/my-rspec-best-practices-and-tips/ TIA Andrew -------------- next part -------------- An HTML attachment was scrubbed... URL: <http://rubyforge.org/pipermail/rspec-users/attachments/20100524/cf92a2a1/attachment.html>
Cursory look at that blog post seems like it''s covered most of what''s in this talk, but worth mentioning anyway, it''s good: http://pure-rspec-rubynation.heroku.com/ http://video2010.scottishrubyconference.com/show_video/3/1 On 24 May 2010, at 10:33, Andrew Premdas wrote:> Hi List, > > Being pretty lazy here, but I figure you can help very quickly and others might benefit from the results. I write old crumbly rspec (see gist http://gist.github.com/411689), and I would like to improve, can you take my crumbly spec and make it shiny? > > Also if you can post any links to recent relevant blog articles that would be much appreciated > > Best one I can find at the moment is: > > http://eggsonbread.com/2010/03/28/my-rspec-best-practices-and-tips/ > > TIA > > Andrew > > _______________________________________________ > rspec-users mailing list > rspec-users at rubyforge.org > http://rubyforge.org/mailman/listinfo/rspec-users-------------- next part -------------- An HTML attachment was scrubbed... URL: <http://rubyforge.org/pipermail/rspec-users/attachments/20100526/6829bf51/attachment.html>
What is the functional difference between "it" and "specify" Thanks! Tim On Tue, May 25, 2010 at 5:18 PM, Matt Wynne <matt at mattwynne.net> wrote:> Cursory look at that blog post seems like it''s covered most of what''s in > this talk, but worth mentioning anyway, it''s good: > http://pure-rspec-rubynation.heroku.com/ > http://video2010.scottishrubyconference.com/show_video/3/1 > On 24 May 2010, at 10:33, Andrew Premdas wrote: > > Hi List, > Being pretty lazy here, but I figure you can help very quickly and others > might benefit from the results. I write old crumbly rspec (see > gist?http://gist.github.com/411689), and I would like to improve, can you > take my crumbly spec and make it shiny? > Also if you can post any links to recent relevant blog articles that would > be much appreciated > Best one I can find at the moment is: > http://eggsonbread.com/2010/03/28/my-rspec-best-practices-and-tips/ > TIA > Andrew > _______________________________________________ > rspec-users mailing list > rspec-users at rubyforge.org > http://rubyforge.org/mailman/listinfo/rspec-users > > _______________________________________________ > rspec-users mailing list > rspec-users at rubyforge.org > http://rubyforge.org/mailman/listinfo/rspec-users >
On May 26, 2010, at 3:23 PM, Tim Walker wrote:> What is the functional difference between "it" and "specify"None.> > Thanks! > > Tim > > On Tue, May 25, 2010 at 5:18 PM, Matt Wynne <matt at mattwynne.net> wrote: >> Cursory look at that blog post seems like it''s covered most of what''s in >> this talk, but worth mentioning anyway, it''s good: >> http://pure-rspec-rubynation.heroku.com/ >> http://video2010.scottishrubyconference.com/show_video/3/1 >> On 24 May 2010, at 10:33, Andrew Premdas wrote: >> >> Hi List, >> Being pretty lazy here, but I figure you can help very quickly and others >> might benefit from the results. I write old crumbly rspec (see >> gist http://gist.github.com/411689), and I would like to improve, can you >> take my crumbly spec and make it shiny? >> Also if you can post any links to recent relevant blog articles that would >> be much appreciated >> Best one I can find at the moment is: >> http://eggsonbread.com/2010/03/28/my-rspec-best-practices-and-tips/ >> TIA >> Andrew >> _______________________________________________ >> rspec-users mailing list >> rspec-users at rubyforge.org >> http://rubyforge.org/mailman/listinfo/rspec-users >> >> _______________________________________________ >> rspec-users mailing list >> rspec-users at rubyforge.org >> http://rubyforge.org/mailman/listinfo/rspec-users >> > _______________________________________________ > rspec-users mailing list > rspec-users at rubyforge.org > http://rubyforge.org/mailman/listinfo/rspec-users
As David said, there is no difference between "it" and "specify". One of them is alias of other one. However semantically you can use them differently. The two examples given below are same. However second one reads better. I like to use specify when I have explicitly created a subject. Implicit subjects read better with it. describe User do context "create a user" do subject { User.create(:email => ''second at example.com'') } it { subject.id.should_not be_nil} end end describe User do context "create a user" do subject { User.create(:email => ''second at example.com'') } specify { subject.id.should_not be_nil} end end On May 26, 4:29?pm, David Chelimsky <dchelim... at gmail.com> wrote:> On May 26, 2010, at 3:23 PM, Tim Walker wrote: > > > What is the functional difference between "it" and "specify" > > None. > > > > > > > > > Thanks! > > > Tim > > > On Tue, May 25, 2010 at 5:18 PM, Matt Wynne <m... at mattwynne.net> wrote: > >> Cursory look at that blog post seems like it''s covered most of what''s in > >> this talk, but worth mentioning anyway, it''s good: > >>http://pure-rspec-rubynation.heroku.com/ > >>http://video2010.scottishrubyconference.com/show_video/3/1 > >> On 24 May 2010, at 10:33, Andrew Premdas wrote: > > >> Hi List, > >> Being pretty lazy here, but I figure you can help very quickly and others > >> might benefit from the results. I write old crumbly rspec (see > >> gisthttp://gist.github.com/411689), and I would like to improve, can you > >> take my crumbly spec and make it shiny? > >> Also if you can post any links to recent relevant blog articles that would > >> be much appreciated > >> Best one I can find at the moment is: > >>http://eggsonbread.com/2010/03/28/my-rspec-best-practices-and-tips/ > >> TIA > >> Andrew > >> _______________________________________________ > >> rspec-users mailing list > >> rspec-us... at rubyforge.org > >>http://rubyforge.org/mailman/listinfo/rspec-users > > >> _______________________________________________ > >> rspec-users mailing list > >> rspec-us... at rubyforge.org > >>http://rubyforge.org/mailman/listinfo/rspec-users > > > _______________________________________________ > > rspec-users mailing list > > rspec-us... at rubyforge.org > >http://rubyforge.org/mailman/listinfo/rspec-users > > _______________________________________________ > rspec-users mailing list > rspec-us... at rubyforge.orghttp://rubyforge.org/mailman/listinfo/rspec-users
On May 26, 2010, at 4:05 PM, Nadal wrote:> As David said, there is no difference between "it" and "specify". One > of them is alias of other one. However semantically you can use them > differently. > > The two examples given below are same. However second one reads > better. I like to use specify when I have explicitly created a > subject. Implicit subjects read better with it. > > describe User do > context "create a user" do > subject { User.create(:email => ''second at example.com'') } > it { subject.id.should_not be_nil} > end > end > > describe User do > context "create a user" do > subject { User.create(:email => ''second at example.com'') } > specify { subject.id.should_not be_nil} > end > end >In this case you can also use "its": describe User do context "create a user" do subject { User.create(:email => ''second at example.com'') } its(:id) { should_not be_nil} end end That doesn''t always work out well, depending on how deep you need to dig into the subject, but it can work well in some cases. Cheers, David> On May 26, 4:29 pm, David Chelimsky <dchelim... at gmail.com> wrote: >> On May 26, 2010, at 3:23 PM, Tim Walker wrote: >> >>> What is the functional difference between "it" and "specify" >> >> None. >> >> >> >> >> >> >> >>> Thanks! >> >>> Tim >> >>> On Tue, May 25, 2010 at 5:18 PM, Matt Wynne <m... at mattwynne.net> wrote: >>>> Cursory look at that blog post seems like it''s covered most of what''s in >>>> this talk, but worth mentioning anyway, it''s good: >>>> http://pure-rspec-rubynation.heroku.com/ >>>> http://video2010.scottishrubyconference.com/show_video/3/1 >>>> On 24 May 2010, at 10:33, Andrew Premdas wrote: >> >>>> Hi List, >>>> Being pretty lazy here, but I figure you can help very quickly and others >>>> might benefit from the results. I write old crumbly rspec (see >>>> gisthttp://gist.github.com/411689), and I would like to improve, can you >>>> take my crumbly spec and make it shiny? >>>> Also if you can post any links to recent relevant blog articles that would >>>> be much appreciated >>>> Best one I can find at the moment is: >>>> http://eggsonbread.com/2010/03/28/my-rspec-best-practices-and-tips/ >>>> TIA >>>> Andrew >>>> _______________________________________________ >>>> rspec-users mailing list >>>> rspec-us... at rubyforge.org >>>> http://rubyforge.org/mailman/listinfo/rspec-users >> >>>> _______________________________________________ >>>> rspec-users mailing list >>>> rspec-us... at rubyforge.org >>>> http://rubyforge.org/mailman/listinfo/rspec-users >> >>> _______________________________________________ >>> rspec-users mailing list >>> rspec-us... at rubyforge.org >>> http://rubyforge.org/mailman/listinfo/rspec-users >> >> _______________________________________________ >> rspec-users mailing list >> rspec-us... at rubyforge.orghttp://rubyforge.org/mailman/listinfo/rspec-users > _______________________________________________ > rspec-users mailing list > rspec-users at rubyforge.org > http://rubyforge.org/mailman/listinfo/rspec-users
I knew its existed but did not know any use case. Thanks for an excellent example. As you said in some cases its might make sentence more readable. good stuff. On May 26, 5:46?pm, David Chelimsky <dchelim... at gmail.com> wrote:> On May 26, 2010, at 4:05 PM, Nadal wrote: > > > > > > > As David said, there is no difference between "it" and "specify". One > > of them is alias of other one. However semantically you can use them > > differently. > > > The two examples given below are same. However second one reads > > better. I like to use specify when I have explicitly created a > > subject. Implicit subjects read better with it. > > > describe User do > > ?context "create a user" do > > ? ?subject { User.create(:email => ''sec... at example.com'') } > > ? ?it { subject.id.should_not be_nil} > > ?end > > end > > > describe User do > > ?context "create a user" do > > ? ?subject { User.create(:email => ''sec... at example.com'') } > > ? ?specify { subject.id.should_not be_nil} > > ?end > > end > > In this case you can also use "its": > > describe User do > ? context "create a user" do > ? ? subject { User.create(:email => ''sec... at example.com'') } > ? ? its(:id) { should_not be_nil} > ? end > end > > That doesn''t always work out well, depending on how deep you need to dig into the subject, but it can work well in some cases. > > Cheers, > David > > > > > > > On May 26, 4:29 pm, David Chelimsky <dchelim... at gmail.com> wrote: > >> On May 26, 2010, at 3:23 PM, Tim Walker wrote: > > >>> What is the functional difference between "it" and "specify" > > >> None. > > >>> Thanks! > > >>> Tim > > >>> On Tue, May 25, 2010 at 5:18 PM, Matt Wynne <m... at mattwynne.net> wrote: > >>>> Cursory look at that blog post seems like it''s covered most of what''s in > >>>> this talk, but worth mentioning anyway, it''s good: > >>>>http://pure-rspec-rubynation.heroku.com/ > >>>>http://video2010.scottishrubyconference.com/show_video/3/1 > >>>> On 24 May 2010, at 10:33, Andrew Premdas wrote: > > >>>> Hi List, > >>>> Being pretty lazy here, but I figure you can help very quickly and others > >>>> might benefit from the results. I write old crumbly rspec (see > >>>> gisthttp://gist.github.com/411689), and I would like to improve, can you > >>>> take my crumbly spec and make it shiny? > >>>> Also if you can post any links to recent relevant blog articles that would > >>>> be much appreciated > >>>> Best one I can find at the moment is: > >>>>http://eggsonbread.com/2010/03/28/my-rspec-best-practices-and-tips/ > >>>> TIA > >>>> Andrew > >>>> _______________________________________________ > >>>> rspec-users mailing list > >>>> rspec-us... at rubyforge.org > >>>>http://rubyforge.org/mailman/listinfo/rspec-users > > >>>> _______________________________________________ > >>>> rspec-users mailing list > >>>> rspec-us... at rubyforge.org > >>>>http://rubyforge.org/mailman/listinfo/rspec-users > > >>> _______________________________________________ > >>> rspec-users mailing list > >>> rspec-us... at rubyforge.org > >>>http://rubyforge.org/mailman/listinfo/rspec-users > > >> _______________________________________________ > >> rspec-users mailing list > >> rspec-us... at rubyforge.orghttp://rubyforge.org/mailman/listinfo/rspec-users > > _______________________________________________ > > rspec-users mailing list > > rspec-us... at rubyforge.org > >http://rubyforge.org/mailman/listinfo/rspec-users > > _______________________________________________ > rspec-users mailing list > rspec-us... at rubyforge.orghttp://rubyforge.org/mailman/listinfo/rspec-users