kmayer-highrise 0.9.0 → 0.9.1

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/VERSION.yml CHANGED
@@ -1,4 +1,4 @@
1
1
  ---
2
- :patch: 0
2
+ :patch: 1
3
3
  :major: 0
4
4
  :minor: 9
data/lib/cachable.rb CHANGED
@@ -23,9 +23,9 @@ require 'digest/sha1'
23
23
  # Configuration examples ('off' is the default):
24
24
  #
25
25
  # CachedResource.connection.cache_store = :memory_store
26
- # CachedResource.connection.cache_store = :file_store, "/path/to/cache/directory"
27
- # CachedResource.connection.cache_store = :drb_store, "druby://localhost:9192"
28
- # CachedResource.connection.cache_store = :mem_cache_store, "localhost"
26
+ # CachedResource.connection.cache_store = ActiveSupport::Cache.lookup_store :file_store, "/path/to/cache/directory"
27
+ # CachedResource.connection.cache_store = ActiveSupport::Cache.lookup_store :drb_store, "druby://localhost:9192"
28
+ # CachedResource.connection.cache_store = ActiveSupport::Cache.lookup_store :mem_cache_store, "localhost"
29
29
  # CachedResource.connection.cache_store = MyOwnStore.new("parameter")
30
30
  #
31
31
  # Note: To ensure that caching is turned off, set CachedResource.connection.cache_store = :none
@@ -44,15 +44,15 @@ module Cachable
44
44
  # Wrapper for lookup_store, with a couple of special options:
45
45
  # Passing +:none+ will turn off caching
46
46
  # Passing +:rails+ will use the default Rails/AS cache (whatever it happens to be)
47
- # Passing no args or nil will return the default cache from AS
48
- def cache_store=(*store_option)
47
+ # Passing +nil+ will use the default cache from AS
48
+ def cache_store=(store_option)
49
49
  @cache_store = case store_option
50
- when [:none]
50
+ when :none
51
51
  nil
52
- when [:rails]
52
+ when :rails
53
53
  Rails.cache rescue ActiveSupport::Cache.lookup_store
54
54
  else
55
- ActiveSupport::Cache.lookup_store(*store_option)
55
+ ActiveSupport::Cache.lookup_store(store_option)
56
56
  end
57
57
  end
58
58
 
@@ -30,13 +30,13 @@ describe Highrise::Base do
30
30
  end
31
31
 
32
32
  after(:all) do
33
- @connection.cache_store = nil
33
+ @connection.cache_store = :none
34
34
  end
35
35
 
36
36
  before(:each) do
37
37
  @thing = Highrise::Base.new
38
38
  @key = :key
39
- @connection.should_receive(:cache_key).and_return(@key)
39
+ @connection.stub!(:cache_key).and_return(@key)
40
40
  end
41
41
 
42
42
  context "when a cached response is available" do
@@ -50,7 +50,7 @@ describe Highrise::Base do
50
50
  end
51
51
 
52
52
  it "should read from the cache" do
53
- Highrise::Base.find(2).should == @thing
53
+ Highrise::Base.find(1).should == @thing
54
54
  end
55
55
  end
56
56
 
@@ -61,12 +61,12 @@ describe Highrise::Base do
61
61
 
62
62
  it "SHOULD perform an ARes request" do
63
63
  @connection.should_receive(:get_without_cache).and_return(@thing.attributes)
64
- Highrise::Base.find(3)
64
+ Highrise::Base.find(1)
65
65
  end
66
66
 
67
67
  it "should cache the response using the caching key" do
68
68
  @connection.should_receive(:get_without_cache).and_return(@thing.attributes)
69
- Highrise::Base.find(4)
69
+ Highrise::Base.find(1)
70
70
  @connection.cache_store.read(@key).should == @thing.attributes
71
71
  end
72
72
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: kmayer-highrise
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.9.0
4
+ version: 0.9.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - "Marcos Tapaj\xC3\xB3s"