searchlogic 2.5.15 → 2.5.16

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,15 +1,15 @@
1
1
  ---
2
2
  !binary "U0hBMQ==":
3
3
  metadata.gz: !binary |-
4
- MGE2MTk1ZjAzYWQ0ODVkNjg1M2Y3MzYzZmEwMjcxN2E2ZGMwMTNjMg==
4
+ NTZhMTNmZDNiMDlkZjcyZjI5MmI2ZjE1OWY3M2IxMmI5NTI0MzQ1OA==
5
5
  data.tar.gz: !binary |-
6
- M2ExYTk4MjkxNzhlZjk4ZWM4NGE3MDhkMmI1NDViODBhY2VhOWZlNA==
6
+ ZDIzMjY3N2RiNmJiZWU5MmIzOTQwODFlNWYxMDRhOWQ5YTk5NjZmYw==
7
7
  SHA512:
8
8
  metadata.gz: !binary |-
9
- ODJmNDkzYTAyZTZkZTc1NGE3MTAxMDMzZGFlZTM0MmI1MTQ0ODdiMzI1YzI5
10
- MDJmMTgwZDM3OTAwODg3NmMxOGRkZjVmNTgxOTI2OWUxOGJjMTZjNDQ0MjNk
11
- ZmRkZjI2YjZlYTE2NjdiZGEwYTY5MmMzODQ1NzNkYTY2OGU5MzY=
9
+ Zjg0NWI3OWFiOGY3NTY1YzJhYWM0ZjRmNGZlY2IwYjI3MGI0ZGMyNTVjZDI0
10
+ YTIyN2NlNjE2MjRlYjg3YTYyYmY3NzdkZDNjNGMxMzJiYjIwMDRmNGQ4Njc1
11
+ NTM1YWQ3NWRjYzMxMmFjNmIwNTJhNTI1MTkwY2I1NjBlZTc1MmE=
12
12
  data.tar.gz: !binary |-
13
- NGRkZTJmYWRjMTlhYzgyNTdlYzQ5NjU5YmZiNjM4ZGJiMTIxMDRjZGNjMGE5
14
- ZmFlYjRjNWQ4MDAxYzQ2YTEzZmFiMjEyYTNmYzJiOGM1NzZkNGI5NzE3NTJm
15
- YTBhZDQwMjJkMTQ0Njc1NTJiZjMyZWMxMDNjYTFjZjdlMWRmZTQ=
13
+ ODcyMTk3YTNmODY0NTRjN2Q1MmY4YmUxMzVhOTBmMmZmYjFjYTQ0YzAwOTA0
14
+ NWFjNGMzNTg5ZTVkYjQyNmI3ZmJlN2I3MTY4MTY0YWRkMmM3YWQ0NjViY2Qy
15
+ MTU2OTkzZTU2MTU2ZjNjZmVhNDhkNTcyYjRjNmE3YWNjN2UyOTM=
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- searchlogic (2.5.12)
4
+ searchlogic (2.5.15)
5
5
  activerecord (~> 2.3.12)
6
6
  activesupport (~> 2.3.12)
7
7
 
@@ -16,7 +16,7 @@ GEM
16
16
  rake
17
17
  coderay (1.1.0)
18
18
  method_source (0.8.2)
19
- pry (0.9.12.3)
19
+ pry (0.9.12.4)
20
20
  coderay (~> 1.0)
21
21
  method_source (~> 0.8)
22
22
  slop (~> 3.4)
@@ -24,6 +24,7 @@ GEM
24
24
  rspec (1.3.2)
25
25
  slop (3.4.7)
26
26
  sqlite3 (1.3.8)
27
+ timecop (0.5.9.2)
27
28
 
28
29
  PLATFORMS
29
30
  ruby
@@ -34,3 +35,4 @@ DEPENDENCIES
34
35
  rspec (~> 1.3.1)
35
36
  searchlogic!
36
37
  sqlite3
38
+ timecop (~> 0.5.9.1)
@@ -12,7 +12,7 @@ module Searchlogic
12
12
  end
13
13
 
14
14
  # We need to try and create other conditions first so that we give priority to conflicting names.
15
- # Such as having a column names the exact same name as an association condition.
15
+ # Such as having a column name with the exact same name as an association condition.
16
16
  def create_condition(name)
17
17
  if result = super
18
18
  result
@@ -62,7 +62,7 @@ module Searchlogic
62
62
  raise ArgumentError.new("The #{klass} class does not respond to the #{association_condition} scope") if !klass.respond_to?(association_condition)
63
63
  arity = klass.named_scope_arity(association_condition)
