test/lib/test_models.rb in wvanbergen-scoped_search-1.0.1 vs test/lib/test_models.rb in wvanbergen-scoped_search-1.1.0
- old
+ new
@@ -1,25 +1,25 @@
module ScopedSearch::Test::Models
class Foo < ActiveRecord::Base
def self.create_corpus!
- create!(:string_field => "Programmer 123", :text_field => nil, :ignored_field => "123456", :date_field => '2000-01-01')
- create!(:string_field => "Jim", :text_field => "Henson", :ignored_field => "123456a", :date_field => '2001-04-15')
- create!(:string_field => "Jim", :text_field => "Bush", :ignored_field => "123456b", :date_field => '2001-04-17')
- create!(:string_field => "Wes", :text_field => "Hays", :ignored_field => "123456c", :date_field => '1980-09-27')
- create!(:string_field => "Bob", :text_field => "Hays", :ignored_field => "123456d", :date_field => '2002-11-09')
- create!(:string_field => "Dogs", :text_field => "Pit Bull", :ignored_field => "123456e", :date_field => '2002-12-26')
- create!(:string_field => "Dogs", :text_field => "Eskimo", :ignored_field => "123456f", :date_field => '2003-03-19')
- create!(:string_field => "Cows", :text_field => "Farms", :ignored_field => "123456g", :date_field => '2004-05-01')
- create!(:string_field => "Hello World", :text_field => "Hello Moon", :ignored_field => "123456h", :date_field => '2004-07-11')
- create!(:string_field => "Hello World", :text_field => "Goodnight Moon", :ignored_field => "123456i", :date_field => '2004-09-12')
- create!(:string_field => "Happy Cow", :text_field => "Sad Cow", :ignored_field => "123456j", :date_field => '2005-02-05')
- create!(:string_field => "Happy Frog", :text_field => "Sad Frog", :ignored_field => "123456k", :date_field => '2006-03-09')
- create!(:string_field => "Excited Frog", :text_field => "Sad Frog", :ignored_field => "123456l", :date_field => '2006-07-15')
- create!(:string_field => "Man made", :text_field => "Woman made", :ignored_field => "123456m", :date_field => '2007-06-13')
- create!(:string_field => "Cat Toys", :text_field => "Frog Toys", :ignored_field => "123456n", :date_field => '2008-03-04')
- create!(:string_field => "Happy Toys", :text_field => "Sad Toys", :ignored_field => "123456n", :date_field => '2008-05-12')
+ create!(:string_field => "Programmer 123", :text_field => nil, :ignored_field => "123456", :some_int_field => 111, :date_field => '2000-01-01')
+ create!(:string_field => "Jim", :text_field => "Henson", :ignored_field => "123456a", :some_int_field => 222, :date_field => '2001-04-15')
+ create!(:string_field => "Jim", :text_field => "Bush", :ignored_field => "123456b", :some_int_field => 333, :date_field => '2001-04-17')
+ create!(:string_field => "Wes", :text_field => "Hays", :ignored_field => "123456c", :some_int_field => 444, :date_field => '1980-09-27')
+ create!(:string_field => "Bob", :text_field => "Hays", :ignored_field => "123456d", :some_int_field => 555, :date_field => '2002-11-09')
+ create!(:string_field => "Dogs", :text_field => "Pit Bull", :ignored_field => "123456e", :some_int_field => 666, :date_field => '2002-12-26')
+ create!(:string_field => "Dogs", :text_field => "Eskimo", :ignored_field => "123456f", :some_int_field => 777, :date_field => '2003-03-19')
+ create!(:string_field => "Cows", :text_field => "Farms", :ignored_field => "123456g", :some_int_field => 888, :date_field => '2004-05-01')
+ create!(:string_field => "Hello World", :text_field => "Hello Moon", :ignored_field => "123456h", :some_int_field => 999, :date_field => '2004-07-11')
+ create!(:string_field => "Hello World", :text_field => "Goodnight Moon", :ignored_field => "123456i", :some_int_field => 100, :date_field => '2004-09-12')
+ create!(:string_field => "Happy Cow", :text_field => "Sad Cow", :ignored_field => "123456j", :some_int_field => 200, :date_field => '2005-02-05')
+ create!(:string_field => "Happy Frog", :text_field => "Sad Frog", :ignored_field => "123456k", :some_int_field => 300, :date_field => '2006-03-09')
+ create!(:string_field => "Excited Frog", :text_field => "Sad Frog", :ignored_field => "123456l", :some_int_field => 400, :date_field => '2006-07-15')
+ create!(:string_field => "Man made", :text_field => "Woman made", :ignored_field => "123456m", :some_int_field => 500, :date_field => '2007-06-13')
+ create!(:string_field => "Cat Toys", :text_field => "Frog Toys", :ignored_field => "123456n", :some_int_field => 600, :date_field => '2008-03-04')
+ create!(:string_field => "Happy Toys", :text_field => "Sad Toys", :ignored_field => "123456n", :some_int_field => 700, :date_field => '2008-05-12')
create!(:string_field => "My son was born on 7/15/2006 and weighed 5.5 lbs",
:text_field => "Sad Toys",
:ignored_field => "123456n",
:date_field => '2008-09-22')
@@ -34,14 +34,14 @@
has_many :offices, :dependent => :destroy
has_many :clients, :through => :offices
def self.create_corpus!
- create!(:first_name => 'Willem', :last_name => 'Van Bergen', :login => 'wvanbergen', :group_id => 1, :address_id => 1)
- create!(:first_name => 'Wes', :last_name => 'Hays', :login => 'weshays', :group_id => 1, :address_id => 2)
- create!(:first_name => 'John', :last_name => 'Dell', :login => 'jdell', :group_id => 2, :address_id => 3)
- create!(:first_name => 'Ray', :last_name => 'York', :login => 'ryork', :group_id => 3, :address_id => 4)
- create!(:first_name => 'Anna', :last_name => 'Landis', :login => 'alandis', :group_id => 4, :address_id => 5)
+ create!(:first_name => 'Willem', :last_name => 'Van Bergen', :login => 'wvanbergen', :age => 25, :group_id => 1, :address_id => 1)
+ create!(:first_name => 'Wes', :last_name => 'Hays', :login => 'weshays', :age => 26, :group_id => 1, :address_id => 2)
+ create!(:first_name => 'John', :last_name => 'Dell', :login => 'jdell', :age => 27, :group_id => 2, :address_id => 3)
+ create!(:first_name => 'Ray', :last_name => 'York', :login => 'ryork', :age => 28, :group_id => 3, :address_id => 4)
+ create!(:first_name => 'Anna', :last_name => 'Landis', :login => 'alandis', :age => 29, :group_id => 4, :address_id => 5)
user = self.find_by_first_name('Willem')
user.locations << ScopedSearch::Test::Models::Location.find_by_name('Office')
user = self.find_by_first_name('Wes')