summaryrefslogtreecommitdiff
path: root/spec
diff options
context:
space:
mode:
Diffstat (limited to 'spec')
-rw-r--r--spec/lib/gitlab/ldap/ldap_user_auth_spec.rb10
-rw-r--r--spec/requests/api/users_spec.rb2
-rw-r--r--spec/workers/post_receive_spec.rb2
3 files changed, 7 insertions, 7 deletions
diff --git a/spec/lib/gitlab/ldap/ldap_user_auth_spec.rb b/spec/lib/gitlab/ldap/ldap_user_auth_spec.rb
index b7d7bbaad2e..a0e74c49631 100644
--- a/spec/lib/gitlab/ldap/ldap_user_auth_spec.rb
+++ b/spec/lib/gitlab/ldap/ldap_user_auth_spec.rb
@@ -25,7 +25,7 @@ describe Gitlab::LDAP do
it "should update credentials by email if missing uid" do
user = double('User')
User.stub find_by_extern_uid_and_provider: nil
- User.stub find_by_email: user
+ User.stub(:find_by).with(hash_including(email: anything())) { user }
user.should_receive :update_attributes
gl_auth.find_or_create(@auth)
end
@@ -35,8 +35,8 @@ describe Gitlab::LDAP do
value = Gitlab.config.ldap.allow_username_or_email_login
Gitlab.config.ldap['allow_username_or_email_login'] = true
User.stub find_by_extern_uid_and_provider: nil
- User.stub find_by_email: nil
- User.stub find_by_username: user
+ User.stub(:find_by).with(hash_including(email: anything())) { nil }
+ User.stub(:find_by).with(hash_including(username: anything())) { user }
user.should_receive :update_attributes
gl_auth.find_or_create(@auth)
Gitlab.config.ldap['allow_username_or_email_login'] = value
@@ -47,8 +47,8 @@ describe Gitlab::LDAP do
value = Gitlab.config.ldap.allow_username_or_email_login
Gitlab.config.ldap['allow_username_or_email_login'] = false
User.stub find_by_extern_uid_and_provider: nil
- User.stub find_by_email: nil
- User.stub find_by_username: user
+ User.stub(:find_by).with(hash_including(email: anything())) { nil }
+ User.stub(:find_by).with(hash_including(username: anything())) { user }
user.should_not_receive :update_attributes
gl_auth.find_or_create(@auth)
Gitlab.config.ldap['allow_username_or_email_login'] = value
diff --git a/spec/requests/api/users_spec.rb b/spec/requests/api/users_spec.rb
index 4ef78b8e5d0..c4be5102002 100644
--- a/spec/requests/api/users_spec.rb
+++ b/spec/requests/api/users_spec.rb
@@ -93,7 +93,7 @@ describe API::API do
expect {
post api("/users", admin), attr
}.to change { User.count }.by(1)
- user = User.find_by_username(attr[:username])
+ user = User.find_by(username: attr[:username])
user.projects_limit.should == limit
user.theme_id.should == Gitlab::Theme::MARS
Gitlab.config.gitlab.unstub(:default_projects_limit)
diff --git a/spec/workers/post_receive_spec.rb b/spec/workers/post_receive_spec.rb
index 46e86dbe00a..0850734f136 100644
--- a/spec/workers/post_receive_spec.rb
+++ b/spec/workers/post_receive_spec.rb
@@ -19,7 +19,7 @@ describe PostReceive do
end
it "does not run if the author is not in the project" do
- Key.stub(find_by_id: nil)
+ Key.stub(:find_by).with(hash_including(id: anything())) { nil }
project.should_not_receive(:execute_hooks)