permissive 0.0.1 → 0.2.0.alpha
Sign up to get free protection for your applications and to get access to all the features.
- data/.gemspec +19 -1
- data/.gitignore +3 -1
- data/CHANGELOG +0 -0
- data/README.markdown +37 -29
- data/Rakefile +2 -2
- data/VERSION +1 -1
- data/generators/permissive_migration/templates/permissive_migration.rb +0 -2
- data/lib/permissive.rb +14 -12
- data/lib/permissive/errors.rb +4 -0
- data/lib/permissive/has_permissions.rb +153 -0
- data/lib/permissive/permission.rb +12 -30
- data/lib/permissive/permission_definition.rb +94 -0
- data/spec/has_permissions_spec.rb +326 -0
- data/spec/rcov.opts +2 -1
- data/spec/spec_helper.rb +2 -22
- metadata +23 -16
- data/README.markdown.html +0 -191
- data/lib/permissive/acts_as_permissive.rb +0 -134
- data/lib/permissive/permissions.rb +0 -29
- data/spec/acts_as_permissive_spec.rb +0 -192
- data/spec/permissions_spec.rb +0 -44
data/spec/permissions_spec.rb
DELETED
@@ -1,44 +0,0 @@
|
|
1
|
-
require File.join(File.dirname(__FILE__), 'spec_helper')
|
2
|
-
describe Permissive::Permissions do
|
3
|
-
before :each do
|
4
|
-
PermissiveSpecHelper.db_up
|
5
|
-
end
|
6
|
-
|
7
|
-
after :each do
|
8
|
-
PermissiveSpecHelper.db_down
|
9
|
-
end
|
10
|
-
|
11
|
-
context "permission constants" do
|
12
|
-
it "should have a `hash' method" do
|
13
|
-
Permissive::Permissions.should respond_to(:hash)
|
14
|
-
end
|
15
|
-
|
16
|
-
it "should return an ordered hash when `hash' is called" do
|
17
|
-
Permissive::Permissions.hash.should be_instance_of(ActiveSupport::OrderedHash)
|
18
|
-
end
|
19
|
-
|
20
|
-
it "should have symbol keys for the permission constants" do
|
21
|
-
Permissive::Permissions.hash.has_key?(:finalize_lab_selection_list).should be_true
|
22
|
-
end
|
23
|
-
|
24
|
-
it "should convert all CONSTANT values to base-2 compatible integers" do
|
25
|
-
Permissive::Permissions.constants.each do |constant|
|
26
|
-
Permissive::Permissions.hash[constant.downcase.to_sym].should == 2 ** Permissive::Permissions.const_get(constant)
|
27
|
-
end
|
28
|
-
end
|
29
|
-
|
30
|
-
it "should explode when a constant isn't Numeric" do
|
31
|
-
Permissive::Permissions.const_set('FOOBAR', 'achoo')
|
32
|
-
lambda {
|
33
|
-
Permissive::Permissions.hash
|
34
|
-
}.should raise_error(Permissive::PermissionError)
|
35
|
-
|
36
|
-
Permissive::Permissions.const_set('FOOBAR', 5)
|
37
|
-
lambda {
|
38
|
-
Permissive::Permissions.hash
|
39
|
-
}.should_not raise_error(Permissive::PermissionError)
|
40
|
-
end
|
41
|
-
end
|
42
|
-
end
|
43
|
-
|
44
|
-
PermissiveSpecHelper.clear_log
|