Skip to content

Commit d32bcfb

Browse files
committed
Move setup out of stub block
The stub was affecting the search for the groups, tada.
1 parent b971627 commit d32bcfb

File tree

1 file changed

+11
-6
lines changed

1 file changed

+11
-6
lines changed

test/membership_validators/active_directory_test.rb

Lines changed: 11 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -18,45 +18,50 @@ def make_validator(groups)
1818
end
1919

2020
def test_validates_user_in_group
21+
validator = make_validator(%w(nested-group1))
22+
2123
@ldap.stub :search, [@entry] do
22-
validator = make_validator(%w(nested-group1))
2324
assert validator.perform(@entry)
2425
end
2526
end
2627

2728
def test_validates_user_in_child_group
29+
validator = make_validator(%w(n-depth-nested-group1))
30+
2831
@ldap.stub :search, [@entry] do
29-
validator = make_validator(%w(n-depth-nested-group1))
3032
assert validator.perform(@entry)
3133
end
3234
end
3335

3436
def test_validates_user_in_grandchild_group
37+
validator = make_validator(%w(n-depth-nested-group2))
38+
3539
@ldap.stub :search, [@entry] do
36-
validator = make_validator(%w(n-depth-nested-group2))
3740
assert validator.perform(@entry)
3841
end
3942
end
4043

4144
def test_validates_user_in_great_grandchild_group
45+
validator = make_validator(%w(n-depth-nested-group3))
46+
4247
@ldap.stub :search, [@entry] do
43-
validator = make_validator(%w(n-depth-nested-group3))
4448
assert validator.perform(@entry)
4549
end
4650
end
4751

4852
def test_does_not_validate_user_not_in_group
53+
validator = make_validator(%w(ghe-admins))
54+
4955
@ldap.stub :search, [] do
50-
validator = make_validator(%w(ghe-admins))
5156
refute validator.perform(@entry)
5257
end
5358
end
5459

5560
def test_does_not_validate_user_not_in_any_group
5661
entry = @domain.user?('groupless-user1')
62+
validator = make_validator(%w(all-users))
5763

5864
@ldap.stub :search, [] do
59-
validator = make_validator(%w(all-users))
6065
refute validator.perform(entry)
6166
end
6267
end

0 commit comments

Comments
 (0)