kasket 1.0.3.beta1 → 1.0.3.beta2

Sign up to get free protection for your applications and to get access to all the features.
data/README.rdoc CHANGED
@@ -1,4 +1,4 @@
1
- = Kasket
1
+ = Kasket {<img src="https://secure.travis-ci.org/staugaard/kasket.png" />}[http://travis-ci.org/staugaard/kasket]
2
2
  === Puts a cap on your queries
3
3
  A caching layer for ActiveRecord
4
4
 
data/lib/kasket.rb CHANGED
@@ -14,8 +14,8 @@ module Kasket
14
14
  class Version
15
15
  MAJOR = 1
16
16
  MINOR = 0
17
- PATCH = '3.beta1'
18
- STRING = "#{MAJOR}.#{MINOR}.#{PATCH}"
17
+ PATCH = 3
18
+ STRING = "#{MAJOR}.#{MINOR}.#{PATCH}.beta2"
19
19
  end
20
20
 
21
21
  module_function
@@ -37,7 +37,7 @@ module Kasket
37
37
  key = attribute_value_pairs.map do |attribute, value|
38
38
  column = columns_hash[attribute.to_s]
39
39
  value = nil if value.blank?
40
- attribute.to_s + '=' + connection.quote(column.type_cast(value), column)
40
+ attribute.to_s + '=' + connection.quote(column.type_cast(value), column).downcase
41
41
  end.join('/')
42
42
 
43
43
  if key.size > (250 - kasket_key_prefix.size) || key =~ /\s/
@@ -2,28 +2,34 @@ require File.expand_path("helper", File.dirname(__FILE__))
2
2
  require "digest/md5"
3
3
 
4
4
  class ConfigurationMixinTest < ActiveSupport::TestCase
5
-
5
+
6
6
  context "Generating cache keys" do
7
-
8
- should "not choke on empty numeric attributes" do
9
- expected_cache_key = "kasket-#{Kasket::Version::STRING}/posts/version=3558/blog_id=NULL"
7
+
8
+ should "not choke on empty numeric attributes" do
9
+ expected_cache_key = "kasket-#{Kasket::Version::STRING}/posts/version=3558/blog_id=null"
10
10
  query_attributes = [ [:blog_id, ''] ]
11
-
11
+
12
12
  assert_equal expected_cache_key, Post.kasket_key_for(query_attributes)
13
13
  end
14
14
 
15
15
  should "not generate keys longer that 255" do
16
16
  very_large_number = (1..999).to_a.join
17
17
  query_attributes = [ [:blog_id, very_large_number] ]
18
-
18
+
19
19
  assert(Post.kasket_key_for(query_attributes).size < 255)
20
20
  end
21
21
 
22
22
  should "not generate keys with spaces" do
23
23
  query_attributes = [ [:title, 'this key has speces'] ]
24
-
24
+
25
25
  assert(!(Post.kasket_key_for(query_attributes) =~ /\s/))
26
26
  end
27
+
28
+ should "downcase string attributes" do
29
+ query_attributes = [ [:title, 'ThIs'] ]
30
+ expected_cache_key = "kasket-#{Kasket::Version::STRING}/posts/version=3558/title='this'"
31
+
32
+ assert_equal expected_cache_key, Post.kasket_key_for(query_attributes)
33
+ end
27
34
  end
28
-
29
- end
35
+ end
metadata CHANGED
@@ -1,15 +1,15 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: kasket
3
3
  version: !ruby/object:Gem::Version
4
- hash: 62196377
4
+ hash: -3005910022
5
5
  prerelease: 6
6
6
  segments:
7
7
  - 1
8
8
  - 0
9
9
  - 3
10
10
  - beta
11
- - 1
12
- version: 1.0.3.beta1
11
+ - 2
12
+ version: 1.0.3.beta2
13
13
  platform: ruby
14
14
  authors:
15
15
  - Mick Staugaard
@@ -18,8 +18,7 @@ autorequire:
18
18
  bindir: bin
19
19
  cert_chain: []
20
20
 
21
- date: 2011-07-14 00:00:00 -07:00
22
- default_executable:
21
+ date: 2012-03-13 00:00:00 Z
23
22
  dependencies:
24
23
  - !ruby/object:Gem::Dependency
25
24
  name: activerecord
@@ -158,7 +157,6 @@ files:
158
157
  - test/read_mixin_test.rb
159
158
  - test/test_models.rb
160
159
  - test/transaction_test.rb
161
- has_rdoc: true
162
160
  homepage: http://github.com/staugaard/kasket
163
161
  licenses: []
164
162
 
@@ -190,7 +188,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
190
188
  requirements: []
191
189
 
192
190
  rubyforge_project:
193
- rubygems_version: 1.6.2
191
+ rubygems_version: 1.8.17
194
192
  signing_key:
195
193
  specification_version: 3
196
194
  summary: A write back caching layer on active record