Skip to content

Commit

Permalink
add integration spec for offline indexing
Browse files Browse the repository at this point in the history
  • Loading branch information
jamesgolick committed Jan 25, 2010
1 parent c2a5a23 commit 12258a5
Showing 1 changed file with 31 additions and 0 deletions.
31 changes: 31 additions & 0 deletions spec/integration/offline_indexing_spec.rb
@@ -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

0 comments on commit 12258a5

Please sign in to comment.