Commit c75fc9c7a692f8b7613ca8824f18e075af785c9b

Authored by Dmitriy Zaporozhets
1 parent 935b6ae6

remove gitolite stub

spec/spec_helper.rb
... ... @@ -24,7 +24,6 @@ RSpec.configure do |config|
24 24 config.mock_with :rspec
25 25  
26 26 config.include LoginHelpers, type: :request
27   - config.include GitoliteStub
28 27 config.include FactoryGirl::Syntax::Methods
29 28 config.include Devise::TestHelpers, type: :controller
30 29  
... ... @@ -34,8 +33,6 @@ RSpec.configure do |config|
34 33 config.use_transactional_fixtures = false
35 34  
36 35 config.before do
37   - stub_gitolite!
38   -
39 36 # Use tmp dir for FS manipulations
40 37 temp_repos_path = Rails.root.join('tmp', 'test-git-base-path')
41 38 Gitlab.config.gitolite.stub(repos_path: temp_repos_path)
... ...
spec/support/gitolite_stub.rb
... ... @@ -1,21 +0,0 @@
1   -module GitoliteStub
2   - def stub_gitolite!
3   - stub_gitlab_gitolite
4   - stub_gitolite_admin
5   - end
6   -
7   - def stub_gitolite_admin
8   - gitolite_admin = double('Gitolite::GitoliteAdmin')
9   - gitolite_admin.as_null_object
10   -
11   - Gitolite::GitoliteAdmin.stub(new: gitolite_admin)
12   - end
13   -
14   - def stub_gitlab_gitolite
15   - gitolite_config = double('Gitlab::GitoliteConfig')
16   - gitolite_config.stub(apply: ->() { yield(self) })
17   - gitolite_config.as_null_object
18   -
19   - Gitlab::GitoliteConfig.stub(new: gitolite_config)
20   - end
21   -end
spec/support/stubbed_repository.rb
1 1 require "repository"
2 2 require "project"
  3 +require "shell"
3 4  
4 5 # Stubs out all Git repository access done by models so that specs can run
5 6 # against fake repositories without Grit complaining that they don't exist.
... ... @@ -36,3 +37,23 @@ class GitLabTestRepo < Repository
36 37 @repo ||= Grit::Repo.new(Rails.root.join('tmp', 'repositories', 'gitlabhq'))
37 38 end
38 39 end
  40 +
  41 +module Gitlab
  42 + class Shell
  43 + def add_repository name
  44 + true
  45 + end
  46 +
  47 + def remove_repository name
  48 + true
  49 + end
  50 +
  51 + def add_key name, key
  52 + true
  53 + end
  54 +
  55 + def remove_key key
  56 + true
  57 + end
  58 + end
  59 +end
... ...