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
Boxiang Sun
gitlab-ce
Commits
3f08e4b1
Commit
3f08e4b1
authored
Oct 01, 2015
by
Zeger-Jan van de Weg
Committed by
Zeger-Jan van de Weg
Oct 15, 2015
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add specs on #license
parent
72485666
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
17 additions
and
2 deletions
+17
-2
CHANGELOG
CHANGELOG
+1
-1
app/models/repository.rb
app/models/repository.rb
+5
-1
spec/models/repository_spec.rb
spec/models/repository_spec.rb
+11
-0
No files found.
CHANGELOG
View file @
3f08e4b1
...
...
@@ -62,6 +62,7 @@ v 8.0.4
- Fix "Assign All" button on Runner admin page
- Fix search in Files
- Add full project namespace to payload of system webhooks (Ricardo Band)
- Accept COPYING as licence file (Zeger-Jan van de Weg)
v 8.0.3
- Fix URL shown in Slack notifications
...
...
@@ -82,7 +83,6 @@ v 8.0.2
- Fix Reply by email for non-UTF-8 messages.
- Add option to use StartTLS with Reply by email IMAP server.
- Allow AWS S3 Server-Side Encryption with Amazon S3-Managed Keys for backups (Paul Beattie)
- Accept COPYING as licence file (Zeger-Jan van de Weg)
v 8.0.1
- Remove git refs used internally by GitLab from network graph (Stan Hu)
...
...
app/models/repository.rb
View file @
3f08e4b1
...
...
@@ -216,7 +216,11 @@ class Repository
# If `licence`, `copying` and `copying.lesser` are found, return in the
# following order: licence, copying, copying.lesser
licenses
.
find
{
|
l
|
l
=~
/\Alicence/i
}
||
licenses
.
sort
.
first
regex
=
[
/\Alicense(\..*)?\z/i
,
/\Acopying(\..{0,3})?\z/i
,
/\Acopying.lesser/i
]
regex
.
map
do
|
re
|
licenses
.
find
{
|
l
|
l
.
name
=~
re
}
end
.
compact
.
first
end
end
...
...
spec/models/repository_spec.rb
View file @
3f08e4b1
...
...
@@ -91,4 +91,15 @@ describe Repository do
it
{
expect
(
subject
.
data
.
lines
[
2
]).
to
eq
(
" - Feature: Replace teams with group membership
\n
"
)
}
end
end
describe
"#license"
do
it
'test selection preference'
do
repository
.
send
(
:cache
).
expire
(
:license
)
TestBlob
=
Struct
.
new
(
:name
)
files
=
[
TestBlob
.
new
(
'file'
),
TestBlob
.
new
(
'license'
),
TestBlob
.
new
(
'copying'
)]
expect
(
repository
.
tree
).
to
receive
(
:blobs
).
and_return
(
files
)
expect
(
repository
.
license
.
name
).
to
eq
(
'license'
)
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