Sha256: 8ddd3f00c47305923ce2d31cfef01865fbfa0a4c9458bfed4886545eb95c5cad

Contents?: true

Size: 691 Bytes

Versions: 2

Compression:

Stored size: 691 Bytes

Contents

module CDQ
  describe "CDQ Object Proxy" do

    before do
      class << self
        include CDQ
      end

      cdq.setup

      @author = Author.create(name: "Stephen King")
      @article = Article.create(title: "IT", author: @author)

      @op = CDQObjectProxy.new(@author)
    end

    after do
      cdq.reset!
    end

    it "wraps an NSManagedObject" do
      @op.get.should == @author
    end

    it "wraps relations in CDQRelationshipQuery objects" do
      @op.articles.class.should == CDQRelationshipQuery
      @op.articles.first.should == @article
    end

    it "can delete the underlying object" do
      @op.destroy
      Author.count.should == 0
    end

  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
cdq-0.1.2 spec/cdq/object_proxy_spec.rb
cdq-0.1.1 spec/cdq/object_proxy_spec.rb