Commit a442f717 authored by Douwe Maan's avatar Douwe Maan

Methods defined on prepended modules need to be stubbed on that module

parent 3802306f
...@@ -246,14 +246,14 @@ describe Gitlab::LDAP::Access do ...@@ -246,14 +246,14 @@ describe Gitlab::LDAP::Access do
end end
it "adds a Kerberos identity if it is in Active Directory but not in GitLab" do it "adds a Kerberos identity if it is in Active Directory but not in GitLab" do
allow_any_instance_of(Gitlab::LDAP::Person).to receive_messages(kerberos_principal: "mylogin@FOO.COM") allow_any_instance_of(EE::Gitlab::LDAP::Person).to receive_messages(kerberos_principal: "mylogin@FOO.COM")
expect { access.update_kerberos_identity }.to change(user.identities.where(provider: :kerberos), :count).from(0).to(1) expect { access.update_kerberos_identity }.to change(user.identities.where(provider: :kerberos), :count).from(0).to(1)
expect(user.identities.where(provider: "kerberos").last.extern_uid).to eq("mylogin@FOO.COM") expect(user.identities.where(provider: "kerberos").last.extern_uid).to eq("mylogin@FOO.COM")
end end
it "updates existing Kerberos identity in GitLab if Active Directory has a different one" do it "updates existing Kerberos identity in GitLab if Active Directory has a different one" do
allow_any_instance_of(Gitlab::LDAP::Person).to receive_messages(kerberos_principal: "otherlogin@BAR.COM") allow_any_instance_of(EE::Gitlab::LDAP::Person).to receive_messages(kerberos_principal: "otherlogin@BAR.COM")
user.identities.build(provider: "kerberos", extern_uid: "mylogin@FOO.COM").save user.identities.build(provider: "kerberos", extern_uid: "mylogin@FOO.COM").save
expect { access.update_kerberos_identity }.not_to change(user.identities.where(provider: "kerberos"), :count) expect { access.update_kerberos_identity }.not_to change(user.identities.where(provider: "kerberos"), :count)
...@@ -261,7 +261,7 @@ describe Gitlab::LDAP::Access do ...@@ -261,7 +261,7 @@ describe Gitlab::LDAP::Access do
end end
it "does not remove Kerberos identities from GitLab if they are none in the LDAP provider" do it "does not remove Kerberos identities from GitLab if they are none in the LDAP provider" do
allow_any_instance_of(Gitlab::LDAP::Person).to receive_messages(kerberos_principal: nil) allow_any_instance_of(EE::Gitlab::LDAP::Person).to receive_messages(kerberos_principal: nil)
user.identities.build(provider: "kerberos", extern_uid: "otherlogin@BAR.COM").save user.identities.build(provider: "kerberos", extern_uid: "otherlogin@BAR.COM").save
expect { access.update_kerberos_identity }.not_to change(user.identities.where(provider: "kerberos"), :count) expect { access.update_kerberos_identity }.not_to change(user.identities.where(provider: "kerberos"), :count)
...@@ -269,7 +269,7 @@ describe Gitlab::LDAP::Access do ...@@ -269,7 +269,7 @@ describe Gitlab::LDAP::Access do
end end
it "does not modify identities in GitLab if they are no kerberos principal in the LDAP provider" do it "does not modify identities in GitLab if they are no kerberos principal in the LDAP provider" do
allow_any_instance_of(Gitlab::LDAP::Person).to receive_messages(kerberos_principal: nil) allow_any_instance_of(EE::Gitlab::LDAP::Person).to receive_messages(kerberos_principal: nil)
expect { access.update_kerberos_identity }.not_to change(user.identities, :count) expect { access.update_kerberos_identity }.not_to change(user.identities, :count)
end end
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment