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.
@@ -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