Hi Folk,
Hopefully this is a very simple question. I use RSPEC as a functional test
for network maintenances. It allows me to loop a series of tests during a
maintenance providing a clean format and notification of any behavioral
changes on the network.
Often times I expect some things to fail and in an attempt to keep results
clean I often want to hide the full backtrace. If I run my rspec with the
config.full_backtrace argument set to false everything works great. If I
symlink the file however the backtraces return.
I wrote this example to illustrate my issue.
#!/usr/bin/ruby
require 'rspec/autorun'
require 'net/ping'
RSpec.configure do |config|
config.full_backtrace=false
end
describe "TEST A >> " do
it "1:Ping is true >> " do
host = Net::Ping::External.new("www.google.com")
host.ping?.should be_false
end
end
if I run this directly it works great.
/test_rspec.rb
F
Failures:
1) TEST A >> 1:Ping is true >>
Failure/Error: Unable to find matching line from backtrace
expected: false value
got: true
# ./test_rspec.rb:13:in `block (2 levels) in <main>'
Finished in 0.01479 seconds
1 example, 1 failure
Failed examples:
rspec ./test_rspec.rb:11 # TEST A >> 1:Ping is true >>
Nice and clean output.
However if I symlink the file I get the full backtrace which I really just
would rather ignore.
ls -l ~/bin/
total 24
lrwxr-xr-x 1 cliff.rosson USERS\Domain Users 49 Dec 30 16:56 test_rspec
-> /Users/cliff.rosson/Desktop/scratch/test_rspec.rb
And run the symlink
test_rspec
F
Failures:
1) TEST A >> 1:Ping is true >>
Failure/Error: host.ping?.should be_false
expected: false value
got: true
#
/Library/Ruby/Gems/2.0.0/gems/rspec-expectations-2.14.5/lib/rspec/expectations/fail_with.rb:32:in
`fail_with'
#
/Library/Ruby/Gems/2.0.0/gems/rspec-expectations-2.14.5/lib/rspec/expectations/handler.rb:36:in
`handle_matcher'
#
/Library/Ruby/Gems/2.0.0/gems/rspec-expectations-2.14.5/lib/rspec/expectations/syntax.rb:53:in
`should'
# /Users/cliff.rosson/bin/test_rspec:13:in `block (2 levels) in <main>'
#
/Library/Ruby/Gems/2.0.0/gems/rspec-core-2.14.8/lib/rspec/core/example.rb:114:in
`instance_eval'
#
/Library/Ruby/Gems/2.0.0/gems/rspec-core-2.14.8/lib/rspec/core/example.rb:114:in
`block in run'
#
/Library/Ruby/Gems/2.0.0/gems/rspec-core-2.14.8/lib/rspec/core/example.rb:254:in
`with_around_each_hooks'
#
/Library/Ruby/Gems/2.0.0/gems/rspec-core-2.14.8/lib/rspec/core/example.rb:111:in
`run'
#
/Library/Ruby/Gems/2.0.0/gems/rspec-core-2.14.8/lib/rspec/core/example_group.rb:390:in
`block in run_examples'
#
/Library/Ruby/Gems/2.0.0/gems/rspec-core-2.14.8/lib/rspec/core/example_group.rb:386:in
`map'
#
/Library/Ruby/Gems/2.0.0/gems/rspec-core-2.14.8/lib/rspec/core/example_group.rb:386:in
`run_examples'
#
/Library/Ruby/Gems/2.0.0/gems/rspec-core-2.14.8/lib/rspec/core/example_group.rb:371:in
`run'
#
/Library/Ruby/Gems/2.0.0/gems/rspec-core-2.14.8/lib/rspec/core/command_line.rb:28:in
`block (2 levels) in run'
#
/Library/Ruby/Gems/2.0.0/gems/rspec-core-2.14.8/lib/rspec/core/command_line.rb:28:in
`map'
#
/Library/Ruby/Gems/2.0.0/gems/rspec-core-2.14.8/lib/rspec/core/command_line.rb:28:in
`block in run'
#
/Library/Ruby/Gems/2.0.0/gems/rspec-core-2.14.8/lib/rspec/core/reporter.rb:58:in
`report'
#
/Library/Ruby/Gems/2.0.0/gems/rspec-core-2.14.8/lib/rspec/core/command_line.rb:25:in
`run'
#
/Library/Ruby/Gems/2.0.0/gems/rspec-core-2.14.8/lib/rspec/core/runner.rb:80:in
`run'
#
/Library/Ruby/Gems/2.0.0/gems/rspec-core-2.14.8/lib/rspec/core/runner.rb:17:in
`block in autorun'
Finished in 0.01452 seconds
1 example, 1 failure
Failed examples:
rspec /Users/cliff.rosson/bin/test_rspec:11 # TEST A >> 1:Ping is true >>
Any-thoughts why this setting doesn't carry over when referencing the
symlink?
Thanks everyone.
--
You received this message because you are subscribed to the Google Groups
"rspec" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To post to this group, send email to [email protected].
To view this discussion on the web visit
https://groups.google.com/d/msgid/rspec/47389e5a-78e0-4a48-97f9-08948e91eb0e%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.