Sha256: 135269f9005c8ebf8403d9954759b8c1e73c65df1beecaec68afa7f086556b90

Contents?: true

Size: 698 Bytes

Versions: 6

Compression:

Stored size: 698 Bytes

Contents

require "spec_helper"

describe Mongoid::NestedSerialization::Finder do
  let(:account) { Mongoid::NestedSerialization::Test::Account.create }
  let(:item) { account.items.create }
  let(:photo) { item.photos.create }
  
  describe "#find" do
    it "should find top-level objects" do
      result = account.class.find_by_json(account.finder_json)
      expect(result).to eq account
    end
    
    it "should find second-level objects" do
      result = item.class.find_by_json(item.finder_json)
      expect(result).to eq item
    end
    
    it "should find third-level objects" do
      result = photo.class.find_by_json(photo.finder_json)
      expect(result).to eq photo
    end
  end

end

Version data entries

6 entries across 6 versions & 1 rubygems

Version Path
mongoid-nested-serialization-0.0.6 spec/mongoid/nested_serialization/finder_spec.rb
mongoid-nested-serialization-0.0.5 spec/mongoid/nested_serialization/finder_spec.rb
mongoid-nested-serialization-0.0.4 spec/mongoid/nested_serialization/finder_spec.rb
mongoid-nested-serialization-0.0.3 spec/mongoid/nested_serialization/finder_spec.rb
mongoid-nested-serialization-0.0.2 spec/mongoid/nested_serialization/finder_spec.rb
mongoid-nested-serialization-0.0.1 spec/mongoid/nested_serialization/finder_spec.rb