RSpec intercepting backticks, preventing sudo?
I'm porting some code from MiniTest to RSpec. Said code now fails.
In IRB:
`sudo echo 1` # returns 1
RSpec:
# example.rb
class Example
def self.doexec
`sudo echo 1`
end
end
# example_spec.rb
it '#doexec' do
Example.doexec.should include("1")
end
...when executed:
rspec spec/lib/example_spec.rb
# spec fails, stderror:
sudo: no tty present and no askpass program specified
Is this a bug, feature, or any idea of how to work it (without hardwiring in the password)?