mirror of
https://github.com/awesome-print/awesome_print
synced 2023-03-27 23:22:34 -04:00
Renamed directories
This commit is contained in:
parent
7a35496b7f
commit
b538cca4c5
26 changed files with 269 additions and 267 deletions
16
lib/ap.rb
16
lib/ap.rb
|
@ -9,17 +9,17 @@
|
|||
#
|
||||
unless defined?(AwesomePrint)
|
||||
%w(array string method object class kernel).each do |file|
|
||||
require File.dirname(__FILE__) + "/ap/core_ext/#{file}"
|
||||
require File.dirname(__FILE__) + "/awesome_print/core_ext/#{file}"
|
||||
end
|
||||
|
||||
require File.dirname(__FILE__) + "/ap/inspector"
|
||||
require File.dirname(__FILE__) + "/ap/formatter"
|
||||
require File.dirname(__FILE__) + "/ap/core_ext/logger" if defined?(Logger)
|
||||
require File.dirname(__FILE__) + "/ap/mixin/action_view" if defined?(ActionView)
|
||||
require File.dirname(__FILE__) + "/awesome_print/inspector"
|
||||
require File.dirname(__FILE__) + "/awesome_print/formatter"
|
||||
require File.dirname(__FILE__) + "/awesome_print/core_ext/logger" if defined?(Logger)
|
||||
require File.dirname(__FILE__) + "/awesome_print/ext/action_view" if defined?(ActionView)
|
||||
|
||||
# Load the following under normal circumstatnces as well as in Rails
|
||||
# console when required from ~/.irbrc.
|
||||
require File.dirname(__FILE__) + "/ap/mixin/active_record" if defined?(ActiveRecord) || (defined?(IRB) && ENV['RAILS_ENV'])
|
||||
require File.dirname(__FILE__) + "/ap/mixin/active_support" if defined?(ActiveSupport) || (defined?(IRB) && ENV['RAILS_ENV'])
|
||||
require File.dirname(__FILE__) + "/ap/mixin/mongo_mapper" if defined?(MongoMapper)
|
||||
require File.dirname(__FILE__) + "/awesome_print/ext/active_record" if defined?(ActiveRecord) || (defined?(IRB) && ENV['RAILS_ENV'])
|
||||
require File.dirname(__FILE__) + "/awesome_print/ext/active_support" if defined?(ActiveSupport) || (defined?(IRB) && ENV['RAILS_ENV'])
|
||||
require File.dirname(__FILE__) + "/awesome_print/ext/mongo_mapper" if defined?(MongoMapper)
|
||||
end
|
||||
|
|
|
@ -11,17 +11,17 @@
|
|||
#
|
||||
unless defined?(AwesomePrint)
|
||||
%w(array string method object class kernel).each do |file|
|
||||
require File.dirname(__FILE__) + "/ap/core_ext/#{file}"
|
||||
require File.dirname(__FILE__) + "/awesome_print/core_ext/#{file}"
|
||||
end
|
||||
|
||||
require File.dirname(__FILE__) + "/ap/inspector"
|
||||
require File.dirname(__FILE__) + "/ap/formatter"
|
||||
require File.dirname(__FILE__) + "/ap/core_ext/logger" if defined?(Logger)
|
||||
require File.dirname(__FILE__) + "/ap/mixin/action_view" if defined?(ActionView)
|
||||
require File.dirname(__FILE__) + "/awesome_print/inspector"
|
||||
require File.dirname(__FILE__) + "/awesome_print/formatter"
|
||||
require File.dirname(__FILE__) + "/awesome_print/core_ext/logger" if defined?(Logger)
|
||||
require File.dirname(__FILE__) + "/awesome_print/ext/action_view" if defined?(ActionView)
|
||||
|
||||
# Load the following under normal circumstatnces as well as in Rails
|
||||
# console when required from ~/.irbrc.
|
||||
require File.dirname(__FILE__) + "/ap/mixin/active_record" if defined?(ActiveRecord) || (defined?(IRB) && ENV['RAILS_ENV'])
|
||||
require File.dirname(__FILE__) + "/ap/mixin/active_support" if defined?(ActiveSupport) || (defined?(IRB) && ENV['RAILS_ENV'])
|
||||
require File.dirname(__FILE__) + "/ap/mixin/mongo_mapper" if defined?(MongoMapper)
|
||||
require File.dirname(__FILE__) + "/awesome_print/ext/active_record" if defined?(ActiveRecord) || (defined?(IRB) && ENV['RAILS_ENV'])
|
||||
require File.dirname(__FILE__) + "/awesome_print/ext/active_support" if defined?(ActiveSupport) || (defined?(IRB) && ENV['RAILS_ENV'])
|
||||
require File.dirname(__FILE__) + "/awesome_print/ext/mongo_mapper" if defined?(MongoMapper)
|
||||
end
|
||||
|
|
|
@ -1,136 +0,0 @@
|
|||
require File.expand_path(File.dirname(__FILE__) + '/spec_helper')
|
||||
|
||||
begin
|
||||
require 'active_record'
|
||||
require 'ap/mixin/active_record'
|
||||
|
||||
if defined?(::ActiveRecord)
|
||||
|
||||
# Create tableless ActiveRecord model.
|
||||
#------------------------------------------------------------------------------
|
||||
class User < ActiveRecord::Base
|
||||
def self.columns()
|
||||
@columns ||= []
|
||||
end
|
||||
|
||||
def self.column(name, sql_type = nil, default = nil, null = true)
|
||||
columns << ActiveRecord::ConnectionAdapters::Column.new(name.to_s, default, sql_type.to_s, null)
|
||||
end
|
||||
|
||||
column :id, :integer
|
||||
column :name, :string
|
||||
column :rank, :integer
|
||||
column :admin, :boolean
|
||||
column :created_at, :datetime
|
||||
|
||||
def self.table_exists?
|
||||
true
|
||||
end
|
||||
end
|
||||
|
||||
class SubUser < User
|
||||
def self.columns
|
||||
User.columns
|
||||
end
|
||||
end
|
||||
|
||||
describe "AwesomePrint/ActiveRecord" do
|
||||
before(:each) do
|
||||
stub_dotfile!
|
||||
end
|
||||
|
||||
#------------------------------------------------------------------------------
|
||||
describe "ActiveRecord instance" do
|
||||
before(:each) do
|
||||
ActiveRecord::Base.default_timezone = :utc
|
||||
@diana = User.new(:name => "Diana", :rank => 1, :admin => false, :created_at => "1992-10-10 12:30:00")
|
||||
@laura = User.new(:name => "Laura", :rank => 2, :admin => true, :created_at => "2003-05-26 14:15:00")
|
||||
@ap = AwesomePrint.new(:plain => true)
|
||||
end
|
||||
|
||||
it "display single record" do
|
||||
out = @ap.send(:awesome, @diana)
|
||||
str = <<-EOS.strip
|
||||
#<User:0x01234567> {
|
||||
:id => nil,
|
||||
:name => "Diana",
|
||||
:rank => 1,
|
||||
:admin => false,
|
||||
:created_at => ?
|
||||
}
|
||||
EOS
|
||||
if RUBY_VERSION.to_f < 1.9
|
||||
str.sub!('?', 'Sat Oct 10 12:30:00 UTC 1992')
|
||||
else
|
||||
str.sub!('?', '1992-10-10 12:30:00 UTC')
|
||||
end
|
||||
|
||||
out.gsub(/0x([a-f\d]+)/, "0x01234567").should == str
|
||||
end
|
||||
|
||||
it "display multiple records" do
|
||||
out = @ap.send(:awesome, [ @diana, @laura ])
|
||||
str = <<-EOS.strip
|
||||
[
|
||||
[0] #<User:0x01234567> {
|
||||
:id => nil,
|
||||
:name => "Diana",
|
||||
:rank => 1,
|
||||
:admin => false,
|
||||
:created_at => ?
|
||||
},
|
||||
[1] #<User:0x01234567> {
|
||||
:id => nil,
|
||||
:name => "Laura",
|
||||
:rank => 2,
|
||||
:admin => true,
|
||||
:created_at => !
|
||||
}
|
||||
]
|
||||
EOS
|
||||
if RUBY_VERSION.to_f < 1.9
|
||||
str.sub!('?', 'Sat Oct 10 12:30:00 UTC 1992')
|
||||
str.sub!('!', 'Mon May 26 14:15:00 UTC 2003')
|
||||
else
|
||||
str.sub!('?', '1992-10-10 12:30:00 UTC')
|
||||
str.sub!('!', '2003-05-26 14:15:00 UTC')
|
||||
end
|
||||
|
||||
out.gsub(/0x([a-f\d]+)/, "0x01234567").should == str
|
||||
end
|
||||
end
|
||||
|
||||
#------------------------------------------------------------------------------
|
||||
describe "ActiveRecord class" do
|
||||
it "should print the class" do
|
||||
@ap = AwesomePrint.new(:plain => true)
|
||||
@ap.send(:awesome, User).should == <<-EOS.strip
|
||||
class User < ActiveRecord::Base {
|
||||
:id => :integer,
|
||||
:name => :string,
|
||||
:rank => :integer,
|
||||
:admin => :boolean,
|
||||
:created_at => :datetime
|
||||
}
|
||||
EOS
|
||||
end
|
||||
|
||||
it "should print the class for non-direct subclasses of AR::Base" do
|
||||
@ap = AwesomePrint.new(:plain => true)
|
||||
@ap.send(:awesome, SubUser).should == <<-EOS.strip
|
||||
class SubUser < User {
|
||||
:id => :integer,
|
||||
:name => :string,
|
||||
:rank => :integer,
|
||||
:admin => :boolean,
|
||||
:created_at => :datetime
|
||||
}
|
||||
EOS
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
rescue LoadError
|
||||
puts "Skipping ActiveRecord specs..."
|
||||
end
|
|
@ -1,22 +0,0 @@
|
|||
require File.expand_path(File.dirname(__FILE__) + '/spec_helper')
|
||||
|
||||
require 'active_support'
|
||||
require 'ap/mixin/active_support'
|
||||
|
||||
describe "AwesomePrint::ActiveSupport" do
|
||||
before do
|
||||
stub_dotfile!
|
||||
@ap = AwesomePrint::Inspector.new()
|
||||
end
|
||||
|
||||
it "should format ActiveSupport::TimeWithZone as regular Time" do
|
||||
Time.zone = 'Eastern Time (US & Canada)'
|
||||
time = Time.utc(2007, 2, 10, 20, 30, 45).in_time_zone
|
||||
@ap.send(:awesome, time).should == "\e[0;32mSat, 10 Feb 2007 15:30:45 EST -05:00\e[0m"
|
||||
end
|
||||
|
||||
it "should format HashWithIndifferentAccess as regular Hash" do
|
||||
hash = HashWithIndifferentAccess.new({ :hello => "world" })
|
||||
@ap.send(:awesome, hash).should == "{\n \"hello\"\e[0;37m => \e[0m\e[0;33m\"world\"\e[0m\n}"
|
||||
end
|
||||
end
|
|
@ -1,84 +1,84 @@
|
|||
require File.expand_path(File.dirname(__FILE__) + '/spec_helper')
|
||||
|
||||
describe "AwesomePrint" do
|
||||
before(:each) do
|
||||
stub_dotfile!
|
||||
end
|
||||
|
||||
describe "colorization" do
|
||||
PLAIN = '[ 1, :two, "three", [ nil, [ true, false ] ] ]'
|
||||
COLORIZED = "[ \e[1;34m1\e[0m, \e[0;36m:two\e[0m, \e[0;33m\"three\"\e[0m, [ \e[1;31mnil\e[0m, [ \e[1;32mtrue\e[0m, \e[1;31mfalse\e[0m ] ] ]"
|
||||
|
||||
before(:each) do
|
||||
AwesomePrint.force_colors!(false)
|
||||
ENV['TERM'] = "xterm-colors"
|
||||
ENV.delete('ANSICON')
|
||||
@arr = [ 1, :two, "three", [ nil, [ true, false] ] ]
|
||||
end
|
||||
|
||||
it "colorizes tty processes by default" do
|
||||
stub_tty!(STDOUT, true)
|
||||
|
||||
@arr.ai(:multiline => false).should == COLORIZED
|
||||
end
|
||||
|
||||
it "colorizes tty processes by default" do
|
||||
stub_tty!(STDOUT, true)
|
||||
|
||||
@arr.ai(:multiline => false).should == COLORIZED
|
||||
end
|
||||
|
||||
|
||||
it "colorizes processes with ENV['ANSICON'] by default" do
|
||||
stub_tty!(STDOUT, true)
|
||||
ENV['ANSICON'] = "1"
|
||||
|
||||
@arr.ai(:multiline => false).should == COLORIZED
|
||||
end
|
||||
|
||||
it "does not colorize tty processes running in dumb terminals by default" do
|
||||
stub_tty!(STDOUT, true)
|
||||
ENV['TERM'] = "dumb"
|
||||
|
||||
@arr.ai(:multiline => false).should == PLAIN
|
||||
end
|
||||
|
||||
it "does not colorize subprocesses by default" do
|
||||
stub_tty!(STDOUT, false)
|
||||
|
||||
@arr.ai(:multiline => false).should == PLAIN
|
||||
end
|
||||
|
||||
describe "forced" do
|
||||
before(:each) do
|
||||
AwesomePrint.force_colors!
|
||||
end
|
||||
|
||||
it "still colorizes tty processes" do
|
||||
stub_tty!(STDOUT, true)
|
||||
|
||||
@arr.ai(:multiline => false).should == COLORIZED
|
||||
end
|
||||
|
||||
it "colorizes dumb terminals" do
|
||||
stub_tty!(STDOUT, true)
|
||||
ENV["TERM"] = "dumb"
|
||||
|
||||
@arr.ai(:multiline => false).should == COLORIZED
|
||||
end
|
||||
|
||||
it "colorizes subprocess" do
|
||||
stub_tty!(STDOUT, true)
|
||||
@arr.ai(:multiline => false).should == COLORIZED
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
def stub_tty!(stream, value)
|
||||
eval(%{class << stream
|
||||
def tty?
|
||||
#{value}
|
||||
end
|
||||
end})
|
||||
end
|
||||
end
|
||||
# require File.expand_path(File.dirname(__FILE__) + '/spec_helper')
|
||||
#
|
||||
# describe "AwesomePrint" do
|
||||
# before(:each) do
|
||||
# stub_dotfile!
|
||||
# end
|
||||
#
|
||||
# describe "colorization" do
|
||||
# PLAIN = '[ 1, :two, "three", [ nil, [ true, false ] ] ]'
|
||||
# COLORIZED = "[ \e[1;34m1\e[0m, \e[0;36m:two\e[0m, \e[0;33m\"three\"\e[0m, [ \e[1;31mnil\e[0m, [ \e[1;32mtrue\e[0m, \e[1;31mfalse\e[0m ] ] ]"
|
||||
#
|
||||
# before(:each) do
|
||||
# AwesomePrint.force_colors!(false)
|
||||
# ENV['TERM'] = "xterm-colors"
|
||||
# ENV.delete('ANSICON')
|
||||
# @arr = [ 1, :two, "three", [ nil, [ true, false] ] ]
|
||||
# end
|
||||
#
|
||||
# it "colorizes tty processes by default" do
|
||||
# stub_tty!(STDOUT, true)
|
||||
#
|
||||
# @arr.ai(:multiline => false).should == COLORIZED
|
||||
# end
|
||||
#
|
||||
# it "colorizes tty processes by default" do
|
||||
# stub_tty!(STDOUT, true)
|
||||
#
|
||||
# @arr.ai(:multiline => false).should == COLORIZED
|
||||
# end
|
||||
#
|
||||
#
|
||||
# it "colorizes processes with ENV['ANSICON'] by default" do
|
||||
# stub_tty!(STDOUT, true)
|
||||
# ENV['ANSICON'] = "1"
|
||||
#
|
||||
# @arr.ai(:multiline => false).should == COLORIZED
|
||||
# end
|
||||
#
|
||||
# it "does not colorize tty processes running in dumb terminals by default" do
|
||||
# stub_tty!(STDOUT, true)
|
||||
# ENV['TERM'] = "dumb"
|
||||
#
|
||||
# @arr.ai(:multiline => false).should == PLAIN
|
||||
# end
|
||||
#
|
||||
# it "does not colorize subprocesses by default" do
|
||||
# stub_tty!(STDOUT, false)
|
||||
#
|
||||
# @arr.ai(:multiline => false).should == PLAIN
|
||||
# end
|
||||
#
|
||||
# describe "forced" do
|
||||
# before(:each) do
|
||||
# AwesomePrint.force_colors!
|
||||
# end
|
||||
#
|
||||
# it "still colorizes tty processes" do
|
||||
# stub_tty!(STDOUT, true)
|
||||
#
|
||||
# @arr.ai(:multiline => false).should == COLORIZED
|
||||
# end
|
||||
#
|
||||
# it "colorizes dumb terminals" do
|
||||
# stub_tty!(STDOUT, true)
|
||||
# ENV["TERM"] = "dumb"
|
||||
#
|
||||
# @arr.ai(:multiline => false).should == COLORIZED
|
||||
# end
|
||||
#
|
||||
# it "colorizes subprocess" do
|
||||
# stub_tty!(STDOUT, true)
|
||||
# @arr.ai(:multiline => false).should == COLORIZED
|
||||
# end
|
||||
# end
|
||||
# end
|
||||
#
|
||||
# def stub_tty!(stream, value)
|
||||
# eval(%{class << stream
|
||||
# def tty?
|
||||
# #{value}
|
||||
# end
|
||||
# end})
|
||||
# end
|
||||
# end
|
||||
|
|
|
@ -1,8 +1,8 @@
|
|||
require File.expand_path(File.dirname(__FILE__) + '/spec_helper')
|
||||
require File.expand_path(File.dirname(__FILE__) + '/../spec_helper')
|
||||
|
||||
|
||||
require 'logger'
|
||||
require 'ap/core_ext/logger'
|
||||
require 'awesome_print/core_ext/logger'
|
||||
|
||||
describe "AwesomePrint logging extensions" do
|
||||
before(:all) do
|
|
@ -1,4 +1,4 @@
|
|||
require File.expand_path(File.dirname(__FILE__) + '/spec_helper')
|
||||
require File.expand_path(File.dirname(__FILE__) + '/../spec_helper')
|
||||
|
||||
describe "String extensions" do
|
||||
[ :gray, :red, :green, :yellow, :blue, :purple, :cyan, :white ].each_with_index do |color, i|
|
|
@ -1,8 +1,8 @@
|
|||
require File.expand_path(File.dirname(__FILE__) + '/spec_helper')
|
||||
require File.expand_path(File.dirname(__FILE__) + '/../spec_helper')
|
||||
|
||||
begin
|
||||
require 'action_view'
|
||||
require 'ap/mixin/action_view'
|
||||
require 'awesome_print/ext/action_view'
|
||||
|
||||
describe "AwesomePrint ActionView extensions" do
|
||||
before do
|
133
spec/ext/active_record_spec.rb
Normal file
133
spec/ext/active_record_spec.rb
Normal file
|
@ -0,0 +1,133 @@
|
|||
require File.expand_path(File.dirname(__FILE__) + '/../spec_helper')
|
||||
|
||||
begin
|
||||
require 'active_record'
|
||||
require 'awesome_print/ext/active_record'
|
||||
|
||||
# Create tableless ActiveRecord model.
|
||||
#------------------------------------------------------------------------------
|
||||
class User < ActiveRecord::Base
|
||||
def self.columns()
|
||||
@columns ||= []
|
||||
end
|
||||
|
||||
def self.column(name, sql_type = nil, default = nil, null = true)
|
||||
columns << ActiveRecord::ConnectionAdapters::Column.new(name.to_s, default, sql_type.to_s, null)
|
||||
end
|
||||
|
||||
column :id, :integer
|
||||
column :name, :string
|
||||
column :rank, :integer
|
||||
column :admin, :boolean
|
||||
column :created_at, :datetime
|
||||
|
||||
def self.table_exists?
|
||||
true
|
||||
end
|
||||
end
|
||||
|
||||
class SubUser < User
|
||||
def self.columns
|
||||
User.columns
|
||||
end
|
||||
end
|
||||
|
||||
describe "AwesomePrint/ActiveRecord" do
|
||||
before(:each) do
|
||||
stub_dotfile!
|
||||
end
|
||||
|
||||
#------------------------------------------------------------------------------
|
||||
describe "ActiveRecord instance" do
|
||||
before(:each) do
|
||||
ActiveRecord::Base.default_timezone = :utc
|
||||
@diana = User.new(:name => "Diana", :rank => 1, :admin => false, :created_at => "1992-10-10 12:30:00")
|
||||
@laura = User.new(:name => "Laura", :rank => 2, :admin => true, :created_at => "2003-05-26 14:15:00")
|
||||
@ap = AwesomePrint.new(:plain => true)
|
||||
end
|
||||
|
||||
it "display single record" do
|
||||
out = @ap.send(:awesome, @diana)
|
||||
str = <<-EOS.strip
|
||||
#<User:0x01234567> {
|
||||
:id => nil,
|
||||
:name => "Diana",
|
||||
:rank => 1,
|
||||
:admin => false,
|
||||
:created_at => ?
|
||||
}
|
||||
EOS
|
||||
if RUBY_VERSION.to_f < 1.9
|
||||
str.sub!('?', 'Sat Oct 10 12:30:00 UTC 1992')
|
||||
else
|
||||
str.sub!('?', '1992-10-10 12:30:00 UTC')
|
||||
end
|
||||
|
||||
out.gsub(/0x([a-f\d]+)/, "0x01234567").should == str
|
||||
end
|
||||
|
||||
it "display multiple records" do
|
||||
out = @ap.send(:awesome, [ @diana, @laura ])
|
||||
str = <<-EOS.strip
|
||||
[
|
||||
[0] #<User:0x01234567> {
|
||||
:id => nil,
|
||||
:name => "Diana",
|
||||
:rank => 1,
|
||||
:admin => false,
|
||||
:created_at => ?
|
||||
},
|
||||
[1] #<User:0x01234567> {
|
||||
:id => nil,
|
||||
:name => "Laura",
|
||||
:rank => 2,
|
||||
:admin => true,
|
||||
:created_at => !
|
||||
}
|
||||
]
|
||||
EOS
|
||||
if RUBY_VERSION.to_f < 1.9
|
||||
str.sub!('?', 'Sat Oct 10 12:30:00 UTC 1992')
|
||||
str.sub!('!', 'Mon May 26 14:15:00 UTC 2003')
|
||||
else
|
||||
str.sub!('?', '1992-10-10 12:30:00 UTC')
|
||||
str.sub!('!', '2003-05-26 14:15:00 UTC')
|
||||
end
|
||||
|
||||
out.gsub(/0x([a-f\d]+)/, "0x01234567").should == str
|
||||
end
|
||||
end
|
||||
|
||||
#------------------------------------------------------------------------------
|
||||
describe "ActiveRecord class" do
|
||||
it "should print the class" do
|
||||
@ap = AwesomePrint.new(:plain => true)
|
||||
@ap.send(:awesome, User).should == <<-EOS.strip
|
||||
class User < ActiveRecord::Base {
|
||||
:id => :integer,
|
||||
:name => :string,
|
||||
:rank => :integer,
|
||||
:admin => :boolean,
|
||||
:created_at => :datetime
|
||||
}
|
||||
EOS
|
||||
end
|
||||
|
||||
it "should print the class for non-direct subclasses of AR::Base" do
|
||||
@ap = AwesomePrint.new(:plain => true)
|
||||
@ap.send(:awesome, SubUser).should == <<-EOS.strip
|
||||
class SubUser < User {
|
||||
:id => :integer,
|
||||
:name => :string,
|
||||
:rank => :integer,
|
||||
:admin => :boolean,
|
||||
:created_at => :datetime
|
||||
}
|
||||
EOS
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
rescue LoadError
|
||||
puts "Skipping ActiveRecord specs..."
|
||||
end
|
27
spec/ext/active_support_spec.rb
Normal file
27
spec/ext/active_support_spec.rb
Normal file
|
@ -0,0 +1,27 @@
|
|||
require File.expand_path(File.dirname(__FILE__) + '/../spec_helper')
|
||||
|
||||
begin
|
||||
require 'active_support'
|
||||
require 'awesome_print/ext/active_support'
|
||||
|
||||
describe "AwesomePrint::ActiveSupport" do
|
||||
before do
|
||||
stub_dotfile!
|
||||
@ap = AwesomePrint::Inspector.new()
|
||||
end
|
||||
|
||||
it "should format ActiveSupport::TimeWithZone as regular Time" do
|
||||
Time.zone = 'Eastern Time (US & Canada)'
|
||||
time = Time.utc(2007, 2, 10, 20, 30, 45).in_time_zone
|
||||
@ap.send(:awesome, time).should == "\e[0;32mSat, 10 Feb 2007 15:30:45 EST -05:00\e[0m"
|
||||
end
|
||||
|
||||
it "should format HashWithIndifferentAccess as regular Hash" do
|
||||
hash = HashWithIndifferentAccess.new({ :hello => "world" })
|
||||
@ap.send(:awesome, hash).should == "{\n \"hello\"\e[0;37m => \e[0m\e[0;33m\"world\"\e[0m\n}"
|
||||
end
|
||||
end
|
||||
|
||||
rescue LoadError
|
||||
puts "Skipping ActiveSupport specs..."
|
||||
end
|
|
@ -1,8 +1,8 @@
|
|||
require File.expand_path(File.dirname(__FILE__) + '/spec_helper')
|
||||
require File.expand_path(File.dirname(__FILE__) + '/../spec_helper')
|
||||
|
||||
begin
|
||||
require "mongo_mapper"
|
||||
require "ap/mixin/mongo_mapper"
|
||||
require "awesome_print/ext/mongo_mapper"
|
||||
|
||||
describe "AwesomePrint/MongoMapper" do
|
||||
before :all do
|
|
@ -19,7 +19,7 @@ end
|
|||
|
||||
# The following is needed for the Infinity Test. It runs tests as subprocesses,
|
||||
# which sets STDOUT.tty? to false and would otherwise prematurely disallow colors.
|
||||
AwesomePrint.force_colors!
|
||||
### AwesomePrint.force_colors!
|
||||
|
||||
# Ruby 1.8.6 only: define missing String methods that are needed for the specs to pass.
|
||||
if RUBY_VERSION < '1.8.7'
|
||||
|
|
Loading…
Reference in a new issue