John Feminella
2011-Sep-07 11:50 UTC
[rspec-users] Is there a way to get an "around" hook for each spec file?
Is there a way to run an `around` block once for every spec *file* (not spec)? (I want to measure which files take the longest amount of time, count the number of specs in each file, and then report the average spec running time for that file.) ~ jf -- John Feminella Principal Consultant, BitsBuilder LI: http://www.linkedin.com/in/johnxf SO: http://stackoverflow.com/users/75170/
David Chelimsky
2011-Sep-07 12:52 UTC
[rspec-users] Is there a way to get an "around" hook for each spec file?
On Sep 7, 2011, at 6:50 AM, John Feminella wrote:> Is there a way to run an `around` block once for every spec *file* > (not spec)?Not at this point, and I don''t think it would be a slam dunk to add.> (I want to measure which files take the longest amount of > time, count the number of specs in each file, and then report the > average spec running time for that file.)You can use before/after all in the outermost group: describe "thing" do before(:all) { set_up_measurements } after(:all) { report_measurements } end HTH, David> > ~ jf > -- > John Feminella > Principal Consultant, BitsBuilder > LI: http://www.linkedin.com/in/johnxf > SO: http://stackoverflow.com/users/75170/
Justin Ko
2011-Sep-07 13:00 UTC
[rspec-users] Is there a way to get an "around" hook for each spec file?
On Wed, Sep 7, 2011 at 5:50 AM, John Feminella <johnf at bitsbuilder.com>wrote:> Is there a way to run an `around` block once for every spec *file* > (not spec)? (I want to measure which files take the longest amount of > time, count the number of specs in each file, and then report the > average spec running time for that file.) > > ~ jf > -- > John Feminella > Principal Consultant, BitsBuilder > LI: http://www.linkedin.com/in/johnxf > SO: http://stackoverflow.com/users/75170/ > _______________________________________________ > rspec-users mailing list > rspec-users at rubyforge.org > http://rubyforge.org/mailman/listinfo/rspec-users >Why not just use the --profile option? -------------- next part -------------- An HTML attachment was scrubbed... URL: <http://rubyforge.org/pipermail/rspec-users/attachments/20110907/15808e38/attachment.html>
John Feminella
2011-Sep-07 14:13 UTC
[rspec-users] Is there a way to get an "around" hook for each spec file?
> Why not just use the --profile option?Doesn''t --profile only return the ten slowest examples? I have thousands of specs, so I need a little more data than that. ~ jf -- John Feminella Principal Consultant, BitsBuilder LI: http://www.linkedin.com/in/johnxf SO: http://stackoverflow.com/users/75170/ On Wed, Sep 7, 2011 at 09:00, Justin Ko <jko170 at gmail.com> wrote:> > > On Wed, Sep 7, 2011 at 5:50 AM, John Feminella <johnf at bitsbuilder.com> > wrote: >> >> Is there a way to run an `around` block once for every spec *file* >> (not spec)? (I want to measure which files take the longest amount of >> time, count the number of specs in each file, and then report the >> average spec running time for that file.) >> >> ~ jf >> -- >> John Feminella >> Principal Consultant, BitsBuilder >> LI: http://www.linkedin.com/in/johnxf >> SO: http://stackoverflow.com/users/75170/ >> _______________________________________________ >> rspec-users mailing list >> rspec-users at rubyforge.org >> http://rubyforge.org/mailman/listinfo/rspec-users > > > Why not just use the --profile option? > _______________________________________________ > rspec-users mailing list > rspec-users at rubyforge.org > http://rubyforge.org/mailman/listinfo/rspec-users >