lazy-searchlogic 2.4.10

Sign up to get free protection for your applications and to get access to all the features.
@@ -0,0 +1,129 @@
1
+ require 'spec'
2
+ require 'rubygems'
3
+ require 'ruby-debug'
4
+ require 'active_record'
5
+
6
+ ENV['TZ'] = 'UTC'
7
+ Time.zone = 'Eastern Time (US & Canada)'
8
+
9
+ ActiveRecord::Base.establish_connection(:adapter => "sqlite3", :database => ":memory:")
10
+ ActiveRecord::Base.configurations = true
11
+
12
+ ActiveRecord::Schema.verbose = false
13
+ ActiveRecord::Schema.define(:version => 1) do
14
+ create_table :audits do |t|
15
+ t.string :auditable_type
16
+ t.integer :auditable_id
17
+ end
18
+
19
+ create_table :companies do |t|
20
+ t.datetime :created_at
21
+ t.datetime :updated_at
22
+ t.string :name
23
+ t.string :description
24
+ t.integer :users_count, :default => 0
25
+ end
26
+
27
+ create_table :user_groups do |t|
28
+ t.string :name
29
+ end
30
+
31
+ create_table :user_groups_users, :id => false do |t|
32
+ t.integer :user_group_id, :null => false
33
+ t.integer :user_id, :null => false
34
+ end
35
+
36
+ create_table :users do |t|
37
+ t.datetime :created_at
38
+ t.datetime :updated_at
39
+ t.integer :company_id
40
+ t.string :username
41
+ t.string :name
42
+ t.integer :age
43
+ t.boolean :male
44
+ t.string :some_type_id
45
+ end
46
+
47
+ create_table :carts do |t|
48
+ t.datetime :created_at
49
+ t.datetime :updated_at
50
+ t.integer :user_id
51
+ end
52
+
53
+ create_table :orders do |t|
54
+ t.datetime :created_at
55
+ t.datetime :updated_at
56
+ t.integer :user_id
57
+ t.date :shipped_on
58
+ t.float :taxes
59
+ t.float :total
60
+ end
61
+
62
+ create_table :fees do |t|
63
+ t.datetime :created_at
64
+ t.datetime :updated_at
65
+ t.string :owner_type
66
+ t.integer :owner_id
67
+ t.float :cost
68
+ end
69
+
70
+ create_table :line_items do |t|
71
+ t.datetime :created_at
72
+ t.datetime :updated_at
73
+ t.integer :order_id
74
+ t.float :price
75
+ end
76
+ end
77
+
78
+ $LOAD_PATH.unshift(File.dirname(__FILE__))
79
+ $LOAD_PATH.unshift(File.join(File.dirname(__FILE__), '..', 'lib'))
80
+ require 'searchlogic'
81
+
82
+ Spec::Runner.configure do |config|
83
+ config.before(:each) do
84
+ class Audit < ActiveRecord::Base
85
+ belongs_to :auditable, :polymorphic => true
86
+ end
87
+
88
+ class Company < ActiveRecord::Base
89
+ has_many :orders, :through => :users
90
+ has_many :users, :dependent => :destroy
91
+ end
92
+
93
+ class UserGroup < ActiveRecord::Base
94
+ has_and_belongs_to_many :users
95
+ end
96
+
97
+ class User < ActiveRecord::Base
98
+ belongs_to :company, :counter_cache => true
99
+ has_many :orders, :dependent => :destroy
100
+ has_many :orders_big, :class_name => 'Order', :conditions => 'total > 100'
101
+ has_and_belongs_to_many :user_groups
102
+ end
103
+
104
+ class Order < ActiveRecord::Base
105
+ belongs_to :user
106
+ has_many :line_items, :dependent => :destroy
107
+ end
108
+
109
+ class Fee < ActiveRecord::Base
110
+ belongs_to :owner, :polymorphic => true
111
+ end
112
+
113
+ class LineItem < ActiveRecord::Base
114
+ belongs_to :order
115
+ end
116
+
117
+ Company.destroy_all
118
+ User.destroy_all
119
+ Order.destroy_all
120
+ LineItem.destroy_all
121
+ end
122
+
123
+ config.after(:each) do
124
+ Object.send(:remove_const, :Company)
125
+ Object.send(:remove_const, :User)
126
+ Object.send(:remove_const, :Order)
127
+ Object.send(:remove_const, :LineItem)
128
+ end
129
+ end
metadata ADDED
@@ -0,0 +1,107 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: lazy-searchlogic
3
+ version: !ruby/object:Gem::Version
4
+ version: 2.4.10
5
+ platform: ruby
6
+ authors:
7
+ - Ben Johnson of Binary Logic
8
+ - Michael Deering
9
+ autorequire:
10
+ bindir: bin
11
+ cert_chain: []
12
+
13
+ date: 2010-02-10 00:00:00 -07:00
14
+ default_executable:
15
+ dependencies:
16
+ - !ruby/object:Gem::Dependency
17
+ name: activerecord
18
+ type: :runtime
19
+ version_requirement:
20
+ version_requirements: !ruby/object:Gem::Requirement
21
+ requirements:
22
+ - - ">="
23
+ - !ruby/object:Gem::Version
24
+ version: 2.0.0
25
+ version:
26
+ description: Searchlogic makes using ActiveRecord named scopes easier and less repetitive. (lazy polymorphic eval)
27
+ email: bjohnson@binarylogic.com (lazy polymorphic eval patch mdeeirng@mdeering.com)
28
+ executables: []
29
+
30
+ extensions: []
31
+
32
+ extra_rdoc_files:
33
+ - LICENSE
34
+ - README.rdoc
35
+ files:
36
+ - .gitignore
37
+ - LICENSE
38
+ - README.rdoc
39
+ - Rakefile
40
+ - VERSION.yml
41
+ - init.rb
42
+ - lib/searchlogic.rb
43
+ - lib/searchlogic/active_record/consistency.rb
44
+ - lib/searchlogic/active_record/named_scope_tools.rb
45
+ - lib/searchlogic/core_ext/object.rb
46
+ - lib/searchlogic/core_ext/proc.rb
47
+ - lib/searchlogic/named_scopes/alias_scope.rb
48
+ - lib/searchlogic/named_scopes/association_conditions.rb
49
+ - lib/searchlogic/named_scopes/association_ordering.rb
50
+ - lib/searchlogic/named_scopes/conditions.rb
51
+ - lib/searchlogic/named_scopes/or_conditions.rb
52
+ - lib/searchlogic/named_scopes/ordering.rb
53
+ - lib/searchlogic/rails_helpers.rb
54
+ - lib/searchlogic/search.rb
55
+ - rails/init.rb
56
+ - searchlogic.gemspec
57
+ - spec/active_record/consistency_spec.rb
58
+ - spec/core_ext/object_spec.rb
59
+ - spec/core_ext/proc_spec.rb
60
+ - spec/named_scopes/alias_scope_spec.rb
61
+ - spec/named_scopes/association_conditions_spec.rb
62
+ - spec/named_scopes/association_ordering_spec.rb
63
+ - spec/named_scopes/conditions_spec.rb
64
+ - spec/named_scopes/or_conditions_spec.rb
65
+ - spec/named_scopes/ordering_spec.rb
66
+ - spec/search_spec.rb
67
+ - spec/spec_helper.rb
68
+ has_rdoc: true
69
+ homepage: http://github.com/mdeering/searchlogic
70
+ licenses: []
71
+
72
+ post_install_message:
73
+ rdoc_options:
74
+ - --charset=UTF-8
75
+ require_paths:
76
+ - lib
77
+ required_ruby_version: !ruby/object:Gem::Requirement
78
+ requirements:
79
+ - - ">="
80
+ - !ruby/object:Gem::Version
81
+ version: "0"
82
+ version:
83
+ required_rubygems_version: !ruby/object:Gem::Requirement
84
+ requirements:
85
+ - - ">="
86
+ - !ruby/object:Gem::Version
87
+ version: "0"
88
+ version:
89
+ requirements: []
90
+
91
+ rubyforge_project: lazy-searchlogic
92
+ rubygems_version: 1.3.5
93
+ signing_key:
94
+ specification_version: 3
95
+ summary: Searchlogic makes using ActiveRecord named scopes easier and less repetitive. (lazy polymorphic eval)
96
+ test_files:
97
+ - spec/active_record/consistency_spec.rb
98
+ - spec/core_ext/object_spec.rb
99
+ - spec/core_ext/proc_spec.rb
100
+ - spec/named_scopes/alias_scope_spec.rb
101
+ - spec/named_scopes/association_conditions_spec.rb
102
+ - spec/named_scopes/association_ordering_spec.rb
103
+ - spec/named_scopes/conditions_spec.rb
104
+ - spec/named_scopes/or_conditions_spec.rb
105
+ - spec/named_scopes/ordering_spec.rb
106
+ - spec/search_spec.rb
107
+ - spec/spec_helper.rb