arid_cache 1.4.2 → 1.4.3
Sign up to get free protection for your applications and to get access to all the features.
- data/Gemfile.rails2.lock +1 -1
- data/Gemfile.rails3.lock +1 -1
- data/VERSION +1 -1
- data/arid_cache.gemspec +1 -1
- data/lib/arid_cache/cache_proxy/utilities.rb +2 -0
- data/spec/arid_cache/cache_proxy/result_processor_spec.rb +0 -2
- data/spec/arid_cache/cache_proxy/utilities_spec.rb +6 -0
- data/spec/spec_helper.rb +2 -0
- metadata +3 -3
data/Gemfile.rails2.lock
CHANGED
data/Gemfile.rails3.lock
CHANGED
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
1.4.
|
1
|
+
1.4.3
|
data/arid_cache.gemspec
CHANGED
@@ -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 = {
|
@@ -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