langalex-totally-restful-authorization 0.0.3 → 0.0.4

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 CHANGED
@@ -1 +1 @@
1
- 0.0.3
1
+ 0.0.4
@@ -34,7 +34,7 @@ module TotallyRestfulAuthorization
34
34
  end
35
35
 
36
36
  def object_class
37
- Class.const_get self.class.name[0..-12]
37
+ self.class.name[0..-11].singularize.split('::').last.constantize
38
38
  end
39
39
 
40
40
  def permission_granted?(_object)
@@ -1,6 +1,4 @@
1
1
  require 'rubygems'
2
- gem 'mocha'
3
- gem 'actionpack'
4
2
  require 'actionpack'
5
3
  require 'action_controller'
6
4
  require 'action_controller/test_process'
@@ -5,6 +5,23 @@ ActionController::Routing::Routes.draw do |map|
5
5
  end
6
6
 
7
7
  class Model; end
8
+ class Property; end
9
+
10
+ class PropertiesController < ActionController::Base
11
+ attr_accessor :current_user
12
+ check_authorization
13
+
14
+ def show; end
15
+ end
16
+
17
+ module Admin
18
+ class PropertiesController < ActionController::Base
19
+ attr_accessor :current_user
20
+ check_authorization
21
+
22
+ def show; end
23
+ end
24
+ end
8
25
 
9
26
  class ModelsController < ActionController::Base
10
27
  attr_accessor :current_user
@@ -165,4 +182,16 @@ class PermissionCheckTest < ActionController::TestCase
165
182
  @model.expects(:destroy)
166
183
  post :destroy, :id => 1
167
184
  end
185
+
186
+ def test_works_with_namespaced_controllers
187
+ @controller = Admin::PropertiesController.new
188
+ Property.expects(:find)
189
+ get :show
190
+ end
191
+
192
+ def test_works_with_irregular_plurals
193
+ @controller = PropertiesController.new
194
+ Property.expects(:find)
195
+ get :show
196
+ end
168
197
  end
@@ -2,11 +2,11 @@
2
2
 
3
3
  Gem::Specification.new do |s|
4
4
  s.name = %q{totally-restful-authorization}
5
- s.version = "0.0.3"
5
+ s.version = "0.0.4"
6
6
 
7
7
  s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
8
8
  s.authors = ["Alexander Lang"]
9
- s.date = %q{2009-06-17}
9
+ s.date = %q{2009-09-05}
10
10
  s.email = %q{alex@upstream-berlin.com}
11
11
  s.extra_rdoc_files = [
12
12
  "LICENSE",
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: langalex-totally-restful-authorization
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.3
4
+ version: 0.0.4
5
5
  platform: ruby
6
6
  authors:
7
7
  - Alexander Lang
@@ -9,7 +9,7 @@ autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
11
 
12
- date: 2009-06-17 00:00:00 -07:00
12
+ date: 2009-09-05 00:00:00 -07:00
13
13
  default_executable:
14
14
  dependencies: []
15
15
 
@@ -37,6 +37,7 @@ files:
37
37
  - totally-restful-authorization.gemspec
38
38
  has_rdoc: true
39
39
  homepage: http://github.com/langalex/totally_restful_authorization
40
+ licenses:
40
41
  post_install_message:
41
42
  rdoc_options:
42
43
  - --charset=UTF-8
@@ -57,7 +58,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
57
58
  requirements: []
58
59
 
59
60
  rubyforge_project:
60
- rubygems_version: 1.2.0
61
+ rubygems_version: 1.3.5
61
62
  signing_key:
62
63
  specification_version: 2
63
64
  summary: This plugin adds an authorization layer to your rails app that is totally transparent to your restful controllers and a DSL for declaring permissions on your models.