id_please 0.3.3 → 0.4.0

Sign up to get free protection for your applications and to get access to all the features.
data/test/roles_test.rb CHANGED
@@ -285,6 +285,26 @@ class RolesTest < ActiveSupport::TestCase
285
285
  assert_false @group4.accepts_role?(:member, @user1, :check_groups => false)
286
286
  end
287
287
 
288
+ should "be able to filter children based on roles" do
289
+ assert_same_elements @group4.children(:roles => :any), [@group2, @group1, @user1, @user2]
290
+ assert_same_elements @group4.children(:roles => [:member]), [@group2, @group1, @user1, @user2]
291
+ assert_same_elements @group4.children(:roles => [:owner]), []
292
+
293
+
294
+ @user3.has_role!(:owner, @group4)
295
+
296
+ assert_same_elements @group4.children(), [@group2, @group1, @user1, @user2]
297
+ assert_same_elements @group4.children(:roles => :any), [@group2, @group1, @user1, @user2, @user3]
298
+ assert_same_elements @group4.children(:roles => [:member]), [@group2, @group1, @user1, @user2]
299
+ assert_same_elements @group4.children(:roles => [:owner]), [@user3]
300
+
301
+ end
302
+
303
+ should "be able to display hashes of subject permissions" do
304
+ @user3.has_role!(:owner, @group4)
305
+ assert_equal @group4.children(:roles => :any, :view => :subject_hash), {@group2 => [:member], @group1 => [:member], @user1 => [:member], @user2 => [:member], @user3 => [:owner]}
306
+ end
307
+
288
308
  should "check roles based on groups" do
289
309
 
290
310
  assert @user2.has_role?(:member, @group2)
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: id_please
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.3.3
4
+ version: 0.4.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - James Stuart