Commit 1dda08486b7751a677870486d4b576e6dd6071e7

Authored by Robert Speicher
1 parent 39ff033d

Only include StubbedRepository in Project model

Showing 1 changed file with 3 additions and 17 deletions   Show diff stats
spec/support/stubbed_repository.rb
1 # Stubs out all Git repository access done by models so that specs can run 1 # Stubs out all Git repository access done by models so that specs can run
2 # against fake repositories without Grit complaining that they don't exist. 2 # against fake repositories without Grit complaining that they don't exist.
3 module StubbedRepository 3 module StubbedRepository
4 - extend ActiveSupport::Concern  
5 -  
6 - included do  
7 - # If a class defines the method we want to stub directly, rather than  
8 - # inheriting it from a module (as is the case in UsersProject), that method  
9 - # will overwrite our stub, so use alias_method to ensure it's our stub  
10 - # getting called.  
11 -  
12 - alias_method :path_to_repo, :fake_path_to_repo  
13 - alias_method :satellite, :fake_satellite  
14 - end  
15 -  
16 - def fake_path_to_repo 4 + def path_to_repo
17 if new_record? || path == 'newproject' 5 if new_record? || path == 'newproject'
18 # There are a couple Project specs and features that expect the Project's 6 # 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. 7 # path to be in the returned path, so let's patronize them.
@@ -25,7 +13,7 @@ module StubbedRepository @@ -25,7 +13,7 @@ module StubbedRepository
25 end 13 end
26 end 14 end
27 15
28 - def fake_satellite 16 + def satellite
29 FakeSatellite.new 17 FakeSatellite.new
30 end 18 end
31 19
@@ -40,6 +28,4 @@ module StubbedRepository @@ -40,6 +28,4 @@ module StubbedRepository
40 end 28 end
41 end 29 end
42 30
43 -[Project, ProtectedBranch, UsersProject].each do |c|  
44 - c.send(:include, StubbedRepository)  
45 -end 31 +Project.send(:include, StubbedRepository)