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
d72e6ad2
Commit
d72e6ad2
authored
Mar 01, 2016
by
tiagonbotelho
Committed by
Yorick Peterse
Mar 07, 2016
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
adds tests and fixes some broken code to main language mr
parent
c2c5572e
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
17 additions
and
3 deletions
+17
-3
app/models/project.rb
app/models/project.rb
+3
-3
spec/models/project_spec.rb
spec/models/project_spec.rb
+8
-0
spec/models/repository_spec.rb
spec/models/repository_spec.rb
+6
-0
No files found.
app/models/project.rb
View file @
d72e6ad2
...
@@ -89,7 +89,7 @@ class Project < ActiveRecord::Base
...
@@ -89,7 +89,7 @@ class Project < ActiveRecord::Base
# checks if the language main language of the project changed
# checks if the language main language of the project changed
before_save
:check_main_language
before_save
:check_main_language
def
check_main_language
def
check_main_language
if
commit_count
.
changed?
if
self
.
commit_count_
changed?
self
.
main_language
=
repository
.
main_language
self
.
main_language
=
repository
.
main_language
end
end
end
end
...
@@ -955,12 +955,12 @@ class Project < ActiveRecord::Base
...
@@ -955,12 +955,12 @@ class Project < ActiveRecord::Base
end
end
def
main_language
def
main_language
language
=
read_attribute
s
(
:main_language
)
language
=
read_attribute
(
:main_language
)
return
language
if
language
return
language
if
language
update_attributes
(
main_language:
repository
.
main_language
)
update_attributes
(
main_language:
repository
.
main_language
)
read_attribute
s
(
:main_language
)
read_attribute
(
:main_language
)
end
end
end
end
spec/models/project_spec.rb
View file @
d72e6ad2
...
@@ -560,6 +560,14 @@ describe Project, models: true do
...
@@ -560,6 +560,14 @@ describe Project, models: true do
end
end
end
end
describe
"#main_language"
do
let
(
:project
)
{
create
:project
}
it
'shows the main language of the project'
do
expect
(
project
.
main_language
).
to
eq
(
"Ruby"
)
end
end
describe
'#visibility_level_allowed?'
do
describe
'#visibility_level_allowed?'
do
let
(
:project
)
{
create
:project
,
visibility_level:
Gitlab
::
VisibilityLevel
::
INTERNAL
}
let
(
:project
)
{
create
:project
,
visibility_level:
Gitlab
::
VisibilityLevel
::
INTERNAL
}
...
...
spec/models/repository_spec.rb
View file @
d72e6ad2
...
@@ -595,4 +595,10 @@ describe Repository, models: true do
...
@@ -595,4 +595,10 @@ describe Repository, models: true do
repository
.
after_remove_branch
repository
.
after_remove_branch
end
end
end
end
describe
"#main_language"
do
it
'shows the main language of the project'
do
expect
(
repository
.
main_language
).
to
eq
(
"Ruby"
)
end
end
end
end
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