Sha256: 51ae4d70edfe45b8b07fc5d4dc0f2d655de7a30d3ac3946c1dc3eb56eb6d2446

Contents?: true

Size: 1.21 KB

Versions: 28

Compression:

Stored size: 1.21 KB

Contents

require 'test/unit'
require 'fileutils'
require 'rubygems'
require 'active_record'
require 'active_record/fixtures'
require File.dirname(__FILE__) + '/../lib/acts_as_indexed'

# Mock out the required environment variables.
RAILS_ENV = 'test'
RAILS_ROOT = Dir.pwd

ActiveRecord::Base.logger = Logger.new(File.dirname(__FILE__) + '/test.log')
ActiveRecord::Base.configurations = YAML::load(IO.read(File.dirname(__FILE__) + '/database.yml'))
ActiveRecord::Base.establish_connection(ENV['DB'] || 'sqlite3')

# Load Schema
load(File.dirname(__FILE__) + '/schema.rb')

# Load model.
$LOAD_PATH.unshift(File.dirname(__FILE__) + '/fixtures/')

class ActiveSupport::TestCase #:nodoc:
  include ActiveRecord::TestFixtures
  self.fixture_path = File.dirname(__FILE__) + '/fixtures/'
  self.use_transactional_fixtures = true
  self.use_instantiated_fixtures  = false
  
  def destroy_index
    FileUtils::rm_rf(index_loc) if File.exists?(index_loc)
    assert !File.exists?(index_loc)
    true
  end
  
  def build_index
    # Makes a query to invoke the index build.
    assert_equal [], Post.find_with_index('badger')
    assert File.exists?(index_loc)
    true
  end
  
  protected
  
  def index_loc
    File.join(RAILS_ROOT,'index')
  end
  
end

Version data entries

28 entries across 28 versions & 1 rubygems

Version Path
refinerycms-0.9.5.13 vendor/plugins/acts_as_indexed/test/abstract_unit.rb
refinerycms-0.9.5.12 vendor/plugins/acts_as_indexed/test/abstract_unit.rb
refinerycms-0.9.5.11 vendor/plugins/acts_as_indexed/test/abstract_unit.rb
refinerycms-0.9.5.10 vendor/plugins/acts_as_indexed/test/abstract_unit.rb
refinerycms-0.9.5.9 vendor/plugins/acts_as_indexed/test/abstract_unit.rb
refinerycms-0.9.5.8 vendor/plugins/acts_as_indexed/test/abstract_unit.rb
refinerycms-0.9.5.7 vendor/plugins/acts_as_indexed/test/abstract_unit.rb
refinerycms-0.9.5.6 vendor/plugins/acts_as_indexed/test/abstract_unit.rb
refinerycms-0.9.5.5 vendor/plugins/acts_as_indexed/test/abstract_unit.rb
refinerycms-0.9.5.4 vendor/plugins/acts_as_indexed/test/abstract_unit.rb
refinerycms-0.9.5.3 vendor/plugins/acts_as_indexed/test/abstract_unit.rb
refinerycms-0.9.5.2 vendor/plugins/acts_as_indexed/test/abstract_unit.rb
refinerycms-0.9.5.1 vendor/plugins/acts_as_indexed/test/abstract_unit.rb
refinerycms-0.9.5 vendor/plugins/acts_as_indexed/test/abstract_unit.rb
refinerycms-0.9.4.5 vendor/plugins/acts_as_indexed/test/abstract_unit.rb
refinerycms-0.9.4.4 vendor/plugins/acts_as_indexed/test/abstract_unit.rb
refinerycms-0.9.4.3 vendor/plugins/acts_as_indexed/test/abstract_unit.rb
refinerycms-0.9.4.2 vendor/plugins/acts_as_indexed/test/abstract_unit.rb
refinerycms-0.9.4.1 vendor/plugins/acts_as_indexed/test/abstract_unit.rb
refinerycms-0.9.4 vendor/plugins/acts_as_indexed/test/abstract_unit.rb