Sha256: a4d4ce15048e5892c9b77a29e60f0831b87f32201fc5413540ea2edbc248f69b

Contents?: true

Size: 1.1 KB

Versions: 2

Compression:

Stored size: 1.1 KB

Contents

describe "Integration Tests" do

  before do

    class << self
      include CDQ
    end

    cdq.setup

    @author = Author.create(name: "Albert Einstein")

    @fundamentals = @author.articles.create(body: "...", published: true, publishedAt: Time.local(1940),
                                            title: "Considerations concering the fundamentals of theoretical physics")

    @gravitation = @author.articles.create(body: "...", published: true, publishedAt: Time.local(1937),
                                           title: "On gravitational waves")

    @fcite = @fundamentals.citations.create(journal: "Science", timestamp: Time.local(1940))
    @gcite = @gravitation.citations.create(journal: "Nature", timestamp: Time.local(1941))

    cdq.save(always_wait: true)
  end

  after do
    cdq.reset!
  end

  it "should be able to combine simple queries" do
    @author.articles.count.should == 2
    @author.articles.first.citations.count.should == 1
    @author.articles.where(:title).matches('.*fundamentals.*').first.citations.array.should == [@fcite]

    @gcite.article.author.should == @author
  end

end

Version data entries

2 entries across 2 versions & 1 rubygems

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