I have a CLI app that uses the thor gem.
My tests pass, but because I am testing the API directory, I get a lot of warnings:
All examples were filtered out; ignoring {:focus=>true}
.......
[WARNING] Attempted to create command "__email_dir?_without_any_instance__" without usage or description.
Call desc if you want this method to be available as command or declare it inside a no_commands{} block.
Invoked from "/Users/julieng/.rbenv/versions/2.1.2/lib/ruby/gems/2.1.0/gems/rspec-mocks-3.1.2/lib/rspec/mocks/any_instance/recorder.rb:211:in `alias_method'".
I have ENV['RACK_ENV']='test' in my spec_helper.rb file, which according to a SO search, was supposed to help.
I found some other SO threads (example), but I am not testing any input, just calling API methods directly.
This is just annoying. Any ideas on how to resolve it?
Thanks
You can get a slightly more targeted approach than Paul's steamroller-style approach with something like this:
describe MyCLI do
before do
class Foo < StringIO
def puts s
super unless s.start_with?('[WARNING] Attempted to create command')
end
end
$stdout = Foo.new
end
after do
$stdout = STDOUT
end
# your tests here...
end
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With