64
64
 
65
- if !arity || arity == 0
65
+ if !arity
66
66
  # The underlying condition doesn't require any parameters, so let's just create a simple
67
67
  # named scope that is based on a hash.
68
68
  options = {}
@@ -1,3 +1,3 @@
1
1
  module Searchlogic
2
- VERSION = "2.5.15"
2
+ VERSION = "2.5.16"
3
3
  end
@@ -15,6 +15,7 @@ Gem::Specification.new do |s|
15
15
  s.add_dependency 'activerecord', '~> 2.3.12'
16
16
  s.add_dependency 'activesupport', '~> 2.3.12'
17
17
  s.add_development_dependency 'rspec', '~> 1.3.1'
18
+ s.add_development_dependency 'timecop', '~> 0.5.9.1'
18
19
  s.add_development_dependency 'sqlite3'
19
20
  s.add_development_dependency 'appraisal', '0.4.1'
20
21
  s.add_development_dependency 'pry'
@@ -209,7 +209,7 @@ describe Searchlogic::NamedScopes::AssociationConditions do
209
209
  user.orders.count.should == 1
210
210
  user.orders.shipped_on_not_null.shipped_on_greater_than(2.days.ago).count.should == 1
211
211
  end
212
-
212
+
213
213
  it "should allow chained dynamic scopes without losing association scope conditions" do
214
214
  user = User.create
215
215
  order1 = Order.create :user => user, :shipped_on => Time.now, :total => 2
@@ -218,6 +218,26 @@ describe Searchlogic::NamedScopes::AssociationConditions do
218
218
  user.orders.id_equals(order1.id).total_equals(2).count.should == 1
219
219
  end
220
220
 
221
+ it "shouldn't cache the lambda of a named_scope for a chained association" do
222
+ user = User.create
223
+ Order.create :user => user, :shipped_on => Time.current
224
+
225
+ # create the named_scope and use it through a chained association
226
+ Order.named_scope :shipped, lambda { {:conditions => ["shipped_on <= ?", Time.current]} }
227
+ User.orders_shipped
228
+
229
+ # simulate a day passing after the chained scope is first used
230
+ Timecop.travel(Date.tomorrow)
231
+
232
+ # make a new object that is active on our simulated day
233
+ Order.create :user => user, :shipped_on => Time.current
234
+
235
+ # we have 2 orders and both were shipped on or before the current time,
236
+ # so both should be included in the scope
237
+ user.orders.count.should == 2
238
+ User.orders_shipped.count.should == 2
239
+ end
240
+
221
241
  it "should allow Marshal.dump on objects that only have polymorphic associations where a polymorphic association is loaded" do
222
242
  audit = Audit.create
223
243
  audit.auditable = User.create
@@ -1,6 +1,7 @@
1
1
  Bundler.setup
2
2
  require 'searchlogic'
3
3
  require "pry"
4
+ require "timecop"
4
5
 
5
6
  ENV['TZ'] = 'UTC'
6
7
  Time.zone = 'Eastern Time (US & Canada)'
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: searchlogic
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.5.15
4
+ version: 2.5.16
5
5
  platform: ruby
6
6
  authors:
7
7
  - Ben Johnson
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2013-11-19 00:00:00.000000000 Z
11
+ date: 2014-02-17 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: activerecord
@@ -52,6 +52,20 @@ dependencies:
52
52
  - - ~>
53
53
  - !ruby/object:Gem::Version
54
54
  version: 1.3.1
55
+ - !ruby/object:Gem::Dependency
56
+ name: timecop
57
+ requirement: !ruby/object:Gem::Requirement
58
+ requirements:
59
+ - - ~>
60
+ - !ruby/object:Gem::Version
61
+ version: 0.5.9.1
62
+ type: :development
63
+ prerelease: false
64
+ version_requirements: !ruby/object:Gem::Requirement
65
+ requirements:
66
+ - - ~>
67
+ - !ruby/object:Gem::Version
68
+ version: 0.5.9.1
55
69
  - !ruby/object:Gem::Dependency
56
70
  name: sqlite3
57
71
  requirement: !ruby/object:Gem::Requirement
@@ -146,7 +160,6 @@ files:
146
160
  - lib/searchlogic/search/unknown_condition_error.rb
147
161
  - lib/searchlogic/version.rb
148
162
  - rails/init.rb
149
- - searchlogic-2.5.13.gem
150
163
  - searchlogic.gemspec
151
164
  - spec/searchlogic/active_record/association_proxy_spec.rb
152
165
  - spec/searchlogic/active_record/consistency_spec.rb
Binary file