cancan 1.6.0 → 1.6.10

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/spec/spec_helper.rb CHANGED
@@ -9,11 +9,27 @@ require 'matchers'
9
9
  require 'cancan/matchers'
10
10
 
11
11
  RSpec.configure do |config|
12
+ config.treat_symbols_as_metadata_keys_with_true_values = true
13
+ config.filter_run :focus => true
14
+ config.run_all_when_everything_filtered = true
12
15
  config.mock_with :rr
13
16
  config.before(:each) do
14
17
  Project.delete_all
15
18
  Category.delete_all
16
19
  end
20
+ config.extend WithModel if ENV["MODEL_ADAPTER"].nil? || ENV["MODEL_ADAPTER"] == "active_record"
21
+ end
22
+
23
+ # Working around CVE-2012-5664 requires us to convert all ID params
24
+ # to strings. Let's switch to using string IDs in tests, otherwise
25
+ # SuperModel and/or RR will fail (as strings are not fixnums).
26
+
27
+ module SuperModel
28
+ class Base
29
+ def generate_id
30
+ object_id.to_s
31
+ end
32
+ end
17
33
  end
18
34
 
19
35
  class Ability
@@ -27,6 +43,30 @@ class Category < SuperModel::Base
27
43
  has_many :projects
28
44
  end
29
45
 
46
+ module Sub
47
+ class Project < SuperModel::Base
48
+ belongs_to :category
49
+ attr_accessor :category # why doesn't SuperModel do this automatically?
50
+
51
+ def self.respond_to?(method, include_private = false)
52
+ if method.to_s == "find_by_name!" # hack to simulate ActiveRecord
53
+ true
54
+ else
55
+ super
56
+ end
57
+ end
58
+ end
59
+ end
60
+
30
61
  class Project < SuperModel::Base
31
62
  belongs_to :category
63
+ attr_accessor :category # why doesn't SuperModel do this automatically?
64
+
65
+ def self.respond_to?(method, include_private = false)
66
+ if method.to_s == "find_by_name!" # hack to simulate ActiveRecord
67
+ true
68
+ else
69
+ super
70
+ end
71
+ end
32
72
  end
metadata CHANGED
@@ -1,13 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: cancan
3
3
  version: !ruby/object:Gem::Version
4
- hash: 15
4
+ hash: 27
5
5
  prerelease:
6
6
  segments:
7
7
  - 1
8
8
  - 6
9
- - 0
10
- version: 1.6.0
9
+ - 10
10
+ version: 1.6.10
11
11
  platform: ruby
12
12
  authors:
13
13
  - Ryan Bates
@@ -15,7 +15,7 @@ autorequire:
15
15
  bindir: bin
16
16
  cert_chain: []
17
17
 
18
- date: 2011-03-10 00:00:00 -08:00
18
+ date: 2013-05-07 00:00:00 -07:00
19
19
  default_executable:
20
20
  dependencies:
21
21
  - !ruby/object:Gem::Dependency
@@ -26,12 +26,12 @@ dependencies:
26
26
  requirements:
27
27
  - - ~>
28
28
  - !ruby/object:Gem::Version
29
- hash: 11
29
+ hash: 23
30
30
  segments:
31
31
  - 2
32
- - 1
32
+ - 6
33
33
  - 0
34
- version: 2.1.0
34
+ version: 2.6.0
35
35
  type: :development
36
36
  version_requirements: *id001
37
37
  - !ruby/object:Gem::Dependency
@@ -42,12 +42,12 @@ dependencies:
42
42
  requirements:
43
43
  - - ~>
44
44
  - !ruby/object:Gem::Version
45
- hash: 7
45
+ hash: 21
46
46
  segments:
47
47
  - 3
48
48
  - 0
49
- - 0
50
- version: 3.0.0
49
+ - 9
50
+ version: 3.0.9
51
51
  type: :development
52
52
  version_requirements: *id002
53
53
  - !ruby/object:Gem::Dependency
@@ -124,6 +124,7 @@ files:
124
124
  - spec/spec.opts
125
125
  - spec/spec_helper.rb
126
126
  - CHANGELOG.rdoc
127
+ - CONTRIBUTING.md
127
128
  - Gemfile
128
129
  - LICENSE
129
130
  - Rakefile
@@ -161,7 +162,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
161
162
  requirements: []
162
163
 
163
164
  rubyforge_project: cancan
164
- rubygems_version: 1.4.2
165
+ rubygems_version: 1.6.2
165
166
  signing_key:
166
167
  specification_version: 3
167
168
  summary: Simple authorization solution for Rails.