I have the following Rakefile
desc "Runs tests"
namespace :test do
task :api do
`mocha`
end
end
When I run the command rake test:api, I don’t get the nice output of dots that I would if I just ran the command mocha.
How do I print the output of a command real-time in a rake task?
You can just
putthe output:The backticks ` are calling the command mocha and return the output of the command.
You may also use
%x{}:Or you use
system:Or you store the output for later use in a variable: