0

I have a custom fact in ruby that uses Facter::Core::Execution.execute to execute a system command and sets the fact to true or false based on the output of the execute command. Is there a way I could mock the output of the execute command to test it?

Yong zhu
  • 103
  • 1
  • 1
  • 6

1 Answers1

1

Using rspec:

expect(Facter::Core::Execution).to receive(:execute).and_return(true)
max pleaner
  • 26,189
  • 9
  • 66
  • 118