[rspec-users] Backtrace for passing specs via custom formatter
Hi, I'm using example.implementation_backtrace in a custom formatter to get the path of the file a passing spec belongs to. Following rspec on github I saw that implementation_backtrace is now deprecated and replaced by example.backtrace. Sadly it always returns nil for passed specs. So I had a look at the source and found that backtrace only gets assigned if line_number was set. Can anybody tell me why this was changed to only work with line_number set and if there is another way to get the file a spec belongs to. Thanks for your help! lg // andreas ___ rspec-users mailing list rspec-users@rubyforge.org http://rubyforge.org/mailman/listinfo/rspec-users
Re: [rspec-users] Missing method implementation_backtrace
On Fri, Nov 21, 2008 at 2:28 PM, aslak hellesoy <[EMAIL PROTECTED]> wrote: > How will people know that a method is part of an API? Can we simply say that > if it has RDoc it's part of the API and stable, and if it doesn't it's not? > (We can still RDoc non-API code, just put :nodoc: on it so it doesn't get > part of the API docs). > > WDYT? Wouldn't it be better to have a kind of standalone api. An interface where the internal implementation can be changed but the public one stays (mostly) consistent over different releases? IMO going this way, the rspec-development would be more aware of changes to that API. lg // andreas > Aslak > >> >> Cheers, >> David >> >> >> >> > >> > >> > lg // andreas >> > >> > >> > On 20 Nov., 20:37, Scott Taylor <[EMAIL PROTECTED]> wrote: >> >> On Nov 20, 2008, at 2:35 PM, David Chelimsky wrote: >> >> >> >> >> >> >> >> > On Thu, Nov 20, 2008 at 12:44 PM, Ben Fyvie >> >> > <[EMAIL PROTECTED] >> >> > > wrote: >> >> >> We just upgraded from rspec version 1.1.4 to rspec version 1.1.11 >> >> >> and found >> >> >> that this no longer exists: >> >> >> >> >> # File lib/spec/example/example_methods.rb, line 84 >> >> >> >> >> def implementation_backtrace >> >> >> >> >>eval("caller", @_implementation) >> >> >> >> >> end >> >> >> >> >> I don't really know what this method is for and don't really care >> >> >> that it is >> >> >> gone; however, Netbeans 6.5 does care that it is gone and is not >> >> >> able to run >> >> >> tests without it. As a temporary band-aid I have added the method >> >> >> back >> >> >> locally. I was wondering if someone could enlighten me as to why >> >> >> the method >> >> >> was removed? >> >> >> >> > Unfortunately we don't yet have a formal API for tool vendors to use, >> >> > so NetBeans apparently used a method that we view as internal and it >> >> > got moved or renamed during a refactoring. >> >> >> >> > This is something we plan to address over the coming months: >> >> > formalizing an API for extension and tool use. >> >> >> >> Also, check out this: >> >> >> >> http://metaclass.org/2008/6/7/calling-in-the-dark >> >> >> >> Scott >> >> >> >> ___ >> >> rspec-users mailing list >> >> >> >> [EMAIL PROTECTED]://rubyforge.org/mailman/listinfo/rspec-users >> > ___ >> > rspec-users mailing list >> > rspec-users@rubyforge.org >> > http://rubyforge.org/mailman/listinfo/rspec-users >> > >> ___ >> rspec-users mailing list >> rspec-users@rubyforge.org >> http://rubyforge.org/mailman/listinfo/rspec-users > > > ___ > rspec-users mailing list > rspec-users@rubyforge.org > http://rubyforge.org/mailman/listinfo/rspec-users > ___ rspec-users mailing list rspec-users@rubyforge.org http://rubyforge.org/mailman/listinfo/rspec-users
Re: [rspec-users] Missing method implementation_backtrace
On Fri, Nov 21, 2008 at 2:28 PM, aslak hellesoy <[EMAIL PROTECTED]> wrote: > How will people know that a method is part of an API? Can we simply say that > if it has RDoc it's part of the API and stable, and if it doesn't it's not? > (We can still RDoc non-API code, just put :nodoc: on it so it doesn't get > part of the API docs). > > WDYT? > > Aslak Wouldn't it be better to have a kind of standalone api. An interface where the internal implementation can be changed but the public one stays (mostly) consistent over different releases? IMO going this way, the rspec-development would be more aware of changes to that API. lg // andreas >> Cheers, >> David >> >> >> >> > >> > >> > lg // andreas >> > >> > >> > On 20 Nov., 20:37, Scott Taylor <[EMAIL PROTECTED]> wrote: >> >> On Nov 20, 2008, at 2:35 PM, David Chelimsky wrote: >> >> >> >> >> >> >> >> > On Thu, Nov 20, 2008 at 12:44 PM, Ben Fyvie >> >> > <[EMAIL PROTECTED] >> >> > > wrote: >> >> >> We just upgraded from rspec version 1.1.4 to rspec version 1.1.11 >> >> >> and found >> >> >> that this no longer exists: >> >> >> >> >> # File lib/spec/example/example_methods.rb, line 84 >> >> >> >> >> def implementation_backtrace >> >> >> >> >>eval("caller", @_implementation) >> >> >> >> >> end >> >> >> >> >> I don't really know what this method is for and don't really care >> >> >> that it is >> >> >> gone; however, Netbeans 6.5 does care that it is gone and is not >> >> >> able to run >> >> >> tests without it. As a temporary band-aid I have added the method >> >> >> back >> >> >> locally. I was wondering if someone could enlighten me as to why >> >> >> the method >> >> >> was removed? >> >> >> >> > Unfortunately we don't yet have a formal API for tool vendors to use, >> >> > so NetBeans apparently used a method that we view as internal and it >> >> > got moved or renamed during a refactoring. >> >> >> >> > This is something we plan to address over the coming months: >> >> > formalizing an API for extension and tool use. >> >> >> >> Also, check out this: >> >> >> >> http://metaclass.org/2008/6/7/calling-in-the-dark >> >> >> >> Scott >> >> >> >> ___ >> >> rspec-users mailing list >> >> >> >> [EMAIL PROTECTED]://rubyforge.org/mailman/listinfo/rspec-users >> > ___ >> > rspec-users mailing list >> > rspec-users@rubyforge.org >> > http://rubyforge.org/mailman/listinfo/rspec-users >> > >> ___ >> rspec-users mailing list >> rspec-users@rubyforge.org >> http://rubyforge.org/mailman/listinfo/rspec-users > > > ___ > rspec-users mailing list > rspec-users@rubyforge.org > http://rubyforge.org/mailman/listinfo/rspec-users > ___ rspec-users mailing list rspec-users@rubyforge.org http://rubyforge.org/mailman/listinfo/rspec-users
[rspec-users] Testing a nested controller
Hey everyone. I really stuck on testing a nested controller. I'm trying to make a request using get and afterwards checking the response by response.should ... My routes.rb looks like this: map.resources :writers do |writers| writers.resources :notes end In my notes_controller_spec.rb def do_get writer_id = 1 note_id = 1 get note_path(writer_id, note_id) end it "should show a note" do do_get response.should be_success end But this always ends in an error message: You have a nil object when you didn't expect it! The error occurred while evaluating nil.rewrite Can anybody help here?? -- by(e) Andreas Wolff ___ rspec-users mailing list rspec-users@rubyforge.org http://rubyforge.org/mailman/listinfo/rspec-users
Re: [rspec-users] Testing a nested controller
Ok. this was stupid :) I found the answer two minutes later: You cannot use the url helper here, but if you provide the writers id in the request everything works fine: testing the route: route_for(:controller => "notes", :action => "show", :id => 1, :writer_id => 1) testing the request by: get :show, :id => 1, :writer_id => 1 bye On 9/14/07, Andreas Wolff <[EMAIL PROTECTED]> wrote: > Hey everyone. > I really stuck on testing a nested controller. I'm trying to make a > request using get and afterwards checking the response by > response.should ... > > My routes.rb looks like this: > > map.resources :writers do |writers| > writers.resources :notes > end > > > In my notes_controller_spec.rb > > def do_get > writer_id = 1 > note_id = 1 > get note_path(writer_id, note_id) > end > > it "should show a note" do > do_get > response.should be_success > end > > > But this always ends in an error message: > You have a nil object when you didn't expect it! > The error occurred while evaluating nil.rewrite > > Can anybody help here?? > > -- > by(e) > Andreas Wolff > -- by(e) Andreas Wolff http://rubyblog.de | http://activerails.de ___ rspec-users mailing list rspec-users@rubyforge.org http://rubyforge.org/mailman/listinfo/rspec-users
[rspec-users] Testing nested controller
Hey everyone. I really stuck on testing a nested controller. I'm trying to make a request using get and afterwards checking the response by response.should ... My routes.rb looks like this: map.resources :writers do |writers| writers.resources :notes end In my notes_controller_spec.rb def do_get writer_id = 1 note_id = 1 get note_path(writer_id, note_id) end it "should show a note" do do_get response.should be_success end But this always ends in an error message: You have a nil object when you didn't expect it! The error occurred while evaluating nil.rewrite Can anybody help here?? -- by(e) Andreas Wolff ___ rspec-users mailing list rspec-users@rubyforge.org http://rubyforge.org/mailman/listinfo/rspec-users
[rspec-users] Strange behaviour with pending specs and implementation_backtrace
Hi all, I'm using my own OutputFormatter with /bin/spec to catch rspec results. I'm experiencing strange behaviour with pending specs and implementation_backtrace. This is my example_pending implementation in rspactor_formatter.rb: class RSpactorFormatter def example_pending(example, message) spec = SpecObject.new( :name => example.description, :example_group_name => @example_group.description, :state => :pending, :message=> message, :backtrace => example.implementation_backtrace ) @remote_service.incoming(:spec_run_example_pending, spec) end end If my code contains a pending example in test_spec.rb like this: it 'should be pending' do pending end 'example.implementation_backtrace' contains the correct file path. If I change the implementation to: it 'should be pending' 'example.implementation_backtrace' doesn't contain the correct file path anymore. Instead the backtrace ends with my custom formatter file 'rspactor_formatter.rb'. Is this behaviour correct? Am I something missing? bye -- Andreas Wolff DynamicDudes Lightweight Ruby on Rails application development http://dynamicdudes.com hire: +49 151 58 54 78 50 home: http://rubyphunk.com ___ rspec-users mailing list rspec-users@rubyforge.org http://rubyforge.org/mailman/listinfo/rspec-users
[rspec-users] Do you remember RSpactor?
It took me a while to get the next release out, but I finally managed to release RSpactor 0.9.16, a Mac OS X RSpec runner. There are no new features but RSpactor should be a lot more stable and responsive now. If you want to have a look and download: http://rubyphunk.com/articles/2008/08/04/now-on-stock-rspactor-0-9-16/. bye -- Andreas Wolff DynamicDudes Lightweight Ruby on Rails application development http://dynamicdudes.com hire: +49 151 58 54 78 50 home: http://rubyphunk.com ___ rspec-users mailing list rspec-users@rubyforge.org http://rubyforge.org/mailman/listinfo/rspec-users