Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

add integration spec for offline indexing

  • Loading branch information...
commit 12258a562d702c0c0245ab09294e837a7b399975 1 parent c2a5a23
James Golick authored
Showing with 31 additions and 0 deletions.
  1. +31 −0 spec/integration/offline_indexing_spec.rb
31 spec/integration/offline_indexing_spec.rb
View
@@ -0,0 +1,31 @@
+require File.expand_path("../../spec_helper", __FILE__)
+
+describe "Building an index offline" do
+ before do
+ $db.drop_table :awesome_things if $db.table_exists?(:awesome_things)
+
+ if $db.table_exists?(:index_awesome_things_on_name)
+ $db.drop_table :awesome_things_on_name
+ end
+
+ @klass = Class.new do
+ def self.name; "AwesomeThing"; end
+ def self.table_name; "awesome_things"; end
+
+ include Friendly::Document
+
+ attribute :name, String
+ end
+ @klass.create_tables!
+
+ @jameses = [@klass.create(:name => "James"), @klass.create(:name => "James")]
+
+ @klass.indexes :name
+ @klass.create_tables!
+ Friendly::Indexer.populate(@klass, :name)
+ end
+
+ it "builds the missing index rows for all the rows in the doc table" do
+ @klass.all(:name => "James").should == @jameses
+ end
+end
Please sign in to comment.
Something went wrong with that request. Please try again.