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
0
Merge Requests
0
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
Kazuhiko Shiozaki
gitlab-ce
Commits
2032f4cd
Commit
2032f4cd
authored
Oct 31, 2012
by
Dmitriy Zaporozhets
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fix tests fail cause of issue with grit stub
parent
9014fb75
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
19 additions
and
12 deletions
+19
-12
features/steps/project/project_network_graph.rb
features/steps/project/project_network_graph.rb
+3
-5
features/steps/shared/paths.rb
features/steps/shared/paths.rb
+2
-3
lib/gitlab/graph_commit.rb
lib/gitlab/graph_commit.rb
+14
-4
No files found.
features/steps/project/project_network_graph.rb
View file @
2032f4cd
...
@@ -11,12 +11,10 @@ class ProjectNetworkGraph < Spinach::FeatureSteps
...
@@ -11,12 +11,10 @@ class ProjectNetworkGraph < Spinach::FeatureSteps
end
end
And
'I visit project "Shop" network page'
do
And
'I visit project "Shop" network page'
do
project
=
Project
.
find_by_name
(
"Shop"
)
# Stub GraphCommit max_size to speed up test (10 commits vs. 650)
Gitlab
::
GraphCommit
.
stub
(
max_count:
10
)
# Stub out find_all to speed this up (10 commits vs. 650)
commits
=
Grit
::
Commit
.
find_all
(
project
.
repo
,
nil
,
{
max_count:
10
})
Grit
::
Commit
.
stub
(
:find_all
).
and_return
(
commits
)
project
=
Project
.
find_by_name
(
"Shop"
)
visit
graph_project_path
(
project
)
visit
graph_project_path
(
project
)
end
end
end
end
features/steps/shared/paths.rb
View file @
2032f4cd
...
@@ -122,9 +122,8 @@ module SharedPaths
...
@@ -122,9 +122,8 @@ module SharedPaths
end
end
Given
"I visit my project's network page"
do
Given
"I visit my project's network page"
do
# Stub out find_all to speed this up (10 commits vs. 650)
# Stub GraphCommit max_size to speed up test (10 commits vs. 650)
commits
=
Grit
::
Commit
.
find_all
(
@project
.
repo
,
nil
,
{
max_count:
10
})
Gitlab
::
GraphCommit
.
stub
(
max_count:
10
)
Grit
::
Commit
.
stub
(
:find_all
).
and_return
(
commits
)
visit
graph_project_path
(
@project
)
visit
graph_project_path
(
@project
)
end
end
...
...
lib/gitlab/graph_commit.rb
View file @
2032f4cd
...
@@ -2,18 +2,18 @@ require "grit"
...
@@ -2,18 +2,18 @@ require "grit"
module
Gitlab
module
Gitlab
class
GraphCommit
class
GraphCommit
attr_accessor
:time
,
:space
attr_accessor
:time
,
:space
,
:refs
attr_accessor
:refs
include
ActionView
::
Helpers
::
TagHelper
include
ActionView
::
Helpers
::
TagHelper
def
self
.
to_graph
(
project
)
def
self
.
to_graph
(
project
)
@repo
=
project
.
repo
@repo
=
project
.
repo
commits
=
Grit
::
Commit
.
find_all
(
@repo
,
nil
,
{
max_count:
650
}).
dup
commits
=
collect_commits
(
@repo
).
dup
ref_cache
=
{}
ref_cache
=
{}
commits
.
map!
{
|
c
|
GraphCommit
.
new
(
Commit
.
new
(
c
))}
commits
.
map!
{
|
commit
|
GraphCommit
.
new
(
Commit
.
new
(
commit
))}
commits
.
each
{
|
commit
|
commit
.
add_refs
(
ref_cache
,
@repo
)
}
commits
.
each
{
|
commit
|
commit
.
add_refs
(
ref_cache
,
@repo
)
}
days
=
GraphCommit
.
index_commits
(
commits
)
days
=
GraphCommit
.
index_commits
(
commits
)
...
@@ -23,6 +23,16 @@ module Gitlab
...
@@ -23,6 +23,16 @@ module Gitlab
return
@days_json
,
@commits_json
return
@days_json
,
@commits_json
end
end
# Get commits from repository
#
def
self
.
collect_commits
repo
Grit
::
Commit
.
find_all
(
repo
,
nil
,
{
max_count:
self
.
max_count
})
end
def
self
.
max_count
@max_count
||=
650
end
# Method is adding time and space on the
# Method is adding time and space on the
# list of commits. As well as returns date list
# list of commits. As well as returns date list
# corelated with time set on commits.
# corelated with time set on commits.
...
...
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