arid_cache 1.4.2 → 1.4.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
data/Gemfile.rails2.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: ./
3
3
  specs:
4
- arid_cache (1.4.0)
4
+ arid_cache (1.4.3)
5
5
  will_paginate
6
6
 
7
7
  GEM
data/Gemfile.rails3.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: ./
3
3
  specs:
4
- arid_cache (1.3.6)
4
+ arid_cache (1.4.3)
5
5
  will_paginate
6
6
 
7
7
  GEM
data/VERSION CHANGED
@@ -1 +1 @@
1
- 1.4.2
1
+ 1.4.3
data/arid_cache.gemspec CHANGED
@@ -5,7 +5,7 @@
5
5
 
6
6
  Gem::Specification.new do |s|
7
7
  s.name = %q{arid_cache}
8
- s.version = "1.4.2"
8
+ s.version = "1.4.3"
9
9
 
10
10
  s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
11
11
  s.authors = ["Karl Varga"]
@@ -39,7 +39,9 @@ module AridCache
39
39
  # Find and return records of the given +klass+ which have id in +ids+.
40
40
  # +find_opts+ is a hash of options which are passed to find.
41
41
  # If no order option is given, the ordering of the ids is preserved.
42
+ # No query is performed if +ids+ is empty.
42
43
  def find_all_by_id(klass, ids, find_opts={})
44
+ return ids if ids.empty?
43
45
  find_opts = Options.new(find_opts.merge(:result_klass => klass)).opts_for_find(ids)
44
46
  if AridCache.framework.active_record?(3)
45
47
  option_map = {
@@ -7,8 +7,6 @@ describe AridCache::CacheProxy::ResultProcessor do
7
7
  end
8
8
 
9
9
  before :each do
10
- AridCache.store.delete! # so no options get stored and interfere with other tests
11
- Rails.cache.clear
12
10
  AridCache.raw_with_options = true
13
11
  end
14
12
 
@@ -34,5 +34,11 @@ describe AridCache::CacheProxy::Utilities do
34
34
  @result.size.should == 1
35
35
  @result.first.should == @user.companies.reverse[1]
36
36
  end
37
+
38
+ it "should not fail when ids is empty" do
39
+ lambda {
40
+ AridCache::CacheProxy::Utilities.find_all_by_id(Company, []).inspect
41
+ }.should query(0)
42
+ end
37
43
  end
38
44
  end
data/spec/spec_helper.rb CHANGED
@@ -32,6 +32,8 @@ RSpec.configure do |config|
32
32
  end
33
33
 
34
34
  config.before(:each) do
35
+ AridCache.store.delete! # so no options get stored and interfere with other tests
36
+ Rails.cache.respond_to?(:clear) ? Rails.cache.clear : Rails.cache.delete_matched(/.*/)
35
37
  Sham.reset(:before_each)
36
38
  full_example_description = "#{self.class.description} #{@method_name}"
37
39
  RAILS_DEFAULT_LOGGER.info("\n\n#{full_example_description}\n#{'-' * (full_example_description.length)}")
metadata CHANGED
@@ -1,13 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: arid_cache
3
3
  version: !ruby/object:Gem::Version
4
- hash: 3
4
+ hash: 1
5
5
  prerelease:
6
6
  segments:
7
7
  - 1
8
8
  - 4
9
- - 2
10
- version: 1.4.2
9
+ - 3
10
+ version: 1.4.3
11
11
  platform: ruby
12
12
  authors:
13
13
  - Karl Varga