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
Jérome Perrin
gitlab-ce
Commits
848d7b2a
Commit
848d7b2a
authored
Oct 03, 2015
by
Guilherme Garnier
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fix rubocop warnings in spec/models
parent
59d0263b
Changes
11
Hide whitespace changes
Inline
Side-by-side
Showing
11 changed files
with
14 additions
and
19 deletions
+14
-19
spec/models/broadcast_message_spec.rb
spec/models/broadcast_message_spec.rb
+2
-2
spec/models/ci/commit_spec.rb
spec/models/ci/commit_spec.rb
+2
-2
spec/models/hooks/project_hook_spec.rb
spec/models/hooks/project_hook_spec.rb
+2
-2
spec/models/hooks/service_hook_spec.rb
spec/models/hooks/service_hook_spec.rb
+0
-2
spec/models/hooks/web_hook_spec.rb
spec/models/hooks/web_hook_spec.rb
+0
-2
spec/models/milestone_spec.rb
spec/models/milestone_spec.rb
+3
-3
spec/models/project_services/gitlab_ci_service_spec.rb
spec/models/project_services/gitlab_ci_service_spec.rb
+0
-1
spec/models/project_services/hipchat_service_spec.rb
spec/models/project_services/hipchat_service_spec.rb
+2
-2
spec/models/project_spec.rb
spec/models/project_spec.rb
+1
-1
spec/models/project_wiki_spec.rb
spec/models/project_wiki_spec.rb
+1
-1
spec/models/wiki_page_spec.rb
spec/models/wiki_page_spec.rb
+1
-1
No files found.
spec/models/broadcast_message_spec.rb
View file @
848d7b2a
...
@@ -27,12 +27,12 @@ describe BroadcastMessage do
...
@@ -27,12 +27,12 @@ describe BroadcastMessage do
end
end
it
"should return nil if time not come"
do
it
"should return nil if time not come"
do
broadcast_message
=
create
(
:broadcast_message
,
starts_at:
Time
.
now
.
tomorrow
,
ends_at:
Time
.
now
+
2
.
days
)
create
(
:broadcast_message
,
starts_at:
Time
.
now
.
tomorrow
,
ends_at:
Time
.
now
+
2
.
days
)
expect
(
BroadcastMessage
.
current
).
to
be_nil
expect
(
BroadcastMessage
.
current
).
to
be_nil
end
end
it
"should return nil if time has passed"
do
it
"should return nil if time has passed"
do
broadcast_message
=
create
(
:broadcast_message
,
starts_at:
Time
.
now
-
2
.
days
,
ends_at:
Time
.
now
.
yesterday
)
create
(
:broadcast_message
,
starts_at:
Time
.
now
-
2
.
days
,
ends_at:
Time
.
now
.
yesterday
)
expect
(
BroadcastMessage
.
current
).
to
be_nil
expect
(
BroadcastMessage
.
current
).
to
be_nil
end
end
end
end
...
...
spec/models/ci/commit_spec.rb
View file @
848d7b2a
...
@@ -228,13 +228,13 @@ describe Ci::Commit do
...
@@ -228,13 +228,13 @@ describe Ci::Commit do
it
"returns finished_at of latest build"
do
it
"returns finished_at of latest build"
do
build
=
FactoryGirl
.
create
:ci_build
,
commit:
commit
,
finished_at:
Time
.
now
-
60
build
=
FactoryGirl
.
create
:ci_build
,
commit:
commit
,
finished_at:
Time
.
now
-
60
build1
=
FactoryGirl
.
create
:ci_build
,
commit:
commit
,
finished_at:
Time
.
now
-
120
FactoryGirl
.
create
:ci_build
,
commit:
commit
,
finished_at:
Time
.
now
-
120
expect
(
commit
.
finished_at
.
to_i
).
to
eq
(
build
.
finished_at
.
to_i
)
expect
(
commit
.
finished_at
.
to_i
).
to
eq
(
build
.
finished_at
.
to_i
)
end
end
it
"returns nil if there is no finished build"
do
it
"returns nil if there is no finished build"
do
build
=
FactoryGirl
.
create
:ci_not_started_build
,
commit:
commit
FactoryGirl
.
create
:ci_not_started_build
,
commit:
commit
expect
(
commit
.
finished_at
).
to
be_nil
expect
(
commit
.
finished_at
).
to
be_nil
end
end
...
...
spec/models/hooks/project_hook_spec.rb
View file @
848d7b2a
...
@@ -22,7 +22,7 @@ describe ProjectHook do
...
@@ -22,7 +22,7 @@ describe ProjectHook do
describe
'.push_hooks'
do
describe
'.push_hooks'
do
it
'should return hooks for push events only'
do
it
'should return hooks for push events only'
do
hook
=
create
(
:project_hook
,
push_events:
true
)
hook
=
create
(
:project_hook
,
push_events:
true
)
hook2
=
create
(
:project_hook
,
push_events:
false
)
create
(
:project_hook
,
push_events:
false
)
expect
(
ProjectHook
.
push_hooks
).
to
eq
([
hook
])
expect
(
ProjectHook
.
push_hooks
).
to
eq
([
hook
])
end
end
end
end
...
@@ -30,7 +30,7 @@ describe ProjectHook do
...
@@ -30,7 +30,7 @@ describe ProjectHook do
describe
'.tag_push_hooks'
do
describe
'.tag_push_hooks'
do
it
'should return hooks for tag push events only'
do
it
'should return hooks for tag push events only'
do
hook
=
create
(
:project_hook
,
tag_push_events:
true
)
hook
=
create
(
:project_hook
,
tag_push_events:
true
)
hook2
=
create
(
:project_hook
,
tag_push_events:
false
)
create
(
:project_hook
,
tag_push_events:
false
)
expect
(
ProjectHook
.
tag_push_hooks
).
to
eq
([
hook
])
expect
(
ProjectHook
.
tag_push_hooks
).
to
eq
([
hook
])
end
end
end
end
...
...
spec/models/hooks/service_hook_spec.rb
View file @
848d7b2a
...
@@ -39,8 +39,6 @@ describe ServiceHook do
...
@@ -39,8 +39,6 @@ describe ServiceHook do
end
end
it
"POSTs the data as JSON"
do
it
"POSTs the data as JSON"
do
json
=
@data
.
to_json
@service_hook
.
execute
(
@data
)
@service_hook
.
execute
(
@data
)
expect
(
WebMock
).
to
have_requested
(
:post
,
@service_hook
.
url
).
with
(
expect
(
WebMock
).
to
have_requested
(
:post
,
@service_hook
.
url
).
with
(
headers:
{
'Content-Type'
=>
'application/json'
,
'X-Gitlab-Event'
=>
'Service Hook'
}
headers:
{
'Content-Type'
=>
'application/json'
,
'X-Gitlab-Event'
=>
'Service Hook'
}
...
...
spec/models/hooks/web_hook_spec.rb
View file @
848d7b2a
...
@@ -60,8 +60,6 @@ describe ProjectHook do
...
@@ -60,8 +60,6 @@ describe ProjectHook do
end
end
it
"POSTs the data as JSON"
do
it
"POSTs the data as JSON"
do
json
=
@data
.
to_json
@project_hook
.
execute
(
@data
,
'push_hooks'
)
@project_hook
.
execute
(
@data
,
'push_hooks'
)
expect
(
WebMock
).
to
have_requested
(
:post
,
@project_hook
.
url
).
with
(
expect
(
WebMock
).
to
have_requested
(
:post
,
@project_hook
.
url
).
with
(
headers:
{
'Content-Type'
=>
'application/json'
,
'X-Gitlab-Event'
=>
'Push Hook'
}
headers:
{
'Content-Type'
=>
'application/json'
,
'X-Gitlab-Event'
=>
'Push Hook'
}
...
...
spec/models/milestone_spec.rb
View file @
848d7b2a
...
@@ -111,8 +111,8 @@ describe Milestone do
...
@@ -111,8 +111,8 @@ describe Milestone do
describe
:is_empty?
do
describe
:is_empty?
do
before
do
before
do
issue
=
create
:closed_issue
,
milestone:
milestone
create
:closed_issue
,
milestone:
milestone
merge_request
=
create
:merge_request
,
milestone:
milestone
create
:merge_request
,
milestone:
milestone
end
end
it
'Should return total count of issues and merge requests assigned to milestone'
do
it
'Should return total count of issues and merge requests assigned to milestone'
do
...
@@ -125,7 +125,7 @@ describe Milestone do
...
@@ -125,7 +125,7 @@ describe Milestone do
milestone
=
create
:milestone
milestone
=
create
:milestone
create
:closed_issue
,
milestone:
milestone
create
:closed_issue
,
milestone:
milestone
issue
=
create
:issue
create
:issue
end
end
it
'should be true if milestone active and all nested issues closed'
do
it
'should be true if milestone active and all nested issues closed'
do
...
...
spec/models/project_services/gitlab_ci_service_spec.rb
View file @
848d7b2a
...
@@ -49,7 +49,6 @@ describe GitlabCiService do
...
@@ -49,7 +49,6 @@ describe GitlabCiService do
let
(
:push_sample_data
)
{
Gitlab
::
PushDataBuilder
.
build_sample
(
project
,
user
)
}
let
(
:push_sample_data
)
{
Gitlab
::
PushDataBuilder
.
build_sample
(
project
,
user
)
}
it
"calls ci_yaml_file"
do
it
"calls ci_yaml_file"
do
service_hook
=
double
expect
(
@service
).
to
receive
(
:ci_yaml_file
).
with
(
push_sample_data
[
:checkout_sha
])
expect
(
@service
).
to
receive
(
:ci_yaml_file
).
with
(
push_sample_data
[
:checkout_sha
])
@service
.
execute
(
push_sample_data
)
@service
.
execute
(
push_sample_data
)
...
...
spec/models/project_services/hipchat_service_spec.rb
View file @
848d7b2a
...
@@ -87,7 +87,7 @@ describe HipchatService do
...
@@ -87,7 +87,7 @@ describe HipchatService do
it
"should create a push message"
do
it
"should create a push message"
do
message
=
hipchat
.
send
(
:create_push_message
,
push_sample_data
)
message
=
hipchat
.
send
(
:create_push_message
,
push_sample_data
)
obj_attr
=
push_sample_data
[
:object_attributes
]
push_sample_data
[
:object_attributes
]
branch
=
push_sample_data
[
:ref
].
gsub
(
'refs/heads/'
,
''
)
branch
=
push_sample_data
[
:ref
].
gsub
(
'refs/heads/'
,
''
)
expect
(
message
).
to
include
(
"
#{
user
.
name
}
pushed to branch "
\
expect
(
message
).
to
include
(
"
#{
user
.
name
}
pushed to branch "
\
"<a href=
\"
#{
project
.
web_url
}
/commits/
#{
branch
}
\"
>
#{
branch
}
</a> of "
\
"<a href=
\"
#{
project
.
web_url
}
/commits/
#{
branch
}
\"
>
#{
branch
}
</a> of "
\
...
@@ -107,7 +107,7 @@ describe HipchatService do
...
@@ -107,7 +107,7 @@ describe HipchatService do
it
"should create a tag push message"
do
it
"should create a tag push message"
do
message
=
hipchat
.
send
(
:create_push_message
,
push_sample_data
)
message
=
hipchat
.
send
(
:create_push_message
,
push_sample_data
)
obj_attr
=
push_sample_data
[
:object_attributes
]
push_sample_data
[
:object_attributes
]
expect
(
message
).
to
eq
(
"
#{
user
.
name
}
pushed new tag "
\
expect
(
message
).
to
eq
(
"
#{
user
.
name
}
pushed new tag "
\
"<a href=
\"
#{
project
.
web_url
}
/commits/test
\"
>test</a> to "
\
"<a href=
\"
#{
project
.
web_url
}
/commits/test
\"
>test</a> to "
\
"<a href=
\"
#{
project
.
web_url
}
\"
>
#{
project_name
}
</a>
\n
"
)
"<a href=
\"
#{
project
.
web_url
}
\"
>
#{
project_name
}
</a>
\n
"
)
...
...
spec/models/project_spec.rb
View file @
848d7b2a
...
@@ -140,7 +140,7 @@ describe Project do
...
@@ -140,7 +140,7 @@ describe Project do
describe
'last_activity_date'
do
describe
'last_activity_date'
do
it
'returns the creation date of the project\'s last event if present'
do
it
'returns the creation date of the project\'s last event if present'
do
last_activity_event
=
create
(
:event
,
project:
project
)
create
(
:event
,
project:
project
)
expect
(
project
.
last_activity_at
.
to_i
).
to
eq
(
last_event
.
created_at
.
to_i
)
expect
(
project
.
last_activity_at
.
to_i
).
to
eq
(
last_event
.
created_at
.
to_i
)
end
end
...
...
spec/models/project_wiki_spec.rb
View file @
848d7b2a
...
@@ -231,7 +231,7 @@ describe ProjectWiki do
...
@@ -231,7 +231,7 @@ describe ProjectWiki do
end
end
def
commit_details
def
commit_details
commit
=
{
name:
user
.
name
,
email:
user
.
email
,
message:
"test commit"
}
{
name:
user
.
name
,
email:
user
.
email
,
message:
"test commit"
}
end
end
def
create_page
(
name
,
content
)
def
create_page
(
name
,
content
)
...
...
spec/models/wiki_page_spec.rb
View file @
848d7b2a
...
@@ -196,7 +196,7 @@ describe WikiPage do
...
@@ -196,7 +196,7 @@ describe WikiPage do
end
end
def
commit_details
def
commit_details
commit
=
{
name:
user
.
name
,
email:
user
.
email
,
message:
"test commit"
}
{
name:
user
.
name
,
email:
user
.
email
,
message:
"test commit"
}
end
end
def
create_page
(
name
,
content
)
def
create_page
(
name
,
content
)
...
...
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