Developing with my first Mac and I noticed that my Rspec output isn't colorized in my terminal even though I'm using the '-c
' flag in the command: bundle exec rspec -c -fd
. Any ideas?
Add the following contents to a .rspec file to your project dir root.
--color
If you're coming here from Google recently, you may notice that Allen Chun's answer gives a NoMethodError
with .color_enabled
when using RSpec 3.0 or higher. .color_enabled
was removed in 3.0: https://github.com/rspec/rspec-core/blob/master/Changelog.md#300rc1--2014-05-18
Just change .color_enabled
to .color
in spec_helper.rb
:
RSpec.configure do |config|
# Use color in STDOUT
config.color = true
# other config options here...
end
This worked for me with Ruby 2.1.2p95 on OS X Mavericks 10.9.4.
You can also put the config on the spec_helper.rb if you don't want to attach --color every time you run rspec.
RSpec.configure do |config|
# Use color in STDOUT
config.color_enabled = true
# Use color not only in STDOUT but also in pagers and files
config.tty = true
# Use the specified formatter
config.formatter = :documentation # :progress, :html, :textmate
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