awesome_print 1.2.0 → 1.6.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +7 -0
- data/.gitignore +10 -2
- data/Appraisals +39 -0
- data/CHANGELOG +22 -3
- data/CONTRIBUTING.md +41 -0
- data/Gemfile +3 -2
- data/Gemfile.lock +29 -12
- data/LICENSE +1 -1
- data/README.md +20 -0
- data/Rakefile +14 -1
- data/lib/ap.rb +0 -0
- data/lib/awesome_print/ext/active_record.rb +2 -1
- data/lib/awesome_print/ext/mongoid.rb +1 -1
- data/lib/awesome_print/ext/ostruct.rb +27 -0
- data/lib/awesome_print/ext/ripple.rb +1 -1
- data/lib/awesome_print/formatter.rb +1 -1
- data/lib/awesome_print/inspector.rb +0 -0
- data/lib/awesome_print/version.rb +1 -1
- data/lib/awesome_print.rb +6 -1
- data/spec/active_record_helper.rb +34 -0
- data/spec/colors_spec.rb +8 -8
- data/spec/formats_spec.rb +70 -70
- data/spec/methods_spec.rb +61 -61
- data/spec/misc_spec.rb +53 -34
- data/spec/objects_spec.rb +6 -6
- data/spec/spec_helper.rb +5 -1
- metadata +66 -24
checksums.yaml
ADDED
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
---
|
|
2
|
+
SHA1:
|
|
3
|
+
metadata.gz: fb92d5e2cf0fdfb4adea4dce07a036029b215e53
|
|
4
|
+
data.tar.gz: 5ff2f87c655f96bdbf5393d18432dd967f3c48ef
|
|
5
|
+
SHA512:
|
|
6
|
+
metadata.gz: e41bf9d0871110552cd501c718276cf610c14dad19732a75670d81b9028c84fe21af86405bca36a3b5d3f35ef1180bb6d3ae0871b26d8bd313091b8298a4a147
|
|
7
|
+
data.tar.gz: 7980fa638d522e0be24381a8edca2c480f1a3579b4c310bbee2c2228c41c4b9c1a738e23251381e52b8e2744d860e7ab35dcef654af37a003e2366a8a67c3b75
|
data/.gitignore
CHANGED
|
@@ -13,12 +13,20 @@ tmtags
|
|
|
13
13
|
## VIM
|
|
14
14
|
*.swp
|
|
15
15
|
|
|
16
|
+
## RUBYMINE
|
|
17
|
+
.idea
|
|
18
|
+
|
|
16
19
|
## PROJECT::GENERAL
|
|
17
20
|
coverage
|
|
18
21
|
rdoc
|
|
19
22
|
pkg
|
|
23
|
+
.ruby-version
|
|
24
|
+
gemfiles/*.gemfile.lock
|
|
20
25
|
Gemfile.lock
|
|
21
26
|
|
|
22
|
-
## PROJECT::
|
|
27
|
+
## PROJECT::RVM
|
|
23
28
|
.rvmrc
|
|
24
|
-
|
|
29
|
+
|
|
30
|
+
# PROJECT::RBENV
|
|
31
|
+
.ruby-gemset
|
|
32
|
+
.awesome-print/
|
data/Appraisals
ADDED
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
appraise 'rails-3.2' do
|
|
2
|
+
gem 'rails', '~> 3.2.0'
|
|
3
|
+
end
|
|
4
|
+
|
|
5
|
+
appraise 'rails-4.0' do
|
|
6
|
+
gem 'rails', '~> 4.0.0'
|
|
7
|
+
end
|
|
8
|
+
|
|
9
|
+
appraise 'rails-4.1' do
|
|
10
|
+
gem 'rails', '~> 4.1.0'
|
|
11
|
+
end
|
|
12
|
+
|
|
13
|
+
appraise 'rails-4.2' do
|
|
14
|
+
gem 'rails', '~> 4.2.0'
|
|
15
|
+
end
|
|
16
|
+
|
|
17
|
+
appraise 'mongoid-3.0' do
|
|
18
|
+
gem 'rails', '~> 3.2.0'
|
|
19
|
+
gem 'mongoid', '~> 3.0.0'
|
|
20
|
+
end
|
|
21
|
+
|
|
22
|
+
appraise 'mongoid-3.1' do
|
|
23
|
+
gem 'rails', '~> 3.2.0'
|
|
24
|
+
gem 'mongoid', '~> 3.1.0'
|
|
25
|
+
end
|
|
26
|
+
|
|
27
|
+
appraise 'mongoid-4.0' do
|
|
28
|
+
gem 'rails', '~> 4.2.0'
|
|
29
|
+
gem 'mongoid', '~> 4.0.0'
|
|
30
|
+
end
|
|
31
|
+
|
|
32
|
+
appraise 'mongo_mapper' do
|
|
33
|
+
gem 'mongo_mapper'
|
|
34
|
+
end
|
|
35
|
+
|
|
36
|
+
appraise 'ripple' do
|
|
37
|
+
gem 'tzinfo'
|
|
38
|
+
gem 'ripple'
|
|
39
|
+
end
|
data/CHANGELOG
CHANGED
|
@@ -1,3 +1,22 @@
|
|
|
1
|
+
1.6.1
|
|
2
|
+
- Fixes specs on all rails dependencies (Mauro George)
|
|
3
|
+
- Updates specs for mongoid, mongo_mapper and ripple (James Cox)
|
|
4
|
+
- Adds appraisals for simpler version/scenario management (Mauro George)
|
|
5
|
+
- Add Travis (Mauro George)
|
|
6
|
+
- Update documentation (Mauro George)
|
|
7
|
+
|
|
8
|
+
1.6.0
|
|
9
|
+
semi-major release since it's been a while, and there are several
|
|
10
|
+
improvements.
|
|
11
|
+
- Improves support for new mongoid/moped (Velkitor, Francois Bernier et al)
|
|
12
|
+
- Converts specs to rspec 3+ (Adam Jonas, James Cox)
|
|
13
|
+
- Fixes incompatibility with IPAddr (James Cox, Michael Dvorkin)
|
|
14
|
+
- Fixes incompatibility with the money gem (Michael Dvorkin)
|
|
15
|
+
- Fixes AR::Relation presentation (Sergey Ponomarov)
|
|
16
|
+
- Lazy-loads ActionView (Akira Matsuda)
|
|
17
|
+
- Fixes inspection of abstract classes (Jonathan Priddle)
|
|
18
|
+
- Gets most specs passing, and fixes suite (Eoin Kelly)
|
|
19
|
+
|
|
1
20
|
1.2.0 <-- NOTE: This is the *last* release supporting Ruby < v1.9.3 and Rails < v3.
|
|
2
21
|
- Added Sequel ORM plugin (Jonathan Davies)
|
|
3
22
|
- Added Ripple plugin (Ruby modeling layer for Riak, Scott Hyndman)
|
|
@@ -81,7 +100,7 @@
|
|
|
81
100
|
|
|
82
101
|
0.1.3
|
|
83
102
|
- Added support for setting custom defaults in ~/.aprc
|
|
84
|
-
|
|
103
|
+
|
|
85
104
|
0.1.2
|
|
86
105
|
- Correctly handle empty arrays and hashes
|
|
87
106
|
- Use alias_method instead of alias (fixes non-tty method aliasing)
|
|
@@ -90,7 +109,7 @@
|
|
|
90
109
|
0.1.1
|
|
91
110
|
- Added support for tableless ActiveRecord models
|
|
92
111
|
- Left align hash keys if @options[:indent] is negative
|
|
93
|
-
|
|
112
|
+
|
|
94
113
|
0.1.0
|
|
95
114
|
- Initial Release.
|
|
96
|
-
|
|
115
|
+
|
data/CONTRIBUTING.md
ADDED
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
# Contributing
|
|
2
|
+
|
|
3
|
+
We love pull requests. Here's a quick guide:
|
|
4
|
+
|
|
5
|
+
1. Fork the repo.
|
|
6
|
+
|
|
7
|
+
1. Create your feature branch (`git checkout -b my-new-feature`)
|
|
8
|
+
|
|
9
|
+
1. Update [CHANGELOG.md](https://github.com/michaeldv/awesome_print/blob/master/CHANGELOG.md) with a brief description of your changes under the `unreleased` heading.
|
|
10
|
+
|
|
11
|
+
1. Commit your changes (`git commit -am 'Added some feature'`)
|
|
12
|
+
|
|
13
|
+
1. Push to the branch (`git push origin my-new-feature`)
|
|
14
|
+
|
|
15
|
+
1. Create new Pull Request
|
|
16
|
+
|
|
17
|
+
At this point you're waiting on us. We like to at least comment on, if not
|
|
18
|
+
accept, pull requests within three business days (and, typically, one business
|
|
19
|
+
day). We may suggest some changes or improvements or alternatives.
|
|
20
|
+
|
|
21
|
+
Some things that will increase the chance that your pull request is accepted is to follow the practices described on [Ruby style guide](https://github.com/bbatsov/ruby-style-guide), [Rails style guide](https://github.com/bbatsov/rails-style-guide) and [Better Specs](http://betterspecs.org/).
|
|
22
|
+
|
|
23
|
+
## Specs
|
|
24
|
+
|
|
25
|
+
To run all the specs in all gemfiles just run:
|
|
26
|
+
|
|
27
|
+
```
|
|
28
|
+
$ rake
|
|
29
|
+
```
|
|
30
|
+
|
|
31
|
+
To run specs of a single gemfile run:
|
|
32
|
+
|
|
33
|
+
```
|
|
34
|
+
$ appraisal rails-3.2 rake
|
|
35
|
+
```
|
|
36
|
+
|
|
37
|
+
If you want to run a specific spec in a gemfile run:
|
|
38
|
+
|
|
39
|
+
```
|
|
40
|
+
$ appraisal rails-3.2 rspec spec/colors_spec.rb
|
|
41
|
+
```
|
data/Gemfile
CHANGED
data/Gemfile.lock
CHANGED
|
@@ -1,26 +1,43 @@
|
|
|
1
1
|
PATH
|
|
2
2
|
remote: .
|
|
3
3
|
specs:
|
|
4
|
-
awesome_print (1.1
|
|
4
|
+
awesome_print (1.6.1)
|
|
5
5
|
|
|
6
6
|
GEM
|
|
7
7
|
remote: https://rubygems.org/
|
|
8
8
|
specs:
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
9
|
+
appraisal (1.0.2)
|
|
10
|
+
bundler
|
|
11
|
+
rake
|
|
12
|
+
thor (>= 0.14.0)
|
|
13
|
+
diff-lcs (1.2.5)
|
|
14
|
+
fakefs (0.6.0)
|
|
15
|
+
mini_portile (0.6.2)
|
|
16
|
+
nokogiri (1.6.5)
|
|
17
|
+
mini_portile (~> 0.6.0)
|
|
18
|
+
rake (10.4.2)
|
|
19
|
+
rspec (3.1.0)
|
|
20
|
+
rspec-core (~> 3.1.0)
|
|
21
|
+
rspec-expectations (~> 3.1.0)
|
|
22
|
+
rspec-mocks (~> 3.1.0)
|
|
23
|
+
rspec-core (3.1.7)
|
|
24
|
+
rspec-support (~> 3.1.0)
|
|
25
|
+
rspec-expectations (3.1.2)
|
|
26
|
+
diff-lcs (>= 1.2.0, < 2.0)
|
|
27
|
+
rspec-support (~> 3.1.0)
|
|
28
|
+
rspec-mocks (3.1.3)
|
|
29
|
+
rspec-support (~> 3.1.0)
|
|
30
|
+
rspec-support (3.1.2)
|
|
31
|
+
sqlite3 (1.3.10)
|
|
32
|
+
thor (0.19.1)
|
|
19
33
|
|
|
20
34
|
PLATFORMS
|
|
21
35
|
ruby
|
|
22
36
|
|
|
23
37
|
DEPENDENCIES
|
|
38
|
+
appraisal
|
|
24
39
|
awesome_print!
|
|
25
40
|
fakefs (>= 0.2.1)
|
|
26
|
-
|
|
41
|
+
nokogiri (>= 1.6.5)
|
|
42
|
+
rspec (>= 3.0.0)
|
|
43
|
+
sqlite3
|
data/LICENSE
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Copyright (c) 2010-2013 Michael Dvorkin
|
|
2
2
|
http://www.dvorkin.net
|
|
3
|
-
%w(mike dvorkin.net) * "@" ||
|
|
3
|
+
%w(mike dvorkin.net) * "@" || "twitter.com/mid"
|
|
4
4
|
|
|
5
5
|
Permission is hereby granted, free of charge, to any person obtaining
|
|
6
6
|
a copy of this software and associated documentation files (the
|
data/README.md
CHANGED
|
@@ -1,4 +1,12 @@
|
|
|
1
1
|
## Awesome Print ##
|
|
2
|
+
|
|
3
|
+
[![RubyGems][gem_version_badge]][ruby_gems]
|
|
4
|
+
[![Travis CI][travis_ci_badge]][travis_ci]
|
|
5
|
+
[![Code Climate][code_climate_badge]][code_climate]
|
|
6
|
+
[![RubyGems][gem_downloads_badge]][ruby_gems]
|
|
7
|
+
[](https://gitter.im/michaeldv/awesome_print?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge&utm_content=badge)
|
|
8
|
+
|
|
9
|
+
|
|
2
10
|
Awesome Print is a Ruby library that pretty prints Ruby objects in full color
|
|
3
11
|
exposing their internal structure with proper indentation. Rails ActiveRecord
|
|
4
12
|
objects and usage within Rails templates are supported via included mixins.
|
|
@@ -304,6 +312,10 @@ AwesomePrint.defaults = {
|
|
|
304
312
|
}
|
|
305
313
|
```
|
|
306
314
|
|
|
315
|
+
## Versioning
|
|
316
|
+
|
|
317
|
+
AwesomePrint follows the [Semantic Versioning](http://semver.org/) standard.
|
|
318
|
+
|
|
307
319
|
### Running Specs ###
|
|
308
320
|
|
|
309
321
|
$ gem install rspec # RSpec 2.x is the requirement.
|
|
@@ -364,3 +376,11 @@ http://www.dvorkin.net
|
|
|
364
376
|
%w(mike dvorkin.net) * "@" || "twitter.com/mid"
|
|
365
377
|
|
|
366
378
|
Released under the MIT license. See LICENSE file for details.
|
|
379
|
+
|
|
380
|
+
[gem_version_badge]: https://img.shields.io/gem/v/awesome_print.svg?style=flat
|
|
381
|
+
[gem_downloads_badge]: http://img.shields.io/gem/dt/awesome_print.svg?style=flat
|
|
382
|
+
[ruby_gems]: http://rubygems.org/gems/awesome_print
|
|
383
|
+
[travis_ci]: http://travis-ci.org/michaeldv/awesome_print
|
|
384
|
+
[travis_ci_badge]: https://img.shields.io/travis/michaeldv/awesome_print.svg?style=flat
|
|
385
|
+
[code_climate]: https://codeclimate.com/github/michaeldv/awesome_print
|
|
386
|
+
[code_climate_badge]: http://img.shields.io/codeclimate/github/michaeldv/awesome_print.svg?style=flat
|
data/Rakefile
CHANGED
|
@@ -1,7 +1,20 @@
|
|
|
1
|
+
require "rubygems"
|
|
2
|
+
require "bundler/setup"
|
|
3
|
+
|
|
1
4
|
require "bundler"
|
|
2
5
|
Bundler::GemHelper.install_tasks
|
|
3
6
|
|
|
4
|
-
task :default
|
|
7
|
+
task :default do
|
|
8
|
+
if ENV['BUNDLE_GEMFILE'] =~ /gemfiles/
|
|
9
|
+
Rake::Task['spec'].invoke
|
|
10
|
+
else
|
|
11
|
+
Rake::Task['appraise'].invoke
|
|
12
|
+
end
|
|
13
|
+
end
|
|
14
|
+
|
|
15
|
+
task :appraise do
|
|
16
|
+
exec 'appraisal install && appraisal rake'
|
|
17
|
+
end
|
|
5
18
|
|
|
6
19
|
desc "Run all awesome_print gem specs"
|
|
7
20
|
task :spec do
|
data/lib/ap.rb
CHANGED
|
File without changes
|
|
@@ -21,7 +21,7 @@ module AwesomePrint
|
|
|
21
21
|
cast = :active_record_instance
|
|
22
22
|
elsif object.is_a?(Class) && object.ancestors.include?(::ActiveRecord::Base)
|
|
23
23
|
cast = :active_record_class
|
|
24
|
-
elsif type == :activerecord_relation
|
|
24
|
+
elsif type == :activerecord_relation || object.class.ancestors.include?(::ActiveRecord::Relation)
|
|
25
25
|
cast = :array
|
|
26
26
|
end
|
|
27
27
|
cast
|
|
@@ -56,6 +56,7 @@ module AwesomePrint
|
|
|
56
56
|
#------------------------------------------------------------------------------
|
|
57
57
|
def awesome_active_record_class(object)
|
|
58
58
|
return object.inspect if !defined?(::ActiveSupport::OrderedHash) || !object.respond_to?(:columns) || object.to_s == "ActiveRecord::Base"
|
|
59
|
+
return awesome_class(object) if object.respond_to?(:abstract_class?) && object.abstract_class?
|
|
59
60
|
|
|
60
61
|
data = object.columns.inject(::ActiveSupport::OrderedHash.new) do |hash, c|
|
|
61
62
|
hash[c.name.to_sym] = c.type
|
|
@@ -20,7 +20,7 @@ module AwesomePrint
|
|
|
20
20
|
cast = :mongoid_class
|
|
21
21
|
elsif object.class.ancestors.include?(::Mongoid::Document)
|
|
22
22
|
cast = :mongoid_document
|
|
23
|
-
elsif (defined?(::BSON) && object.is_a?(::BSON::ObjectId)) || (defined?(::Moped) && object.is_a?(::Moped::BSON::ObjectId))
|
|
23
|
+
elsif (defined?(::BSON) && object.is_a?(::BSON::ObjectId)) || (defined?(::Moped::BSON) && object.is_a?(::Moped::BSON::ObjectId))
|
|
24
24
|
cast = :mongoid_bson_id
|
|
25
25
|
end
|
|
26
26
|
end
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
# Copyright (c) 2010-2013 Michael Dvorkin
|
|
2
|
+
#
|
|
3
|
+
# Awesome Print is freely distributable under the terms of MIT license.
|
|
4
|
+
# See LICENSE file or http://www.opensource.org/licenses/mit-license.php
|
|
5
|
+
#------------------------------------------------------------------------------
|
|
6
|
+
module AwesomePrint
|
|
7
|
+
module OpenStruct
|
|
8
|
+
def self.included(base)
|
|
9
|
+
base.send :alias_method, :cast_without_ostruct, :cast
|
|
10
|
+
base.send :alias_method, :cast, :cast_with_ostruct
|
|
11
|
+
end
|
|
12
|
+
|
|
13
|
+
def cast_with_ostruct(object, type)
|
|
14
|
+
cast = cast_without_ostruct(object, type)
|
|
15
|
+
if (defined?(::OpenStruct)) && (object.is_a?(::OpenStruct))
|
|
16
|
+
cast = :open_struct_instance
|
|
17
|
+
end
|
|
18
|
+
cast
|
|
19
|
+
end
|
|
20
|
+
|
|
21
|
+
def awesome_open_struct_instance(object)
|
|
22
|
+
"#{object.class} #{awesome_hash(object.marshal_dump)}"
|
|
23
|
+
end
|
|
24
|
+
end
|
|
25
|
+
end
|
|
26
|
+
|
|
27
|
+
AwesomePrint::Formatter.send(:include, AwesomePrint::OpenStruct)
|
|
@@ -63,7 +63,7 @@ module AwesomePrint
|
|
|
63
63
|
def awesome_self(object, type)
|
|
64
64
|
if @options[:raw] && object.instance_variables.any?
|
|
65
65
|
awesome_object(object)
|
|
66
|
-
elsif object
|
|
66
|
+
elsif object.respond_to?(:to_hash)
|
|
67
67
|
awesome_hash(object.to_hash)
|
|
68
68
|
else
|
|
69
69
|
colorize(object.inspect.to_s, type)
|
|
File without changes
|
data/lib/awesome_print.rb
CHANGED
|
@@ -25,11 +25,16 @@ unless defined?(AwesomePrint::Inspector)
|
|
|
25
25
|
#
|
|
26
26
|
# Load remaining extensions.
|
|
27
27
|
#
|
|
28
|
-
|
|
28
|
+
if defined?(ActiveSupport)
|
|
29
|
+
ActiveSupport.on_load(:action_view) do
|
|
30
|
+
require File.dirname(__FILE__) + "/awesome_print/ext/action_view"
|
|
31
|
+
end
|
|
32
|
+
end
|
|
29
33
|
require File.dirname(__FILE__) + "/awesome_print/ext/mongo_mapper" if defined?(MongoMapper)
|
|
30
34
|
require File.dirname(__FILE__) + "/awesome_print/ext/mongoid" if defined?(Mongoid)
|
|
31
35
|
require File.dirname(__FILE__) + "/awesome_print/ext/nokogiri" if defined?(Nokogiri)
|
|
32
36
|
require File.dirname(__FILE__) + "/awesome_print/ext/no_brainer" if defined?(NoBrainer)
|
|
33
37
|
require File.dirname(__FILE__) + "/awesome_print/ext/ripple" if defined?(Ripple)
|
|
34
38
|
require File.dirname(__FILE__) + "/awesome_print/ext/sequel" if defined?(Sequel)
|
|
39
|
+
require File.dirname(__FILE__) + "/awesome_print/ext/ostruct" if defined?(OpenStruct)
|
|
35
40
|
end
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
require 'active_record'
|
|
2
|
+
|
|
3
|
+
# Required to use the column support
|
|
4
|
+
module Rails
|
|
5
|
+
def self.env
|
|
6
|
+
{}
|
|
7
|
+
end
|
|
8
|
+
end
|
|
9
|
+
|
|
10
|
+
# Establish connection to in-memory SQLite DB
|
|
11
|
+
ActiveRecord::Base.establish_connection adapter: "sqlite3", database: ":memory:"
|
|
12
|
+
|
|
13
|
+
# Create the users table
|
|
14
|
+
ActiveRecord::Migration.verbose = false
|
|
15
|
+
ActiveRecord::Migration.create_table :users do |t|
|
|
16
|
+
t.string :name
|
|
17
|
+
t.integer :rank
|
|
18
|
+
t.boolean :admin
|
|
19
|
+
t.datetime :created_at
|
|
20
|
+
end
|
|
21
|
+
|
|
22
|
+
# Create models
|
|
23
|
+
class User < ActiveRecord::Base; end
|
|
24
|
+
class SubUser < User; end
|
|
25
|
+
|
|
26
|
+
|
|
27
|
+
# Helper methods
|
|
28
|
+
# ##############
|
|
29
|
+
|
|
30
|
+
# we only work with ActiveRecord 2+
|
|
31
|
+
def is_usable_activerecord?
|
|
32
|
+
defined?(ActiveRecord::VERSION::MAJOR) && ActiveRecord::VERSION::MAJOR >= 2
|
|
33
|
+
end
|
|
34
|
+
|
data/spec/colors_spec.rb
CHANGED
|
@@ -30,14 +30,14 @@ describe "AwesomePrint" do
|
|
|
30
30
|
|
|
31
31
|
it "colorizes tty processes by default" do
|
|
32
32
|
stub_tty!
|
|
33
|
-
@arr.ai(:multiline => false).
|
|
33
|
+
expect(@arr.ai(:multiline => false)).to eq(COLORIZED)
|
|
34
34
|
end
|
|
35
35
|
|
|
36
36
|
it "colorizes processes with ENV['ANSICON'] by default" do
|
|
37
37
|
begin
|
|
38
38
|
stub_tty!
|
|
39
39
|
term, ENV['ANSICON'] = ENV['ANSICON'], "1"
|
|
40
|
-
@arr.ai(:multiline => false).
|
|
40
|
+
expect(@arr.ai(:multiline => false)).to eq(COLORIZED)
|
|
41
41
|
ensure
|
|
42
42
|
ENV['ANSICON'] = term
|
|
43
43
|
end
|
|
@@ -47,7 +47,7 @@ describe "AwesomePrint" do
|
|
|
47
47
|
begin
|
|
48
48
|
stub_tty!
|
|
49
49
|
term, ENV['TERM'] = ENV['TERM'], "dumb"
|
|
50
|
-
@arr.ai(:multiline => false).
|
|
50
|
+
expect(@arr.ai(:multiline => false)).to eq(PLAIN)
|
|
51
51
|
ensure
|
|
52
52
|
ENV['TERM'] = term
|
|
53
53
|
end
|
|
@@ -56,7 +56,7 @@ describe "AwesomePrint" do
|
|
|
56
56
|
it "does not colorize subprocesses by default" do
|
|
57
57
|
begin
|
|
58
58
|
stub_tty! false
|
|
59
|
-
@arr.ai(:multiline => false).
|
|
59
|
+
expect(@arr.ai(:multiline => false)).to eq(PLAIN)
|
|
60
60
|
ensure
|
|
61
61
|
stub_tty!
|
|
62
62
|
end
|
|
@@ -70,14 +70,14 @@ describe "AwesomePrint" do
|
|
|
70
70
|
|
|
71
71
|
it "still colorizes tty processes" do
|
|
72
72
|
stub_tty!
|
|
73
|
-
@arr.ai(:multiline => false).
|
|
73
|
+
expect(@arr.ai(:multiline => false)).to eq(COLORIZED)
|
|
74
74
|
end
|
|
75
75
|
|
|
76
76
|
it "colorizes processes with ENV['ANSICON'] set to 0" do
|
|
77
77
|
begin
|
|
78
78
|
stub_tty!
|
|
79
79
|
term, ENV['ANSICON'] = ENV['ANSICON'], "1"
|
|
80
|
-
@arr.ai(:multiline => false).
|
|
80
|
+
expect(@arr.ai(:multiline => false)).to eq(COLORIZED)
|
|
81
81
|
ensure
|
|
82
82
|
ENV['ANSICON'] = term
|
|
83
83
|
end
|
|
@@ -87,7 +87,7 @@ describe "AwesomePrint" do
|
|
|
87
87
|
begin
|
|
88
88
|
stub_tty!
|
|
89
89
|
term, ENV['TERM'] = ENV['TERM'], "dumb"
|
|
90
|
-
@arr.ai(:multiline => false).
|
|
90
|
+
expect(@arr.ai(:multiline => false)).to eq(COLORIZED)
|
|
91
91
|
ensure
|
|
92
92
|
ENV['TERM'] = term
|
|
93
93
|
end
|
|
@@ -96,7 +96,7 @@ describe "AwesomePrint" do
|
|
|
96
96
|
it "colorizes subprocess" do
|
|
97
97
|
begin
|
|
98
98
|
stub_tty! false
|
|
99
|
-
@arr.ai(:multiline => false).
|
|
99
|
+
expect(@arr.ai(:multiline => false)).to eq(COLORIZED)
|
|
100
100
|
ensure
|
|
101
101
|
stub_tty!
|
|
102
102
|
end
|