Sha256: f5ea95fe6bee5daa5c3aeca0e488dd86a9fb4a34e71d850ad409d4d78021897c

Contents?: true

Size: 1011 Bytes

Versions: 2

Compression:

Stored size: 1011 Bytes

Contents

require 'test/unit'
require 'rubygems'
require 'active_record'

require "#{File.dirname(__FILE__)}/../lib/scoped_search"

def setup_db
  ActiveRecord::Base.establish_connection(:adapter => "sqlite3", :dbfile => ":memory:")
  ActiveRecord::Schema.define(:version => 1) do
    create_table :search_test_models do |t|
      t.string :string_field
      t.text :text_field
      t.string :ignored_field
      t.timestamps
    end
  end
end

def teardown_db
  ActiveRecord::Base.connection.tables.each { |table| ActiveRecord::Base.connection.drop_table(table) }
end

class SearchTestModel < ActiveRecord::Base
  def self.create_corpus!
    create!(:string_field => "123", :text_field => "Hallo",     :ignored_field => "123 willem")
    create!(:string_field => "456", :text_field => "Hallo 123", :ignored_field => "123")
    create!(:string_field => "789", :text_field => "HALLO",     :ignored_field => "123456");
    create!(:string_field => "123", :text_field => nil,         :ignored_field => "123456");
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
wvanbergen-scoped_search-0.1.2 test/test_helper.rb
wvanbergen-scoped_search-0.1.3 test/test_helper.rb