mirror of
https://github.com/jbranchaud/til
synced 2026-01-03 23:28:02 +00:00
Add Colorful Output With MiniTest as a ruby til.
This commit is contained in:
@@ -148,6 +148,7 @@ smart people at [Hashrocket](http://hashrocket.com/).
|
||||
|
||||
- [Are They All True?](ruby/are-they-all-true.md)
|
||||
- [Assoc For Hashes](ruby/assoc-for-hashes.md)
|
||||
- [Colorful Output With MiniTest](ruby/colorful-output-with-minitest.md)
|
||||
- [Comparing Class Hierarchy Relationships](ruby/comparing-class-hierarchy-relationships.md)
|
||||
- [Construct A Constant From A String](ruby/construct-a-constant-from-a-string.md)
|
||||
- [Create an Array of Stringed Numbers](ruby/create-an-array-of-stringed-numbers.md)
|
||||
|
||||
26
ruby/colorful-output-with-minitest.md
Normal file
26
ruby/colorful-output-with-minitest.md
Normal file
@@ -0,0 +1,26 @@
|
||||
# Colorful Output With MiniTest
|
||||
|
||||
Ruby's
|
||||
[`MiniTest`](http://ruby-doc.org/stdlib-2.0.0/libdoc/minitest/rdoc/MiniTest.html)
|
||||
is a minimal testing framework that you can easily drop-in to any Ruby
|
||||
project. For those used to using [`RSpec`](http://rspec.info/) with it's fancy
|
||||
red/green output, MiniTest can be a little disappointing. It prints boring,
|
||||
uncolored text to the screen that lacks visual feedback. Fortunately, red
|
||||
and green coloring can be added with
|
||||
[`minitest/reporters`](https://github.com/kern/minitest-reporters).
|
||||
|
||||
Update your `Gemfile`:
|
||||
|
||||
```ruby
|
||||
gem 'minitest-reporters'
|
||||
```
|
||||
|
||||
Then require and configure `minitest-reporters` in your testing setup file
|
||||
(e.g. `test/test_helper.rb`):
|
||||
|
||||
```ruby
|
||||
require 'minitest/reporters'
|
||||
Minitest::Reporters.use! [Minitest::Reporters::DefaultReporter.new(:color => true)]
|
||||
```
|
||||
|
||||
You can now enjoy that Red, Green, Refactor cycle.
|
||||
Reference in New Issue
Block a user