Sha256: 28b872b62d0aba42fe05fa811514b26242e355d222dc5eb6875df402e3b2c11b
Contents?: true
Size: 991 Bytes
Versions: 1
Compression:
Stored size: 991 Bytes
Contents
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 :index_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 it "ignores records that are already in the index" do lambda { Friendly::Indexer.populate(@klass, :name) }.should_not raise_error end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
friendly-0.5.0 | spec/integration/offline_indexing_spec.rb |