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
9c6086bc
Commit
9c6086bc
authored
Mar 22, 2015
by
Dmitriy Zaporozhets
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Refactor repository specs
parent
64891c6c
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
7 additions
and
38 deletions
+7
-38
spec/models/repository_spec.rb
spec/models/repository_spec.rb
+7
-38
No files found.
spec/models/repository_spec.rb
View file @
9c6086bc
...
...
@@ -13,47 +13,16 @@ describe Repository do
it
{
is_expected
.
not_to
include
(
'fix'
)
}
end
describe
:last_commit_for_path
do
subject
{
repository
.
last_commit_for_path
(
sample_commit
.
id
,
'.gitignore'
).
id
}
it
{
is_expected
.
to
eq
(
'c1acaa58bbcbc3eafe538cb8274ba387047b69f8'
)
}
end
context
:timestamps_by_user_log
do
before
do
Date
.
stub
(
:today
).
and_return
(
Date
.
new
(
2015
,
03
,
01
))
end
describe
'single e-mail for user'
do
let
(
:user
)
{
create
(
:user
,
email:
sample_commit
.
author_email
)
}
subject
{
repository
.
timestamps_by_user_log
(
user
)
}
describe
:tag_names_contains
do
subject
{
repository
.
tag_names_contains
(
sample_commit
.
id
)
}
it
{
is_expected
.
to
eq
([
'2014-08-06'
,
'2014-07-31'
,
'2014-07-31'
])
}
end
describe
'multiple emails for user'
do
let
(
:email_alias
)
{
create
(
:email
,
email:
another_sample_commit
.
author_email
)
}
let
(
:user
)
{
create
(
:user
,
email:
sample_commit
.
author_email
,
emails:
[
email_alias
])
}
subject
{
repository
.
timestamps_by_user_log
(
user
)
}
it
{
is_expected
.
to
eq
([
'2015-01-10'
,
'2014-08-06'
,
'2014-07-31'
,
'2014-07-31'
])
}
end
it
{
is_expected
.
to
include
(
'v1.1.0'
)
}
it
{
is_expected
.
not_to
include
(
'v1.0.0'
)
}
end
context
:commits_by_user_on_date_log
do
describe
'single e-mail for user'
do
let
(
:user
)
{
create
(
:user
,
email:
sample_commit
.
author_email
)
}
let
(
:commit1
)
{
'0ed8c6c6752e8c6ea63e7b92a517bf5ac1209c80'
}
let
(
:commit2
)
{
'7d3b0f7cff5f37573aea97cebfd5692ea1689924'
}
subject
{
repository
.
commits_by_user_on_date_log
(
user
,
Date
.
new
(
2014
,
07
,
31
))
}
describe
:last_commit_for_path
do
subject
{
repository
.
last_commit_for_path
(
sample_commit
.
id
,
'.gitignore'
).
id
}
it
'contains the exepected commits'
do
expect
(
subject
.
flatten
.
map
(
&
:id
)).
to
eq
([
commit1
,
commit2
])
end
end
it
{
is_expected
.
to
eq
(
'c1acaa58bbcbc3eafe538cb8274ba387047b69f8'
)
}
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