mirror of
https://github.com/awesome-print/awesome_print
synced 2023-03-27 23:22:34 -04:00
55 lines
1.2 KiB
Ruby
55 lines
1.2 KiB
Ruby
require File.expand_path(File.dirname(__FILE__) + '/../spec_helper')
|
|
|
|
begin
|
|
require 'ripple'
|
|
require 'awesome_print/ext/ripple'
|
|
|
|
describe 'AwesomePrint/Ripple' do
|
|
before :all do
|
|
class RippleUser
|
|
include Ripple::Document
|
|
|
|
key_on :_id
|
|
property :_id, String
|
|
property :first_name, String
|
|
property :last_name, String
|
|
end
|
|
end
|
|
|
|
after :all do
|
|
Object.instance_eval { remove_const :RippleUser }
|
|
end
|
|
|
|
before do
|
|
stub_dotfile!
|
|
@ap = AwesomePrint::Inspector.new :plain => true, :sort_keys => true
|
|
end
|
|
|
|
it "should print class instance" do
|
|
user = RippleUser.new :_id => "12345", :first_name => "Al", :last_name => "Capone"
|
|
out = @ap.send :awesome, user
|
|
|
|
out.should == <<-EOS.strip
|
|
#<RippleUser:12345> {
|
|
:_id => "12345",
|
|
:first_name => "Al",
|
|
:last_name => "Capone"
|
|
}
|
|
EOS
|
|
end
|
|
|
|
it "should print the class" do
|
|
@ap.send(:awesome, RippleUser).should == <<-EOS.strip
|
|
class RippleUser < Object {
|
|
:_id => :string,
|
|
:_type => :string,
|
|
:first_name => :string,
|
|
:last_name => :string
|
|
}
|
|
EOS
|
|
end
|
|
end
|
|
|
|
rescue LoadError => error
|
|
puts "Skipping Ripple specs: #{error}"
|
|
end
|