mongoid_ability 0.3.12 → 0.4.3

Sign up to get free protection for your applications and to get access to all the features.
@@ -2,13 +2,9 @@ module MongoidAbility
2
2
  class MySubject
3
3
  include Mongoid::Document
4
4
  include MongoidAbility::Subject
5
-
6
- default_lock MyLock, :read, true
7
- default_lock MyLock1, :update, false
8
5
  end
9
6
 
10
7
  class MySubject1 < MySubject
11
- default_lock MyLock, :read, false
12
8
  end
13
9
 
14
10
  class MySubject2 < MySubject1
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: mongoid_ability
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.3.12
4
+ version: 0.4.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - Tomas Celizna
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2016-11-25 00:00:00.000000000 Z
11
+ date: 2017-01-30 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: cancancan
@@ -147,6 +147,7 @@ files:
147
147
  - ".coveralls.yml"
148
148
  - ".gitignore"
149
149
  - ".travis.yml"
150
+ - CHANGELOG.md
150
151
  - Gemfile
151
152
  - Guardfile
152
153
  - LICENSE.txt
@@ -161,11 +162,13 @@ files:
161
162
  - lib/mongoid_ability/resolve_inherited_locks.rb
162
163
  - lib/mongoid_ability/resolve_locks.rb
163
164
  - lib/mongoid_ability/resolve_owner_locks.rb
165
+ - lib/mongoid_ability/resolver.rb
164
166
  - lib/mongoid_ability/subject.rb
165
167
  - lib/mongoid_ability/values_for_accessible_query.rb
166
168
  - lib/mongoid_ability/version.rb
167
169
  - mongoid_ability.gemspec
168
- - test/mongoid_ability/ability_role_test.rb
170
+ - test/mongoid_ability/ability_basic_test.rb
171
+ - test/mongoid_ability/ability_syntactic_sugar_test.rb
169
172
  - test/mongoid_ability/ability_test.rb
170
173
  - test/mongoid_ability/accessible_query_builder_test.rb
171
174
  - test/mongoid_ability/can_options_test.rb
@@ -174,8 +177,8 @@ files:
174
177
  - test/mongoid_ability/owner_test.rb
175
178
  - test/mongoid_ability/resolve_default_locks_test.rb
176
179
  - test/mongoid_ability/resolve_inherited_locks_test.rb
177
- - test/mongoid_ability/resolve_locks_test.rb
178
180
  - test/mongoid_ability/resolve_owner_locks_test.rb
181
+ - test/mongoid_ability/resolver_test.rb
179
182
  - test/mongoid_ability/subject_accessible_by_test.rb
180
183
  - test/mongoid_ability/subject_test.rb
181
184
  - test/support/expectations.rb
@@ -210,7 +213,8 @@ specification_version: 4
210
213
  summary: Custom Ability class that allows CanCanCan authorization library store permissions
211
214
  in MongoDB via the Mongoid gem.
212
215
  test_files:
213
- - test/mongoid_ability/ability_role_test.rb
216
+ - test/mongoid_ability/ability_basic_test.rb
217
+ - test/mongoid_ability/ability_syntactic_sugar_test.rb
214
218
  - test/mongoid_ability/ability_test.rb
215
219
  - test/mongoid_ability/accessible_query_builder_test.rb
216
220
  - test/mongoid_ability/can_options_test.rb
@@ -219,8 +223,8 @@ test_files:
219
223
  - test/mongoid_ability/owner_test.rb
220
224
  - test/mongoid_ability/resolve_default_locks_test.rb
221
225
  - test/mongoid_ability/resolve_inherited_locks_test.rb
222
- - test/mongoid_ability/resolve_locks_test.rb
223
226
  - test/mongoid_ability/resolve_owner_locks_test.rb
227
+ - test/mongoid_ability/resolver_test.rb
224
228
  - test/mongoid_ability/subject_accessible_by_test.rb
225
229
  - test/mongoid_ability/subject_test.rb
226
230
  - test/support/expectations.rb
@@ -1,31 +0,0 @@
1
- require "test_helper"
2
-
3
- module MongoidAbility
4
- describe 'ability on Role' do
5
-
6
- let(:read_lock) { MyLock.new(subject_type: MySubject, action: :read, outcome: false) }
7
- let(:role) { MyRole.new(my_locks: [ read_lock ]) }
8
- let(:ability) { Ability.new(role) }
9
-
10
- # ---------------------------------------------------------------------
11
-
12
- before do
13
- MySubject.default_locks = [ MyLock.new(action: :read, outcome: true) ]
14
- end
15
-
16
- # ---------------------------------------------------------------------
17
-
18
- it 'role can?' do
19
- ability.can?(:read, MySubject).must_equal false
20
- end
21
-
22
- it 'role cannot?' do
23
- ability.cannot?(:read, MySubject).must_equal true
24
- end
25
-
26
- it 'is accessible by' do
27
- MySubject.accessible_by(ability, :read).must_be_kind_of Mongoid::Criteria
28
- end
29
-
30
- end
31
- end