strict-forgery-protection 0.0.3 → 0.0.4

Sign up to get free protection for your applications and to get access to all the features.
@@ -3,13 +3,17 @@ require 'active_support'
3
3
  module ForgeryProtection
4
4
  class SqlEvent < ActiveSupport::Notifications::Event
5
5
  def read?
6
- result.respond_to?(:each)
6
+ cache? || result.respond_to?(:each)
7
7
  end
8
8
 
9
9
  def write?
10
10
  !read?
11
11
  end
12
12
 
13
+ def cache?
14
+ payload[:name] == 'CACHE'
15
+ end
16
+
13
17
  private
14
18
 
15
19
  def result
@@ -1,3 +1,3 @@
1
1
  module ForgeryProtection
2
- VERSION = '0.0.3'.freeze
2
+ VERSION = '0.0.4'.freeze
3
3
  end
@@ -34,6 +34,12 @@ class DbEventsTest < ActiveSupport::TestCase
34
34
  end
35
35
  end
36
36
 
37
+ def test_cache
38
+ assert_reads do
39
+ Post.connection.cache { 2.times { Post.all } }
40
+ end
41
+ end
42
+
37
43
  private
38
44
 
39
45
  def assert_reads
data/test/test.sqlite3 CHANGED
Binary file
metadata CHANGED
@@ -2,7 +2,7 @@
2
2
  name: strict-forgery-protection
3
3
  version: !ruby/object:Gem::Version
4
4
  prerelease:
5
- version: 0.0.3
5
+ version: 0.0.4
6
6
  platform: ruby
7
7
  authors:
8
8
  - Dmitry Ratnikov
@@ -10,7 +10,7 @@ autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
12
 
13
- date: 2012-02-13 00:00:00 Z
13
+ date: 2012-04-19 00:00:00 Z
14
14
  dependencies:
15
15
  - !ruby/object:Gem::Dependency
16
16
  name: rails
@@ -41,8 +41,8 @@ files:
41
41
  - lib/forgery_protection/version.rb
42
42
  - test/controller_test.rb
43
43
  - test/db_events_test.rb
44
- - test/test_helper.rb
45
44
  - test/test.sqlite3
45
+ - test/test_helper.rb
46
46
  homepage: http://github.com/ratnikov/strict-forgery-protection
47
47
  licenses: []
48
48
 
@@ -66,12 +66,12 @@ required_rubygems_version: !ruby/object:Gem::Requirement
66
66
  requirements: []
67
67
 
68
68
  rubyforge_project:
69
- rubygems_version: 1.8.9
69
+ rubygems_version: 1.8.15
70
70
  signing_key:
71
71
  specification_version: 3
72
72
  summary: Extends Rails to be strict CSRF token protection
73
73
  test_files:
74
74
  - test/controller_test.rb
75
75
  - test/db_events_test.rb
76
- - test/test_helper.rb
77
76
  - test/test.sqlite3
77
+ - test/test_helper.rb