Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
heptapod
heptapod
Commits
4cf626442fc5
Commit
d72e6ad2
authored
Mar 01, 2016
by
tiagonbotelho
Committed by
Yorick Peterse
Mar 07, 2016
Browse files
adds tests and fixes some broken code to main language mr
parent
2aea71e82b11
Changes
3
Hide whitespace changes
Inline
Side-by-side
app/models/project.rb
View file @
4cf62644
...
...
@@ -89,7 +89,7 @@ def update_forks_visibility_level
# checks if the language main language of the project changed
before_save
:check_main_language
def
check_main_language
if
commit_count
.
changed?
if
self
.
commit_count
_
changed?
self
.
main_language
=
repository
.
main_language
end
end
...
...
@@ -955,12 +955,12 @@ def wiki
end
def
main_language
language
=
read_attribute
s
(
:main_language
)
language
=
read_attribute
(
:main_language
)
return
language
if
language
update_attributes
(
main_language:
repository
.
main_language
)
read_attribute
s
(
:main_language
)
read_attribute
(
:main_language
)
end
end
spec/models/project_spec.rb
View file @
4cf62644
...
...
@@ -560,6 +560,14 @@
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
let
(
:project
)
{
create
:project
,
visibility_level:
Gitlab
::
VisibilityLevel
::
INTERNAL
}
...
...
spec/models/repository_spec.rb
View file @
4cf62644
...
...
@@ -595,4 +595,10 @@
repository
.
after_remove_branch
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
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