Sha256: 98c6373e0d73caf9d55e40ecd3731f70b54f36542f6890eae5b23f2b130dd861

Contents?: true

Size: 746 Bytes

Versions: 24

Compression:

Stored size: 746 Bytes

Contents

require 'spec_helper'

class Drink
  include CouchPotato::Persistence
  
  property :alcohol
end

describe CouchPotato::Persistence::Json do
  context '#to_hash' do
    it "should inject JSON.create_id into the hash representation of a persistent object" do
      sake = Drink.new(:alcohol => "18%")
      sake.to_hash[JSON.create_id].should eql("Drink")
    end
    
    it "should not include _attachments if there are none" do
      sake = Drink.new(:alcohol => "18%")
      sake.to_hash.keys.should_not include('_attachments')
    end
    
  end
  
  context '.json_create' do
    it 'should assign the _document' do
      sake = Drink.json_create({"alcohol" => "18%"})
      sake._document.should == {"alcohol" => "18%"}
    end
  end
  
end

Version data entries

24 entries across 24 versions & 2 rubygems

Version Path
couch_potato-1.4.0 spec/unit/json_spec.rb
couch_potato-1.3.0 spec/unit/json_spec.rb
couch_potato-1.2.0 spec/unit/json_spec.rb
couch_potato-1.1.4 spec/unit/json_spec.rb
couch_potato-1.1.2 spec/unit/json_spec.rb
couch_potato-1.1.1 spec/unit/json_spec.rb
couch_potato-1.1.0 spec/unit/json_spec.rb
couch_potato-1.0.1 spec/unit/json_spec.rb
couch_potato-1.0.0 spec/unit/json_spec.rb
couch_potato-0.7.1 spec/unit/json_spec.rb
couch_potato-0.7.0 spec/unit/json_spec.rb
couch_potato-0.7.0.pre.1 spec/unit/json_spec.rb
couch_potato-0.6.0 spec/unit/json_spec.rb
couch_potato-0.5.7 spec/unit/json_spec.rb
couch_potato-rails2-0.5.10 spec/unit/json_spec.rb
couch_potato-rails2-0.5.9 spec/unit/json_spec.rb
couch_potato-rails2-0.5.8 spec/unit/json_spec.rb
couch_potato-rails2-0.5.7 spec/unit/json_spec.rb
couch_potato-rails2-0.5.6 spec/unit/json_spec.rb
couch_potato-0.5.6 spec/unit/json_spec.rb