Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
G
gitlab-ce
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
1
Merge Requests
1
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
nexedi
gitlab-ce
Commits
1dda0848
Commit
1dda0848
authored
Aug 29, 2012
by
Robert Speicher
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Only include StubbedRepository in Project model
parent
39ff033d
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
3 additions
and
17 deletions
+3
-17
spec/support/stubbed_repository.rb
spec/support/stubbed_repository.rb
+3
-17
No files found.
spec/support/stubbed_repository.rb
View file @
1dda0848
# 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.
module
StubbedRepository
extend
ActiveSupport
::
Concern
included
do
# If a class defines the method we want to stub directly, rather than
# inheriting it from a module (as is the case in UsersProject), that method
# will overwrite our stub, so use alias_method to ensure it's our stub
# getting called.
alias_method
:path_to_repo
,
:fake_path_to_repo
alias_method
:satellite
,
:fake_satellite
end
def
fake_path_to_repo
def
path_to_repo
if
new_record?
||
path
==
'newproject'
# There are a couple Project specs and features that expect the Project's
# path to be in the returned path, so let's patronize them.
...
...
@@ -25,7 +13,7 @@ module StubbedRepository
end
end
def
fake_
satellite
def
satellite
FakeSatellite
.
new
end
...
...
@@ -40,6 +28,4 @@ module StubbedRepository
end
end
[
Project
,
ProtectedBranch
,
UsersProject
].
each
do
|
c
|
c
.
send
(
:include
,
StubbedRepository
)
end
Project
.
send
(
:include
,
StubbedRepository
)
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment