permissionable 0.1.2 → 0.1.3
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.travis.yml +4 -0
- data/README.md +3 -1
- data/Rakefile +8 -0
- data/lib/permissionable/permissions.rb +1 -1
- data/lib/permissionable/version.rb +1 -1
- data/spec/permissionable_spec.rb +1 -1
- data/spec/permissions_spec.rb +19 -5
- metadata +2 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 2b3291aed21cc9e20392419b0ee512fa578fd335
|
4
|
+
data.tar.gz: ca2dfd9bad69191f9ad342b01c721f4dbf23b42f
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: c6fd05d537db592239652ed21919ca18f93c2ccfd918cfe6b789c012b5c521643d539b3c262b54bbdbedd7f1f4adc593018914cefd2221a5e2dfd48d9dbcac1d
|
7
|
+
data.tar.gz: e819ee8e617b32b194036c8f9fd4c1acd79ec5e93450e050ebce154f859048f5cb946ec898997ec1bcc0d04261022486200a729430603df35efe5ad33964b5a7
|
data/.travis.yml
ADDED
data/README.md
CHANGED
@@ -1,8 +1,10 @@
|
|
1
|
+
[![Build Status](https://travis-ci.org/robertfalken/permissionable.svg?branch=master)](https://travis-ci.org/robertfalken/permissionable)
|
2
|
+
|
1
3
|
# permissionable
|
2
4
|
## Installation
|
3
5
|
|
4
6
|
Permissionable is distributed as a gem. To install, just add this line to your Gemfile:
|
5
|
-
`gem 'permissionable', '~> 0.1.
|
7
|
+
`gem 'permissionable', '~> 0.1.2'`
|
6
8
|
|
7
9
|
|
8
10
|
## Usage
|
data/Rakefile
CHANGED
data/spec/permissionable_spec.rb
CHANGED
@@ -1,4 +1,3 @@
|
|
1
|
-
require 'pry'
|
2
1
|
require 'permissionable'
|
3
2
|
require 'dummy'
|
4
3
|
|
@@ -7,6 +6,7 @@ class FlakyDummy
|
|
7
6
|
include Permissionable
|
8
7
|
end
|
9
8
|
|
9
|
+
|
10
10
|
describe Permissionable do
|
11
11
|
context 'permission definitions' do
|
12
12
|
subject(:permissions) { Dummy.instance_variable_get(:@permissions) }
|
data/spec/permissions_spec.rb
CHANGED
@@ -1,7 +1,15 @@
|
|
1
|
-
require 'pry'
|
2
1
|
require 'permissionable'
|
3
2
|
require 'dummy'
|
4
3
|
|
4
|
+
class DummyWithPermissions
|
5
|
+
include Permissionable
|
6
|
+
permissions walk: 1
|
7
|
+
|
8
|
+
def read_attribute(attribute)
|
9
|
+
1 if attribute == :permissions
|
10
|
+
end
|
11
|
+
end
|
12
|
+
|
5
13
|
describe Permissionable::Permissions do
|
6
14
|
before(:each) { @permissions = Permissionable::Permissions.new(Dummy.new) }
|
7
15
|
|
@@ -59,18 +67,24 @@ describe Permissionable::Permissions do
|
|
59
67
|
expect(@permissions[:play]).to eq(false)
|
60
68
|
end
|
61
69
|
|
62
|
-
it '
|
70
|
+
it 'updates column when adding permission' do
|
63
71
|
@owner = Dummy.new
|
64
72
|
@permissions = Permissionable::Permissions.new(@owner)
|
65
|
-
expect(@owner).to receive(:
|
73
|
+
expect(@owner).to receive(:update_column).with(:permissions, 2)
|
66
74
|
@permissions << :walk
|
67
75
|
end
|
68
76
|
|
69
|
-
it '
|
77
|
+
it 'updates column when removing permission' do
|
70
78
|
@owner = Dummy.new
|
71
79
|
@permissions = Permissionable::Permissions.new(@owner)
|
72
80
|
@permissions << :run
|
73
|
-
expect(@owner).to receive(:
|
81
|
+
expect(@owner).to receive(:update_column).with(:permissions, 0)
|
74
82
|
@permissions.remove :run
|
75
83
|
end
|
84
|
+
|
85
|
+
it 'can read permissions from owner' do
|
86
|
+
owner = DummyWithPermissions.new
|
87
|
+
permissions = Permissionable::Permissions.new(owner)
|
88
|
+
expect(permissions[:walk]).to be true
|
89
|
+
end
|
76
90
|
end
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: permissionable
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.3
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Robert Falkén
|
@@ -60,6 +60,7 @@ extensions: []
|
|
60
60
|
extra_rdoc_files: []
|
61
61
|
files:
|
62
62
|
- ".gitignore"
|
63
|
+
- ".travis.yml"
|
63
64
|
- Gemfile
|
64
65
|
- LICENSE.txt
|
65
66
|
- README.md
|