1
0
Fork 0
mirror of https://github.com/awesome-print/awesome_print synced 2023-03-27 23:22:34 -04:00

Added specs for Ripple (but still can't get them to run)

This commit is contained in:
shyndman 2013-02-07 15:53:44 -05:00
parent bada37f595
commit 7eef826a63

55
spec/ext/ripple_spec.rb Normal file
View file

@ -0,0 +1,55 @@
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