cancan-permits 0.2.2 → 0.2.3
Sign up to get free protection for your applications and to get access to all the features.
- data/README.markdown +1 -1
- data/VERSION +1 -1
- data/cancan-permits.gemspec +32 -14
- data/development.sqlite3 +0 -0
- data/lib/cancan-permits/permit/base_permit.rb +2 -3
- data/spec/active_record/db/database.yml +4 -0
- data/spec/active_record/migrations/001_create_user.rb +13 -0
- data/spec/active_record/migrations/002_create_comment.rb +13 -0
- data/spec/active_record/migrations/003_create_post.rb +13 -0
- data/spec/active_record/migrations/004_create_article.rb +13 -0
- data/spec/active_record/models/all_models.rb +11 -0
- data/spec/active_record/owner_permits_spec.rb +73 -0
- data/spec/active_record/permits_spec.rb +36 -0
- data/spec/active_record/spec_helper.rb +94 -0
- data/spec/data_mapper/owner_permits_spec.rb +2 -2
- data/spec/data_mapper/permits_spec.rb +1 -1
- data/spec/data_mapper/spec_helper.rb +1 -1
- data/spec/{cancan-permits → generic}/fixtures/permits/admin_permit.rb +0 -0
- data/spec/{cancan-permits → generic}/fixtures/permits/editor_permit.rb +0 -0
- data/spec/{cancan-permits → generic}/fixtures/permits/guest_permit.rb +0 -0
- data/spec/{cancan-permits → generic}/permits/fixtures/models.rb +0 -0
- data/spec/{cancan-permits → generic}/permits/owner_permits_spec.rb +0 -0
- data/spec/{cancan-permits → generic}/permits/permits_spec.rb +0 -0
- data/spec/mongo_mapper/owner_permits_spec.rb +2 -2
- data/spec/mongo_mapper/permits_spec.rb +1 -1
- data/spec/mongo_mapper/spec_helper.rb +1 -1
- data/spec/mongoid/owner_permits_spec.rb +2 -2
- data/spec/mongoid/permits_spec.rb +2 -2
- data/spec/mongoid/spec_helper.rb +1 -1
- data/spec/spec_helper.rb +2 -2
- metadata +33 -15
data/README.markdown
CHANGED
@@ -5,7 +5,7 @@ Role specific Permits for use with [CanCan](http://github.com/ryanb/cancan) perm
|
|
5
5
|
## Update Oct 13
|
6
6
|
|
7
7
|
Now updated to support multiple ownership startegies so that alternative ORMs can be supported.
|
8
|
-
This gem now includes specs that demonstrate how to configure it for use with
|
8
|
+
This gem now includes specs that demonstrate how to configure it for use with Active Record, Data Mapper, Mongoid, Mongo Mapper
|
9
9
|
Special thanks to Sam (yoda) for the initial inspiration and work to ensure support for Mongoid :)
|
10
10
|
|
11
11
|
The generator has also been updated slightly to support this new strategy option as of version 0.2.1.
|
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
0.2.
|
1
|
+
0.2.3
|
data/cancan-permits.gemspec
CHANGED
@@ -5,11 +5,11 @@
|
|
5
5
|
|
6
6
|
Gem::Specification.new do |s|
|
7
7
|
s.name = %q{cancan-permits}
|
8
|
-
s.version = "0.2.
|
8
|
+
s.version = "0.2.3"
|
9
9
|
|
10
10
|
s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
|
11
11
|
s.authors = ["Kristian Mandrup"]
|
12
|
-
s.date = %q{2010-10-
|
12
|
+
s.date = %q{2010-10-14}
|
13
13
|
s.description = %q{Role specific Permits for use with CanCan permission system}
|
14
14
|
s.email = %q{kmandrup@gmail.com}
|
15
15
|
s.extra_rdoc_files = [
|
@@ -25,6 +25,7 @@ Gem::Specification.new do |s|
|
|
25
25
|
"Rakefile",
|
26
26
|
"VERSION",
|
27
27
|
"cancan-permits.gemspec",
|
28
|
+
"development.sqlite3",
|
28
29
|
"lib/cancan-permits.rb",
|
29
30
|
"lib/cancan-permits/main.rb",
|
30
31
|
"lib/cancan-permits/namespaces.rb",
|
@@ -41,17 +42,26 @@ Gem::Specification.new do |s|
|
|
41
42
|
"lib/generators/permits/permits_generator.rb",
|
42
43
|
"lib/generators/permits/templates/licenses.rb",
|
43
44
|
"lib/generators/permits/templates/permit.rb",
|
44
|
-
"spec/
|
45
|
-
"spec/
|
46
|
-
"spec/
|
47
|
-
"spec/
|
48
|
-
"spec/
|
49
|
-
"spec/
|
45
|
+
"spec/active_record/db/database.yml",
|
46
|
+
"spec/active_record/migrations/001_create_user.rb",
|
47
|
+
"spec/active_record/migrations/002_create_comment.rb",
|
48
|
+
"spec/active_record/migrations/003_create_post.rb",
|
49
|
+
"spec/active_record/migrations/004_create_article.rb",
|
50
|
+
"spec/active_record/models/all_models.rb",
|
51
|
+
"spec/active_record/owner_permits_spec.rb",
|
52
|
+
"spec/active_record/permits_spec.rb",
|
53
|
+
"spec/active_record/spec_helper.rb",
|
50
54
|
"spec/data_mapper/models/all_models.rb",
|
51
55
|
"spec/data_mapper/owner_permits_spec.rb",
|
52
56
|
"spec/data_mapper/permits_spec.rb",
|
53
57
|
"spec/data_mapper/spec_helper.rb",
|
54
58
|
"spec/generators/permit_generator_spec.rb",
|
59
|
+
"spec/generic/fixtures/permits/admin_permit.rb",
|
60
|
+
"spec/generic/fixtures/permits/editor_permit.rb",
|
61
|
+
"spec/generic/fixtures/permits/guest_permit.rb",
|
62
|
+
"spec/generic/permits/fixtures/models.rb",
|
63
|
+
"spec/generic/permits/owner_permits_spec.rb",
|
64
|
+
"spec/generic/permits/permits_spec.rb",
|
55
65
|
"spec/mongo_mapper/models/all_models.rb",
|
56
66
|
"spec/mongo_mapper/owner_permits_spec.rb",
|
57
67
|
"spec/mongo_mapper/permits_spec.rb",
|
@@ -68,17 +78,25 @@ Gem::Specification.new do |s|
|
|
68
78
|
s.rubygems_version = %q{1.3.7}
|
69
79
|
s.summary = %q{Permits for use with CanCan}
|
70
80
|
s.test_files = [
|
71
|
-
"spec/
|
72
|
-
"spec/
|
73
|
-
"spec/
|
74
|
-
"spec/
|
75
|
-
"spec/
|
76
|
-
"spec/
|
81
|
+
"spec/active_record/migrations/001_create_user.rb",
|
82
|
+
"spec/active_record/migrations/002_create_comment.rb",
|
83
|
+
"spec/active_record/migrations/003_create_post.rb",
|
84
|
+
"spec/active_record/migrations/004_create_article.rb",
|
85
|
+
"spec/active_record/models/all_models.rb",
|
86
|
+
"spec/active_record/owner_permits_spec.rb",
|
87
|
+
"spec/active_record/permits_spec.rb",
|
88
|
+
"spec/active_record/spec_helper.rb",
|
77
89
|
"spec/data_mapper/models/all_models.rb",
|
78
90
|
"spec/data_mapper/owner_permits_spec.rb",
|
79
91
|
"spec/data_mapper/permits_spec.rb",
|
80
92
|
"spec/data_mapper/spec_helper.rb",
|
81
93
|
"spec/generators/permit_generator_spec.rb",
|
94
|
+
"spec/generic/fixtures/permits/admin_permit.rb",
|
95
|
+
"spec/generic/fixtures/permits/editor_permit.rb",
|
96
|
+
"spec/generic/fixtures/permits/guest_permit.rb",
|
97
|
+
"spec/generic/permits/fixtures/models.rb",
|
98
|
+
"spec/generic/permits/owner_permits_spec.rb",
|
99
|
+
"spec/generic/permits/permits_spec.rb",
|
82
100
|
"spec/mongo_mapper/models/all_models.rb",
|
83
101
|
"spec/mongo_mapper/owner_permits_spec.rb",
|
84
102
|
"spec/mongo_mapper/permits_spec.rb",
|
data/development.sqlite3
ADDED
File without changes
|
@@ -43,10 +43,9 @@ module Permit
|
|
43
43
|
# puts "Using strategy: #{strategy_used}"
|
44
44
|
begin
|
45
45
|
case strategy_used
|
46
|
-
when :
|
46
|
+
when :string
|
47
47
|
can :manage, clazz, ownership_relation => user_id.to_s
|
48
|
-
when :default
|
49
|
-
# puts "Basic CanCan ownership"
|
48
|
+
when :default
|
50
49
|
can :manage, clazz, ownership_relation => user_id
|
51
50
|
else
|
52
51
|
raise "Trying to use unknown ownership strategy: #{strategy}"
|
@@ -0,0 +1,73 @@
|
|
1
|
+
require 'active_record/spec_helper'
|
2
|
+
|
3
|
+
describe Permits::Ability do
|
4
|
+
context "Editor user" do
|
5
|
+
context "using default :user_id relation - foreign key to User.id" do
|
6
|
+
before :each do
|
7
|
+
@editor = User.create(:name => "Kristian", :role => "editor")
|
8
|
+
@other_guy = User.create(:name => "Random dude", :role => "admin")
|
9
|
+
|
10
|
+
@ability = Permits::Ability.new(@editor)
|
11
|
+
|
12
|
+
@own_comment = Comment.create(:user_id => @editor.id)
|
13
|
+
@other_comment = Comment.create(:user_id => @other_guy.id)
|
14
|
+
# @post = Post.create(:writer => @editor.id)
|
15
|
+
# @article = Article.create(:author => @editor.id)
|
16
|
+
end
|
17
|
+
|
18
|
+
it "should be able to :read Comment he owns" do
|
19
|
+
@ability.should be_able_to(:read, Comment)
|
20
|
+
@ability.should be_able_to(:read, @own_comment)
|
21
|
+
end
|
22
|
+
|
23
|
+
it "should be able to :update Comment he owns" do
|
24
|
+
@ability.should be_able_to(:update, @own_comment)
|
25
|
+
end
|
26
|
+
|
27
|
+
it "should NOT be able to :update Comment he does NOT own" do
|
28
|
+
@ability.should_not be_able_to(:update, @other_comment)
|
29
|
+
end
|
30
|
+
|
31
|
+
it "should be able to :delete Comment he owns" do
|
32
|
+
@ability.should be_able_to(:delete, @own_comment)
|
33
|
+
end
|
34
|
+
|
35
|
+
it "should NOT be able to :update Comment he does NOT own" do
|
36
|
+
@ability.should_not be_able_to(:delete, @other_comment)
|
37
|
+
end
|
38
|
+
end
|
39
|
+
|
40
|
+
context "using custom :writer relation - foreign key to User.id" do
|
41
|
+
before :each do
|
42
|
+
@editor = User.create(:name => "Kristian", :role => "editor")
|
43
|
+
@other_guy = User.create(:name => "Random dude", :role => "admin")
|
44
|
+
|
45
|
+
@ability = Permits::Ability.new(@editor)
|
46
|
+
|
47
|
+
@own_post = Post.create(:writer => @editor.id)
|
48
|
+
@other_post = Post.create(:writer => @other_guy.id)
|
49
|
+
end
|
50
|
+
|
51
|
+
it "should be able to :read Post he owns" do
|
52
|
+
@ability.should be_able_to(:read, Post)
|
53
|
+
@ability.should be_able_to(:read, @own_post)
|
54
|
+
end
|
55
|
+
|
56
|
+
it "should be able to :update Post he owns" do
|
57
|
+
@ability.should be_able_to(:update, @own_post)
|
58
|
+
end
|
59
|
+
|
60
|
+
it "should NOT be able to :update Post he does NOT own" do
|
61
|
+
@ability.should_not be_able_to(:update, @other_post)
|
62
|
+
end
|
63
|
+
|
64
|
+
it "should be able to :delete Post he owns" do
|
65
|
+
@ability.should be_able_to(:delete, @own_post)
|
66
|
+
end
|
67
|
+
|
68
|
+
it "should NOT be able to :update Post he does NOT own" do
|
69
|
+
@ability.should_not be_able_to(:delete, @other_post)
|
70
|
+
end
|
71
|
+
end
|
72
|
+
end
|
73
|
+
end
|
@@ -0,0 +1,36 @@
|
|
1
|
+
require 'active_record/spec_helper'
|
2
|
+
|
3
|
+
describe Permits::Ability do
|
4
|
+
context "Guest user" do
|
5
|
+
before :each do
|
6
|
+
@guest = User.create(:name => "Kristian", :role => "guest")
|
7
|
+
|
8
|
+
@ability = Permits::Ability.new(@guest)
|
9
|
+
|
10
|
+
@comment = Comment.create(:user_id => @guest.id)
|
11
|
+
|
12
|
+
@post = Post.create(:writer => @guest.id)
|
13
|
+
|
14
|
+
@article = Article.create(:author => @guest.id)
|
15
|
+
end
|
16
|
+
|
17
|
+
it "should be able to :read Comment and Post but NOT Article" do
|
18
|
+
@ability.can?(:read, Comment).should be_true
|
19
|
+
@ability.can?(:read, @comment).should be_true
|
20
|
+
|
21
|
+
@ability.can?(:read, Post).should be_true
|
22
|
+
@ability.can?(:read, @post).should be_true
|
23
|
+
|
24
|
+
@ability.can?(:read, Article).should be_false
|
25
|
+
@ability.can?(:read, @article).should be_false
|
26
|
+
end
|
27
|
+
|
28
|
+
it "should be not able to :update only Comment" do
|
29
|
+
@ability.can?(:update, Comment).should be_true
|
30
|
+
@ability.can?(:update, @comment).should be_true
|
31
|
+
|
32
|
+
@ability.can?(:update, Post).should be_false
|
33
|
+
@ability.can?(:update, @post).should be_false
|
34
|
+
end
|
35
|
+
end
|
36
|
+
end
|
@@ -0,0 +1,94 @@
|
|
1
|
+
require 'rspec/core'
|
2
|
+
|
3
|
+
require 'rails'
|
4
|
+
require 'active_record'
|
5
|
+
require 'arel'
|
6
|
+
require 'meta_where'
|
7
|
+
require 'yaml'
|
8
|
+
require 'logger'
|
9
|
+
require 'database_cleaner'
|
10
|
+
|
11
|
+
require 'cancan/matchers'
|
12
|
+
require 'cancan-permits'
|
13
|
+
require 'cancan-permits/rspec'
|
14
|
+
|
15
|
+
module Rails
|
16
|
+
def self.config_root_dir
|
17
|
+
File.dirname(__FILE__)
|
18
|
+
end
|
19
|
+
end
|
20
|
+
|
21
|
+
path = File.dirname(__FILE__) + '/db/database.yml'
|
22
|
+
dbfile = File.open(path)
|
23
|
+
dbconfig = YAML::load(dbfile)
|
24
|
+
ActiveRecord::Base.establish_connection(dbconfig)
|
25
|
+
ActiveRecord::Base.logger = Logger.new(STDERR)
|
26
|
+
|
27
|
+
DatabaseCleaner.strategy = :truncation
|
28
|
+
|
29
|
+
# $ rake VERSION=0
|
30
|
+
|
31
|
+
def migration_folder(name)
|
32
|
+
path = File.dirname(__FILE__) + "/migrations"
|
33
|
+
name ? File.join(path name) : path
|
34
|
+
end
|
35
|
+
|
36
|
+
ORM_NAME = 'Active Record'
|
37
|
+
|
38
|
+
def migrate(name = nil)
|
39
|
+
mig_folder = migration_folder(name)
|
40
|
+
puts "Migrating folder: #{mig_folder}"
|
41
|
+
ActiveRecord::Migrator.migrate mig_folder
|
42
|
+
end
|
43
|
+
|
44
|
+
RSpec.configure do |config|
|
45
|
+
config.mock_with :mocha
|
46
|
+
|
47
|
+
config.before(:suite) do
|
48
|
+
DatabaseCleaner.strategy = :transaction
|
49
|
+
DatabaseCleaner.clean_with(:truncation)
|
50
|
+
# DatabaseCleaner.clean
|
51
|
+
end
|
52
|
+
|
53
|
+
config.before(:each) do
|
54
|
+
DatabaseCleaner.start
|
55
|
+
migrate
|
56
|
+
end
|
57
|
+
|
58
|
+
config.after(:each) do
|
59
|
+
DatabaseCleaner.clean
|
60
|
+
end
|
61
|
+
end
|
62
|
+
|
63
|
+
require_all File.dirname(__FILE__) + '/../generic/fixtures/permits'
|
64
|
+
require_all File.dirname(__FILE__) + '/models/all_models'
|
65
|
+
|
66
|
+
module Permits::Roles
|
67
|
+
def self.available
|
68
|
+
User.roles
|
69
|
+
end
|
70
|
+
end
|
71
|
+
|
72
|
+
class User < ActiveRecord::Base
|
73
|
+
has_many :articles
|
74
|
+
has_many :comments
|
75
|
+
has_many :posts
|
76
|
+
|
77
|
+
def self.roles
|
78
|
+
[:guest, :admin, :editor]
|
79
|
+
end
|
80
|
+
|
81
|
+
def has_role? role
|
82
|
+
self.role.to_sym == role.to_sym
|
83
|
+
end
|
84
|
+
end
|
85
|
+
|
86
|
+
|
87
|
+
|
88
|
+
|
89
|
+
|
90
|
+
|
91
|
+
|
92
|
+
|
93
|
+
|
94
|
+
|
@@ -7,7 +7,7 @@ describe Permits::Ability do
|
|
7
7
|
@editor = User.create(:name => "Kristian", :role => "editor")
|
8
8
|
@other_guy = User.create(:name => "Random dude", :role => "admin")
|
9
9
|
|
10
|
-
@ability = Permits::Ability.new(@editor, :strategy => :
|
10
|
+
@ability = Permits::Ability.new(@editor, :strategy => :string)
|
11
11
|
|
12
12
|
@own_comment = Comment.create(:user_id => @editor.id)
|
13
13
|
@other_comment = Comment.create(:user_id => @other_guy.id)
|
@@ -42,7 +42,7 @@ describe Permits::Ability do
|
|
42
42
|
@editor = User.create(:name => "Kristian", :role => "editor")
|
43
43
|
@other_guy = User.create(:name => "Random dude", :role => "admin")
|
44
44
|
|
45
|
-
@ability = Permits::Ability.new(@editor, :strategy => :
|
45
|
+
@ability = Permits::Ability.new(@editor, :strategy => :string)
|
46
46
|
|
47
47
|
@own_post = Post.create(:writer => @editor.id)
|
48
48
|
@other_post = Post.create(:writer => @other_guy.id)
|
@@ -5,7 +5,7 @@ describe Permits::Ability do
|
|
5
5
|
before :each do
|
6
6
|
@guest = User.create(:name => "Kristian", :role => "guest")
|
7
7
|
|
8
|
-
@ability = Permits::Ability.new(@guest, :strategy => :
|
8
|
+
@ability = Permits::Ability.new(@guest, :strategy => :string)
|
9
9
|
|
10
10
|
@comment = Comment.create(:user_id => @guest.id)
|
11
11
|
|
@@ -20,7 +20,7 @@ RSpec.configure do |config|
|
|
20
20
|
end
|
21
21
|
|
22
22
|
|
23
|
-
require_all File.dirname(__FILE__) + '/../
|
23
|
+
require_all File.dirname(__FILE__) + '/../generic/fixtures/permits'
|
24
24
|
require_all File.dirname(__FILE__) + '/models/all_models'
|
25
25
|
|
26
26
|
RSpec.configure do |config|
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
@@ -7,7 +7,7 @@ describe Permits::Ability do
|
|
7
7
|
@editor = User.create(:name => "Kristian", :role => "editor")
|
8
8
|
@other_guy = User.create(:name => "Random dude", :role => "admin")
|
9
9
|
|
10
|
-
@ability = Permits::Ability.new(@editor, :strategy => :
|
10
|
+
@ability = Permits::Ability.new(@editor, :strategy => :string)
|
11
11
|
|
12
12
|
@own_comment = Comment.create(:user_id => @editor.id)
|
13
13
|
@other_comment = Comment.create(:user_id => @other_guy.id)
|
@@ -42,7 +42,7 @@ describe Permits::Ability do
|
|
42
42
|
@editor = User.create(:name => "Kristian", :role => "editor")
|
43
43
|
@other_guy = User.create(:name => "Random dude", :role => "admin")
|
44
44
|
|
45
|
-
@ability = Permits::Ability.new(@editor, :strategy => :
|
45
|
+
@ability = Permits::Ability.new(@editor, :strategy => :string)
|
46
46
|
|
47
47
|
@own_post = Post.create(:writer => @editor.id)
|
48
48
|
@other_post = Post.create(:writer => @other_guy.id)
|
@@ -5,7 +5,7 @@ describe Permits::Ability do
|
|
5
5
|
before :each do
|
6
6
|
@guest = User.create(:name => "Kristian", :role => "guest")
|
7
7
|
|
8
|
-
@ability = Permits::Ability.new(@guest, :strategy => :
|
8
|
+
@ability = Permits::Ability.new(@guest, :strategy => :string)
|
9
9
|
|
10
10
|
@comment = Comment.create(:user_id => @guest.id)
|
11
11
|
|
@@ -4,7 +4,7 @@ require 'cancan/matchers'
|
|
4
4
|
require 'cancan-permits'
|
5
5
|
require 'cancan-permits/rspec'
|
6
6
|
|
7
|
-
require_all File.dirname(__FILE__) + '/../
|
7
|
+
require_all File.dirname(__FILE__) + '/../generic/fixtures/permits'
|
8
8
|
require_all File.dirname(__FILE__) + '/models/all_models'
|
9
9
|
|
10
10
|
RSpec.configure do |config|
|
@@ -7,7 +7,7 @@ describe Permits::Ability do
|
|
7
7
|
@editor = User.create(:name => "Kristian", :role => "editor")
|
8
8
|
@other_guy = User.create(:name => "Random dude", :role => "admin")
|
9
9
|
|
10
|
-
@ability = Permits::Ability.new(@editor, :strategy => :
|
10
|
+
@ability = Permits::Ability.new(@editor, :strategy => :string)
|
11
11
|
|
12
12
|
@own_comment = Comment.create(:user_id => @editor.id)
|
13
13
|
@other_comment = Comment.create(:user_id => @other_guy.id)
|
@@ -42,7 +42,7 @@ describe Permits::Ability do
|
|
42
42
|
@editor = User.create(:name => "Kristian", :role => "editor")
|
43
43
|
@other_guy = User.create(:name => "Random dude", :role => "admin")
|
44
44
|
|
45
|
-
@ability = Permits::Ability.new(@editor, :strategy => :
|
45
|
+
@ability = Permits::Ability.new(@editor, :strategy => :string)
|
46
46
|
|
47
47
|
@own_post = Post.create(:writer => @editor.id)
|
48
48
|
@other_post = Post.create(:writer => @other_guy.id)
|
@@ -5,7 +5,7 @@ describe Permits::Ability do
|
|
5
5
|
before :each do
|
6
6
|
@guest = User.create(:name => "Kristian", :role => "guest")
|
7
7
|
|
8
|
-
@ability = Permits::Ability.new(@guest, :strategy => :
|
8
|
+
@ability = Permits::Ability.new(@guest, :strategy => :string)
|
9
9
|
|
10
10
|
@comment = Comment.create(:user_id => @guest.id)
|
11
11
|
|
@@ -37,7 +37,7 @@ describe Permits::Ability do
|
|
37
37
|
context "Admin user" do
|
38
38
|
before do
|
39
39
|
@admin = User.create(:role => 'admin')
|
40
|
-
@ability = Permits::Ability.new(@admin)
|
40
|
+
@ability = Permits::Ability.new(@admin, :strategy => :string)
|
41
41
|
end
|
42
42
|
|
43
43
|
it "should be able to :read anything" do
|
data/spec/mongoid/spec_helper.rb
CHANGED
@@ -4,7 +4,7 @@ require 'cancan/matchers'
|
|
4
4
|
require 'cancan-permits'
|
5
5
|
require 'cancan-permits/rspec'
|
6
6
|
|
7
|
-
require_all File.dirname(__FILE__) + '/../
|
7
|
+
require_all File.dirname(__FILE__) + '/../generic/fixtures/permits'
|
8
8
|
require_all File.dirname(__FILE__) + '/models/all_models'
|
9
9
|
|
10
10
|
RSpec.configure do |config|
|
data/spec/spec_helper.rb
CHANGED
@@ -3,9 +3,9 @@ require 'cancan/matchers'
|
|
3
3
|
require 'cancan-permits'
|
4
4
|
require 'cancan-permits/rspec'
|
5
5
|
|
6
|
-
require_all File.dirname(__FILE__) + '/
|
6
|
+
require_all File.dirname(__FILE__) + '/generic/fixtures/permits'
|
7
7
|
|
8
|
-
require_all File.dirname(__FILE__) + '/
|
8
|
+
require_all File.dirname(__FILE__) + '/generic/permits/fixtures'
|
9
9
|
|
10
10
|
RSpec.configure do |config|
|
11
11
|
config.mock_with :mocha
|
metadata
CHANGED
@@ -5,8 +5,8 @@ version: !ruby/object:Gem::Version
|
|
5
5
|
segments:
|
6
6
|
- 0
|
7
7
|
- 2
|
8
|
-
-
|
9
|
-
version: 0.2.
|
8
|
+
- 3
|
9
|
+
version: 0.2.3
|
10
10
|
platform: ruby
|
11
11
|
authors:
|
12
12
|
- Kristian Mandrup
|
@@ -14,7 +14,7 @@ autorequire:
|
|
14
14
|
bindir: bin
|
15
15
|
cert_chain: []
|
16
16
|
|
17
|
-
date: 2010-10-
|
17
|
+
date: 2010-10-14 00:00:00 +02:00
|
18
18
|
default_executable:
|
19
19
|
dependencies:
|
20
20
|
- !ruby/object:Gem::Dependency
|
@@ -127,6 +127,7 @@ files:
|
|
127
127
|
- Rakefile
|
128
128
|
- VERSION
|
129
129
|
- cancan-permits.gemspec
|
130
|
+
- development.sqlite3
|
130
131
|
- lib/cancan-permits.rb
|
131
132
|
- lib/cancan-permits/main.rb
|
132
133
|
- lib/cancan-permits/namespaces.rb
|
@@ -143,17 +144,26 @@ files:
|
|
143
144
|
- lib/generators/permits/permits_generator.rb
|
144
145
|
- lib/generators/permits/templates/licenses.rb
|
145
146
|
- lib/generators/permits/templates/permit.rb
|
146
|
-
- spec/
|
147
|
-
- spec/
|
148
|
-
- spec/
|
149
|
-
- spec/
|
150
|
-
- spec/
|
151
|
-
- spec/
|
147
|
+
- spec/active_record/db/database.yml
|
148
|
+
- spec/active_record/migrations/001_create_user.rb
|
149
|
+
- spec/active_record/migrations/002_create_comment.rb
|
150
|
+
- spec/active_record/migrations/003_create_post.rb
|
151
|
+
- spec/active_record/migrations/004_create_article.rb
|
152
|
+
- spec/active_record/models/all_models.rb
|
153
|
+
- spec/active_record/owner_permits_spec.rb
|
154
|
+
- spec/active_record/permits_spec.rb
|
155
|
+
- spec/active_record/spec_helper.rb
|
152
156
|
- spec/data_mapper/models/all_models.rb
|
153
157
|
- spec/data_mapper/owner_permits_spec.rb
|
154
158
|
- spec/data_mapper/permits_spec.rb
|
155
159
|
- spec/data_mapper/spec_helper.rb
|
156
160
|
- spec/generators/permit_generator_spec.rb
|
161
|
+
- spec/generic/fixtures/permits/admin_permit.rb
|
162
|
+
- spec/generic/fixtures/permits/editor_permit.rb
|
163
|
+
- spec/generic/fixtures/permits/guest_permit.rb
|
164
|
+
- spec/generic/permits/fixtures/models.rb
|
165
|
+
- spec/generic/permits/owner_permits_spec.rb
|
166
|
+
- spec/generic/permits/permits_spec.rb
|
157
167
|
- spec/mongo_mapper/models/all_models.rb
|
158
168
|
- spec/mongo_mapper/owner_permits_spec.rb
|
159
169
|
- spec/mongo_mapper/permits_spec.rb
|
@@ -196,17 +206,25 @@ signing_key:
|
|
196
206
|
specification_version: 3
|
197
207
|
summary: Permits for use with CanCan
|
198
208
|
test_files:
|
199
|
-
- spec/
|
200
|
-
- spec/
|
201
|
-
- spec/
|
202
|
-
- spec/
|
203
|
-
- spec/
|
204
|
-
- spec/
|
209
|
+
- spec/active_record/migrations/001_create_user.rb
|
210
|
+
- spec/active_record/migrations/002_create_comment.rb
|
211
|
+
- spec/active_record/migrations/003_create_post.rb
|
212
|
+
- spec/active_record/migrations/004_create_article.rb
|
213
|
+
- spec/active_record/models/all_models.rb
|
214
|
+
- spec/active_record/owner_permits_spec.rb
|
215
|
+
- spec/active_record/permits_spec.rb
|
216
|
+
- spec/active_record/spec_helper.rb
|
205
217
|
- spec/data_mapper/models/all_models.rb
|
206
218
|
- spec/data_mapper/owner_permits_spec.rb
|
207
219
|
- spec/data_mapper/permits_spec.rb
|
208
220
|
- spec/data_mapper/spec_helper.rb
|
209
221
|
- spec/generators/permit_generator_spec.rb
|
222
|
+
- spec/generic/fixtures/permits/admin_permit.rb
|
223
|
+
- spec/generic/fixtures/permits/editor_permit.rb
|
224
|
+
- spec/generic/fixtures/permits/guest_permit.rb
|
225
|
+
- spec/generic/permits/fixtures/models.rb
|
226
|
+
- spec/generic/permits/owner_permits_spec.rb
|
227
|
+
- spec/generic/permits/permits_spec.rb
|
210
228
|
- spec/mongo_mapper/models/all_models.rb
|
211
229
|
- spec/mongo_mapper/owner_permits_spec.rb
|
212
230
|
- spec/mongo_mapper/permits_spec.rb
|