Katrina Owen
2010-Oct-05 23:19 UTC
[rspec-users] Unable to get rid of backtrace when running specs (rspec2, rails3)
Hi, I can''t seem to silence the stack trace when running specs. Pending specs get this output: ChannelsController GET new responds to xml # why would we want to render xml for Channel.new? # ./spec/controllers/channel_controller_spec.rb:89 Failing specs get this: Failures: 1) ChannelsController POST create failing example Failure/Error: post :create, {:channel => channel} undefined method `save'' for nil:NilClass # /gems/activesupport-3.0.0/lib/active_support/whiny_nil.rb:48:in `method_missing'' . . ( 30 or so more lines ) . # /gems/spork-0.8.4/lib/spork/server.rb:47:in `run'' Here''s what I have so far: I''ve grepped through my project to check whether something is setting the --backtrace option, but as far as I can tell, it''s not set. I also did> cd myproject; grep -lre ''-b''which matched a bunch of temporary files and binary files, but nothing that seemed remotely relevant. The command I am using to kick off the tests is> rspec --drb specI''ve tried running the tests in several ways: with and without spork/DRb, and by calling each of these:> rspec spec > rake spec > bundle exec rspec specAll of these give me a noisy backtrace. Interestingly, when I use rake, the full rails environment gets loaded twice. I haven''t figured that one out yet, either. Here are as many of the environment variables as I can think might be relevant:> cat .rspec--colour --format progress> ruby -vruby 1.9.2p14 (2010-10-02 revision 29393) [x86_64-darwin10.4.0]> rvm -vrvm 1.0.12> gem list*** LOCAL GEMS *** abstract (1.0.0) actionmailer (3.0.0) actionpack (3.0.0) activemodel (3.0.0) activerecord (3.0.0) activeresource (3.0.0) activesupport (3.0.0) acts_as_state_machine (2.2.0) arel (1.0.1) autotest (4.4.1) aws-s3 (0.6.2) builder (2.1.2) bundler (1.0.1) commonwatir (1.6.5) compass (0.10.5) cucumber (0.9.2) cucumber-rails (0.3.2) diff-lcs (1.1.2) erubis (2.6.6) firewatir (1.6.5) gherkin (2.2.8) haml (3.0.21) hoe (2.6.2) httpclient (2.1.5.2) i18n (0.4.1) jquery-rails (0.2.1) json (1.4.6) json_pure (1.4.6) mail (2.2.6.1) mime-types (1.16) nokogiri (1.4.3.1) paperclip (2.3.3) pg (0.9.0) polyglot (0.3.1) rack (1.2.1) rack-mount (0.6.13) rack-test (0.5.6) rails (3.0.0) railties (3.0.0) rake (0.8.7) rspec (2.0.0.rc) rspec-core (2.0.0.rc) rspec-expectations (2.0.0.rc) rspec-mocks (2.0.0.rc) rspec-rails (2.0.0.rc) rubyforge (2.0.4) s4t-utils (1.0.4) spork (0.8.4) term-ansicolor (1.0.5) thor (0.14.2) treetop (1.4.8) tzinfo (0.3.23) user-choices (1.1.6.1) watchr (0.7) webrat (0.7.1) will_paginate (2.3.15) xml-simple (1.0.12)> gem environmentRubyGems Environment: - RUBYGEMS VERSION: 1.3.7 - RUBY VERSION: 1.9.2 (2010-10-02 patchlevel 14) [x86_64-darwin10.4.0] - INSTALLATION DIRECTORY: <snip>/.rvm/gems/ruby-1.9.2-head at prq - RUBY EXECUTABLE: <snip>/.rvm/rubies/ruby-1.9.2-head/bin/ruby - EXECUTABLE DIRECTORY: <snip>/.rvm/gems/ruby-1.9.2-head at prq/bin - RUBYGEMS PLATFORMS: - ruby - x86_64-darwin-10 - GEM PATHS: - <snip>/.rvm/gems/ruby-1.9.2-head at prq - <snip>/.rvm/gems/ruby-1.9.2-head at global - GEM CONFIGURATION: - :update_sources => true - :verbose => true - :benchmark => false - :backtrace => false - :bulk_threshold => 1000 - "install" => "--no-rdoc --no-ri" - "update" => "--no-rdoc --no-ri" - REMOTE SOURCES: - http://rubygems.org/ Any idea whether there are gems that set some configuration options that would turn the --backtrace option on for rspec? I''m not sure where to look next, and would be grateful for any suggestions/pointers! Cheers, Katrina
David Chelimsky
2010-Oct-05 23:44 UTC
[rspec-users] Unable to get rid of backtrace when running specs (rspec2, rails3)
On Oct 5, 2010, at 6:19 PM, Katrina Owen wrote:> Hi, > > I can''t seem to silence the stack trace when running specs. > > Pending specs get this output: > > ChannelsController GET new responds to xml > # why would we want to render xml for Channel.new? > # ./spec/controllers/channel_controller_spec.rb:89 > > Failing specs get this: > > Failures: > 1) ChannelsController POST create failing example > Failure/Error: post :create, {:channel => channel} > undefined method `save'' for nil:NilClass > # /gems/activesupport-3.0.0/lib/active_support/whiny_nil.rb:48:in > `method_missing'' > . > . ( 30 or so more lines ) > . > # /gems/spork-0.8.4/lib/spork/server.rb:47:in `run'' > > > Here''s what I have so far: > > I''ve grepped through my project to check whether something is setting > the --backtrace option, but as far as I can tell, it''s not set. > I also did >> cd myproject; grep -lre ''-b'' > which matched a bunch of temporary files and binary files, but nothing > that seemed remotely relevant. > > The command I am using to kick off the tests is > >> rspec --drb spec > > I''ve tried running the tests in several ways: with and without > spork/DRb, and by calling each of these: >> rspec spec >> rake spec >> bundle exec rspec spec > All of these give me a noisy backtrace. > > Interestingly, when I use rake, the full rails environment gets loaded > twice. I haven''t figured that one out yet, either. > > Here are as many of the environment variables as I can think might be relevant: > >> cat .rspec > --colour > --format progress > >> ruby -v > ruby 1.9.2p14 (2010-10-02 revision 29393) [x86_64-darwin10.4.0] > >> rvm -v > rvm 1.0.12 > >> gem list > *** LOCAL GEMS *** > abstract (1.0.0) > actionmailer (3.0.0) > actionpack (3.0.0) > activemodel (3.0.0) > activerecord (3.0.0) > activeresource (3.0.0) > activesupport (3.0.0) > acts_as_state_machine (2.2.0) > arel (1.0.1) > autotest (4.4.1) > aws-s3 (0.6.2) > builder (2.1.2) > bundler (1.0.1) > commonwatir (1.6.5) > compass (0.10.5) > cucumber (0.9.2) > cucumber-rails (0.3.2) > diff-lcs (1.1.2) > erubis (2.6.6) > firewatir (1.6.5) > gherkin (2.2.8) > haml (3.0.21) > hoe (2.6.2) > httpclient (2.1.5.2) > i18n (0.4.1) > jquery-rails (0.2.1) > json (1.4.6) > json_pure (1.4.6) > mail (2.2.6.1) > mime-types (1.16) > nokogiri (1.4.3.1) > paperclip (2.3.3) > pg (0.9.0) > polyglot (0.3.1) > rack (1.2.1) > rack-mount (0.6.13) > rack-test (0.5.6) > rails (3.0.0) > railties (3.0.0) > rake (0.8.7) > rspec (2.0.0.rc) > rspec-core (2.0.0.rc) > rspec-expectations (2.0.0.rc) > rspec-mocks (2.0.0.rc) > rspec-rails (2.0.0.rc) > rubyforge (2.0.4) > s4t-utils (1.0.4) > spork (0.8.4) > term-ansicolor (1.0.5) > thor (0.14.2) > treetop (1.4.8) > tzinfo (0.3.23) > user-choices (1.1.6.1) > watchr (0.7) > webrat (0.7.1) > will_paginate (2.3.15) > xml-simple (1.0.12) > >> gem environment > RubyGems Environment: > - RUBYGEMS VERSION: 1.3.7 > - RUBY VERSION: 1.9.2 (2010-10-02 patchlevel 14) [x86_64-darwin10.4.0] > - INSTALLATION DIRECTORY: <snip>/.rvm/gems/ruby-1.9.2-head at prq > - RUBY EXECUTABLE: <snip>/.rvm/rubies/ruby-1.9.2-head/bin/ruby > - EXECUTABLE DIRECTORY: <snip>/.rvm/gems/ruby-1.9.2-head at prq/bin > - RUBYGEMS PLATFORMS: > - ruby > - x86_64-darwin-10 > - GEM PATHS: > - <snip>/.rvm/gems/ruby-1.9.2-head at prq > - <snip>/.rvm/gems/ruby-1.9.2-head at global > - GEM CONFIGURATION: > - :update_sources => true > - :verbose => true > - :benchmark => false > - :backtrace => false > - :bulk_threshold => 1000 > - "install" => "--no-rdoc --no-ri" > - "update" => "--no-rdoc --no-ri" > - REMOTE SOURCES: > - http://rubygems.org/ > > Any idea whether there are gems that set some configuration options > that would turn the --backtrace option on for rspec? > > I''m not sure where to look next, and would be grateful for any > suggestions/pointers!This needs some docs, but there is a configuration option called backtrace_clean_patterns that you can append to: RSpec::configure do |c| backtrace_clean_patterns << /gems\// end Maybe we should make that part of the default list? HTH, David
Katrina Owen
2010-Oct-06 07:33 UTC
[rspec-users] Unable to get rid of backtrace when running specs (rspec2, rails3)
On Wed, Oct 6, 2010 at 1:44 AM, David Chelimsky <dchelimsky at gmail.com> wrote:> > On Oct 5, 2010, at 6:19 PM, Katrina Owen wrote: >> I can''t seem to silence the stack trace when running specs. > > This needs some docs, but there is a configuration option called backtrace_clean_patterns that you can append to: > > RSpec::configure do |c| > ?backtrace_clean_patterns << /gems\// > end > > Maybe we should make that part of the default list? >Thank you, David -- this worked beautifully. It would be great to have that available in the default list. Cheers, Katrina
David Chelimsky
2010-Oct-08 04:00 UTC
[rspec-users] Unable to get rid of backtrace when running specs (rspec2, rails3)
On Oct 6, 2010, at 2:33 AM, Katrina Owen wrote:> On Wed, Oct 6, 2010 at 1:44 AM, David Chelimsky <dchelimsky at gmail.com> wrote: >> >> On Oct 5, 2010, at 6:19 PM, Katrina Owen wrote: >>> I can''t seem to silence the stack trace when running specs. >> >> This needs some docs, but there is a configuration option called backtrace_clean_patterns that you can append to: >> >> RSpec::configure do |c| >> backtrace_clean_patterns << /gems\// >> end >> >> Maybe we should make that part of the default list? >> > > Thank you, David -- this worked beautifully. > > It would be great to have that available in the default list.http://github.com/rspec/rspec-core/commit/fc591be26485ffafacec51e6b47208604324809c http://github.com/rspec/rspec-rails/commit/73051af796b143b9989287530fd5fdd52cbe9bfe Cheers, David