Sha256: fcc20545be755aca7873855bb7b69a0ed9a71fbe293ae89d8aab9d3f8fc25de1

Contents?: true

Size: 1.2 KB

Versions: 53

Compression:

Stored size: 1.2 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

53 entries across 53 versions & 2 rubygems

Version Path
jacobat-refinerycms-0.9.6.14 vendor/plugins/acts_as_indexed/test/abstract_unit.rb
refinerycms-0.9.6.34 vendor/plugins/acts_as_indexed/test/abstract_unit.rb
refinerycms-0.9.6.33 vendor/plugins/acts_as_indexed/test/abstract_unit.rb
refinerycms-0.9.6.32 vendor/plugins/acts_as_indexed/test/abstract_unit.rb
refinerycms-0.9.6.31 vendor/plugins/acts_as_indexed/test/abstract_unit.rb
refinerycms-0.9.6.30 vendor/plugins/acts_as_indexed/test/abstract_unit.rb
refinerycms-0.9.6.29 vendor/plugins/acts_as_indexed/test/abstract_unit.rb
refinerycms-0.9.6.28 vendor/plugins/acts_as_indexed/test/abstract_unit.rb
refinerycms-0.9.6.27 vendor/plugins/acts_as_indexed/test/abstract_unit.rb
refinerycms-0.9.6.26 vendor/plugins/acts_as_indexed/test/abstract_unit.rb
refinerycms-0.9.6.25 vendor/plugins/acts_as_indexed/test/abstract_unit.rb
refinerycms-0.9.6.24 vendor/plugins/acts_as_indexed/test/abstract_unit.rb
refinerycms-0.9.6.23 vendor/plugins/acts_as_indexed/test/abstract_unit.rb
refinerycms-0.9.6.22 vendor/plugins/acts_as_indexed/test/abstract_unit.rb
refinerycms-0.9.6.21 vendor/plugins/acts_as_indexed/test/abstract_unit.rb
refinerycms-0.9.6.19 vendor/plugins/acts_as_indexed/test/abstract_unit.rb
refinerycms-0.9.6.18 vendor/plugins/acts_as_indexed/test/abstract_unit.rb
refinerycms-0.9.6.17 vendor/plugins/acts_as_indexed/test/abstract_unit.rb
refinerycms-0.9.6.16 vendor/plugins/acts_as_indexed/test/abstract_unit.rb
refinerycms-0.9.6.15 vendor/plugins/acts_as_indexed/test/abstract_unit.rb