diff --git a/spec/spec_helper.rb b/spec/spec_helper.rb
index dbac3c549011f393de88c8d7e914e96d9d76e2f6..bb314e60eb7d47c5e822a721ce7e396905af2dda 100644
--- a/spec/spec_helper.rb
+++ b/spec/spec_helper.rb
@@ -24,7 +24,6 @@ RSpec.configure do |config|
   config.mock_with :rspec
 
   config.include LoginHelpers, type: :request
-  config.include GitoliteStub
   config.include FactoryGirl::Syntax::Methods
   config.include Devise::TestHelpers, type: :controller
 
@@ -34,8 +33,6 @@ RSpec.configure do |config|
   config.use_transactional_fixtures = false
 
   config.before do
-    stub_gitolite!
-
     # Use tmp dir for FS manipulations
     temp_repos_path = Rails.root.join('tmp', 'test-git-base-path')
     Gitlab.config.gitolite.stub(repos_path: temp_repos_path)
diff --git a/spec/support/gitolite_stub.rb b/spec/support/gitolite_stub.rb
deleted file mode 100644
index 574bb5a12a3f9e52d2f84be600523d0560fcd866..0000000000000000000000000000000000000000
--- a/spec/support/gitolite_stub.rb
+++ /dev/null
@@ -1,21 +0,0 @@
-module GitoliteStub
-  def stub_gitolite!
-    stub_gitlab_gitolite
-    stub_gitolite_admin
-  end
-
-  def stub_gitolite_admin
-    gitolite_admin = double('Gitolite::GitoliteAdmin')
-    gitolite_admin.as_null_object
-
-    Gitolite::GitoliteAdmin.stub(new: gitolite_admin)
-  end
-
-  def stub_gitlab_gitolite
-    gitolite_config = double('Gitlab::GitoliteConfig')
-    gitolite_config.stub(apply: ->() { yield(self) })
-    gitolite_config.as_null_object
-
-    Gitlab::GitoliteConfig.stub(new: gitolite_config)
-  end
-end
diff --git a/spec/support/stubbed_repository.rb b/spec/support/stubbed_repository.rb
index e092f8a477674c51fe30e84f736113f3cd31f945..fd891b1ce147d69af1a4a35e611125cf034ef5d0 100644
--- a/spec/support/stubbed_repository.rb
+++ b/spec/support/stubbed_repository.rb
@@ -1,5 +1,6 @@
 require "repository"
 require "project"
+require "shell"
 
 # Stubs out all Git repository access done by models so that specs can run
 # against fake repositories without Grit complaining that they don't exist.
@@ -36,3 +37,23 @@ class GitLabTestRepo < Repository
     @repo ||= Grit::Repo.new(Rails.root.join('tmp', 'repositories', 'gitlabhq'))
   end
 end
+
+module Gitlab
+  class Shell
+    def add_repository name
+      true
+    end
+
+    def remove_repository name
+      true
+    end
+
+    def add_key name, key
+      true
+    end
+
+    def remove_key key
+      true
+    end
+  end
+end