Commit a39cfb54616fe156ba43ac3df2b771c3a11d2879
1 parent
77d06454
Exists in
master
and in
4 other branches
Simplify StubbedRepository after GitHost changes from master
Showing
1 changed file
with
7 additions
and
22 deletions
Show diff stats
spec/support/stubbed_repository.rb
@@ -9,34 +9,19 @@ module StubbedRepository | @@ -9,34 +9,19 @@ module StubbedRepository | ||
9 | # will overwrite our stub, so use alias_method to ensure it's our stub | 9 | # will overwrite our stub, so use alias_method to ensure it's our stub |
10 | # getting called. | 10 | # getting called. |
11 | 11 | ||
12 | - alias_method :update_repository, :fake_update_repository | ||
13 | - alias_method :destroy_repository, :fake_destroy_repository | ||
14 | - alias_method :repository_delete_key, :fake_repository_delete_key | ||
15 | - alias_method :path_to_repo, :fake_path_to_repo | ||
16 | - alias_method :satellite, :fake_satellite | ||
17 | - end | ||
18 | - | ||
19 | - def fake_update_repository | ||
20 | - true | ||
21 | - end | ||
22 | - | ||
23 | - def fake_destroy_repository | ||
24 | - true | ||
25 | - end | ||
26 | - | ||
27 | - def fake_repository_delete_key | ||
28 | - true | 12 | + alias_method :path_to_repo, :fake_path_to_repo |
13 | + alias_method :satellite, :fake_satellite | ||
29 | end | 14 | end |
30 | 15 | ||
31 | def fake_path_to_repo | 16 | def fake_path_to_repo |
32 | - if new_record? | ||
33 | - # There are a couple Project specs that expect the Project's path to be | ||
34 | - # in the returned path, so let's patronize them. | 17 | + if new_record? || path == 'newproject' |
18 | + # There are a couple Project specs and features that expect the Project's | ||
19 | + # path to be in the returned path, so let's patronize them. | ||
35 | File.join(Rails.root, 'tmp', 'tests', path) | 20 | File.join(Rails.root, 'tmp', 'tests', path) |
36 | else | 21 | else |
37 | # For everything else, just give it the path to one of our real seeded | 22 | # For everything else, just give it the path to one of our real seeded |
38 | # repos. | 23 | # repos. |
39 | - File.join(Rails.root, 'tmp', 'tests', 'gitlabhq_1') | 24 | + File.join(Rails.root, 'tmp', 'tests', 'gitlabhq_0') |
40 | end | 25 | end |
41 | end | 26 | end |
42 | 27 | ||
@@ -55,6 +40,6 @@ module StubbedRepository | @@ -55,6 +40,6 @@ module StubbedRepository | ||
55 | end | 40 | end |
56 | end | 41 | end |
57 | 42 | ||
58 | -[Project, Key, ProtectedBranch, UsersProject].each do |c| | 43 | +[Project, ProtectedBranch, UsersProject].each do |c| |
59 | c.send(:include, StubbedRepository) | 44 | c.send(:include, StubbedRepository) |
60 | end | 45 | end |