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 1 # Stubs out all Git repository access done by models so that specs can run
2 2 # against fake repositories without Grit complaining that they don't exist.
3 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 5 if new_record? || path == 'newproject'
18 6 # There are a couple Project specs and features that expect the Project's
19 7 # path to be in the returned path, so let's patronize them.
... ... @@ -25,7 +13,7 @@ module StubbedRepository
25 13 end
26 14 end
27 15  
28   - def fake_satellite
  16 + def satellite
29 17 FakeSatellite.new
30 18 end
31 19  
... ... @@ -40,6 +28,4 @@ module StubbedRepository
40 28 end
41 29 end
42 30  
43   -[Project, ProtectedBranch, UsersProject].each do |c|
44   - c.send(:include, StubbedRepository)
45   -end
  31 +Project.send(:include, StubbedRepository)
... ...