Add pride option to rake

ruby -Itest test/something_test.rb --pride

I use --pride all the time because it gives a rainbow when successful.

but

rake

does not have the rainbow. so I found I could add TESTOPTS

rake TESTOPTS='--pride'

but I wanted make it as default. After some google search, I went to source code.

https://github.com/ruby/rake/blob/master/lib/rake/testtask.rb

so I opened Rakefile and added this line.

t.options = "--pride"

it works!

# Rakefile
require "bundler/gem_tasks"
require "rake/testtask"

Rake::TestTask.new(:test) do |t|
  t.libs << "test"
  t.libs << "lib"
  t.options = "--pride"
  t.test_files = FileList["test/*_test.rb"]
end

task :default => :test
 
0
Kudos
 
0
Kudos

Now read this

Ruby block

I’ve been trying to figure out how it works. This morning I wanted to write it down my thinking process today, before I forget. block_given? block_given? is a method of Kernel module. In other words, it’s one of the same kind of puts,... Continue →