roles_data_mapper 0.1.3 → 0.2.0
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/Rakefile +6 -6
- data/VERSION +1 -1
- data/lib/roles_data_mapper/base.rb +3 -3
- data/lib/roles_data_mapper/strategy/multi/many_roles.rb +51 -25
- data/lib/roles_data_mapper/strategy/multi/roles_mask.rb +70 -23
- data/lib/roles_data_mapper/strategy/multi.rb +54 -0
- data/lib/roles_data_mapper/strategy/shared.rb +26 -0
- data/lib/roles_data_mapper/strategy/single/admin_flag.rb +55 -22
- data/lib/roles_data_mapper/strategy/single/one_role.rb +34 -23
- data/lib/roles_data_mapper/strategy/single/role_string.rb +19 -18
- data/lib/roles_data_mapper/strategy/single.rb +34 -0
- data/roles_data_mapper.gemspec +35 -30
- data/spec/roles_data_mapper/strategy/api_examples.rb +212 -0
- data/spec/roles_data_mapper/strategy/multi/many_roles_spec.rb +32 -0
- data/spec/roles_data_mapper/strategy/{roles_mask_spec.rb → multi/roles_mask_spec.rb} +13 -7
- data/spec/roles_data_mapper/strategy/{admin_flag_spec.rb → single/admin_flag_spec.rb} +11 -7
- data/spec/roles_data_mapper/strategy/single/one_role_spec.rb +27 -0
- data/spec/roles_data_mapper/strategy/single/role_string_spec.rb +49 -0
- data/spec/roles_data_mapper/strategy/user_setup.rb +4 -4
- metadata +35 -31
- data/spec/roles_data_mapper/strategy/many_roles_spec.rb +0 -23
- data/spec/roles_data_mapper/strategy/one_role_spec.rb +0 -23
- data/spec/roles_data_mapper/strategy/role_string_spec.rb +0 -22
@@ -1,23 +0,0 @@
|
|
1
|
-
require 'spec_helper'
|
2
|
-
use_roles_strategy :many_roles
|
3
|
-
|
4
|
-
class User
|
5
|
-
include DataMapper::Resource
|
6
|
-
include Roles::DataMapper
|
7
|
-
|
8
|
-
strategy :many_roles, :default
|
9
|
-
role_class :role
|
10
|
-
|
11
|
-
property :id, Serial
|
12
|
-
property :name, String
|
13
|
-
end
|
14
|
-
|
15
|
-
DataMapper.finalize
|
16
|
-
DataMapper.auto_migrate!
|
17
|
-
|
18
|
-
User.valid_roles_are :admin, :guest
|
19
|
-
|
20
|
-
describe "Roles for DataMapper: :many_roles strategy" do
|
21
|
-
require "roles_data_mapper/user_setup"
|
22
|
-
require "roles_generic/rspec/api"
|
23
|
-
end
|
@@ -1,23 +0,0 @@
|
|
1
|
-
require 'spec_helper'
|
2
|
-
use_roles_strategy :one_role
|
3
|
-
|
4
|
-
class User
|
5
|
-
include DataMapper::Resource
|
6
|
-
include Roles::DataMapper
|
7
|
-
|
8
|
-
strategy :one_role, :default
|
9
|
-
role_class :role
|
10
|
-
|
11
|
-
property :id, Serial
|
12
|
-
property :name, String
|
13
|
-
end
|
14
|
-
|
15
|
-
DataMapper.finalize
|
16
|
-
DataMapper.auto_migrate!
|
17
|
-
|
18
|
-
User.valid_roles_are :admin, :guest
|
19
|
-
|
20
|
-
describe "Roles for DataMapper: :one_role strategy" do
|
21
|
-
require "roles_data_mapper/user_setup"
|
22
|
-
require "roles_generic/rspec/api"
|
23
|
-
end
|
@@ -1,22 +0,0 @@
|
|
1
|
-
require 'spec_helper'
|
2
|
-
use_roles_strategy :role_string
|
3
|
-
|
4
|
-
class User
|
5
|
-
include DataMapper::Resource
|
6
|
-
include Roles::DataMapper
|
7
|
-
|
8
|
-
strategy :role_string, :default
|
9
|
-
|
10
|
-
property :id, Serial
|
11
|
-
property :name, String
|
12
|
-
end
|
13
|
-
|
14
|
-
DataMapper.finalize
|
15
|
-
DataMapper.auto_migrate!
|
16
|
-
|
17
|
-
User.valid_roles_are :admin, :guest
|
18
|
-
|
19
|
-
describe "Roles for DataMapper: :role_string strategy" do
|
20
|
-
require "roles_data_mapper/user_setup"
|
21
|
-
require "roles_generic/rspec/api"
|
22
|
-
end
|