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
b87ca750
Commit
b87ca750
authored
Sep 15, 2015
by
Valery Sizov
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fix specs. Stage 7
parent
88b3195e
Changes
23
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
23 changed files
with
406 additions
and
402 deletions
+406
-402
app/models/project_services/ci/hip_chat_message.rb
app/models/project_services/ci/hip_chat_message.rb
+1
-1
app/models/project_services/ci/slack_message.rb
app/models/project_services/ci/slack_message.rb
+2
-2
spec/features/ci/admin/builds_spec.rb
spec/features/ci/admin/builds_spec.rb
+20
-20
spec/features/ci/admin/events_spec.rb
spec/features/ci/admin/events_spec.rb
+2
-2
spec/features/ci/admin/projects_spec.rb
spec/features/ci/admin/projects_spec.rb
+3
-3
spec/features/ci/admin/runners_spec.rb
spec/features/ci/admin/runners_spec.rb
+11
-11
spec/features/ci/events_spec.rb
spec/features/ci/events_spec.rb
+2
-2
spec/features/ci/lint_spec.rb
spec/features/ci/lint_spec.rb
+2
-2
spec/features/ci/runners_spec.rb
spec/features/ci/runners_spec.rb
+14
-14
spec/features/ci/triggers_spec.rb
spec/features/ci/triggers_spec.rb
+3
-3
spec/features/ci/variables_spec.rb
spec/features/ci/variables_spec.rb
+2
-2
spec/lib/ci/charts_spec.rb
spec/lib/ci/charts_spec.rb
+5
-5
spec/lib/ci/gitlab_ci_yaml_processor_spec.rb
spec/lib/ci/gitlab_ci_yaml_processor_spec.rb
+302
-300
spec/models/ci/mail_service_spec.rb
spec/models/ci/mail_service_spec.rb
+1
-1
spec/models/ci/project_services/slack_message_spec.rb
spec/models/ci/project_services/slack_message_spec.rb
+2
-2
spec/models/ci/project_services/slack_service_spec.rb
spec/models/ci/project_services/slack_service_spec.rb
+2
-2
spec/models/ci/runner_spec.rb
spec/models/ci/runner_spec.rb
+2
-2
spec/models/ci/service_spec.rb
spec/models/ci/service_spec.rb
+1
-1
spec/services/ci/create_project_service_spec.rb
spec/services/ci/create_project_service_spec.rb
+2
-4
spec/services/ci/create_trigger_request_service_spec.rb
spec/services/ci/create_trigger_request_service_spec.rb
+10
-10
spec/services/ci/event_service_spec.rb
spec/services/ci/event_service_spec.rb
+7
-7
spec/services/ci/web_hook_service_spec.rb
spec/services/ci/web_hook_service_spec.rb
+6
-6
spec/support/login_helpers.rb
spec/support/login_helpers.rb
+4
-0
No files found.
app/models/project_services/ci/hip_chat_message.rb
View file @
b87ca750
...
@@ -11,7 +11,7 @@ module Ci
...
@@ -11,7 +11,7 @@ module Ci
lines
.
push
(
"<a href=
\"
#{
Ci
::
RoutesHelper
.
ci_project_url
(
project
)
}
\"
>
#{
project
.
name
}
</a> - "
)
lines
.
push
(
"<a href=
\"
#{
Ci
::
RoutesHelper
.
ci_project_url
(
project
)
}
\"
>
#{
project
.
name
}
</a> - "
)
if
commit
.
matrix?
if
commit
.
matrix?
lines
.
push
(
"<a href=
\"
#{
Ci
::
RoutesHelper
.
ci_project_ref_commit_url
(
project
,
commit
.
ref
,
commit
.
sha
)
}
\"
>Commit #
#{
commit
.
id
}
</a></br>"
)
lines
.
push
(
"<a href=
\"
#{
Ci
::
RoutesHelper
.
ci_project_ref_commit
s
_url
(
project
,
commit
.
ref
,
commit
.
sha
)
}
\"
>Commit #
#{
commit
.
id
}
</a></br>"
)
else
else
first_build
=
commit
.
builds_without_retry
.
first
first_build
=
commit
.
builds_without_retry
.
first
lines
.
push
(
"<a href=
\"
#{
Ci
::
RoutesHelper
.
ci_project_build_url
(
project
,
first_build
)
}
\"
>Build '
#{
first_build
.
name
}
' #
#{
first_build
.
id
}
</a></br>"
)
lines
.
push
(
"<a href=
\"
#{
Ci
::
RoutesHelper
.
ci_project_build_url
(
project
,
first_build
)
}
\"
>Build '
#{
first_build
.
name
}
' #
#{
first_build
.
id
}
</a></br>"
)
...
...
app/models/project_services/ci/slack_message.rb
View file @
b87ca750
...
@@ -46,10 +46,10 @@ module Ci
...
@@ -46,10 +46,10 @@ module Ci
def
attachment_message
def
attachment_message
out
=
"<
#{
Ci
::
RoutesHelper
.
ci_project_url
(
project
)
}
|
#{
project_name
}
>: "
out
=
"<
#{
Ci
::
RoutesHelper
.
ci_project_url
(
project
)
}
|
#{
project_name
}
>: "
if
commit
.
matrix?
if
commit
.
matrix?
out
<<
"Commit <
#{
Ci
::
RoutesHelper
.
ci_project_ref_commit_url
(
project
,
commit
.
ref
,
commit
.
sha
)
}
|
\#
#{
commit
.
id
}
> "
out
<<
"Commit <
#{
Ci
::
RoutesHelper
.
ci_project_ref_commit
s
_url
(
project
,
commit
.
ref
,
commit
.
sha
)
}
|
\#
#{
commit
.
id
}
> "
else
else
build
=
commit
.
builds_without_retry
.
first
build
=
commit
.
builds_without_retry
.
first
out
<<
"Build <
#{
Ci
::
RoutesHelper
.
ci_project_build_
url
(
project
,
build
)
}
|
\#
#{
build
.
id
}
> "
out
<<
"Build <
#{
Ci
::
RoutesHelper
.
ci_project_build_
path
(
project
,
build
)
}
|
\#
#{
build
.
id
}
> "
end
end
out
<<
"(<
#{
commit_sha_link
}
|
#{
commit
.
short_sha
}
>) "
out
<<
"(<
#{
commit_sha_link
}
|
#{
commit
.
short_sha
}
>) "
out
<<
"of <
#{
commit_ref_link
}
|
#{
commit
.
ref
}
> "
out
<<
"of <
#{
commit_ref_link
}
|
#{
commit
.
ref
}
> "
...
...
spec/features/ci/admin/builds_spec.rb
View file @
b87ca750
require
'spec_helper'
require
'spec_helper'
describe
"Admin Builds"
do
describe
"Admin Builds"
do
let
(
:project
)
{
FactoryGirl
.
create
:project
}
let
(
:project
)
{
FactoryGirl
.
create
:
ci_
project
}
let
(
:commit
)
{
FactoryGirl
.
create
:commit
,
project:
project
}
let
(
:commit
)
{
FactoryGirl
.
create
:c
i_c
ommit
,
project:
project
}
let
(
:build
)
{
FactoryGirl
.
create
:build
,
commit:
commit
}
let
(
:build
)
{
FactoryGirl
.
create
:
ci_
build
,
commit:
commit
}
before
do
before
do
skip_admin_auth
skip_
ci_
admin_auth
login_as
:user
login_as
:user
end
end
describe
"GET /admin/builds"
do
describe
"GET /admin/builds"
do
before
do
before
do
build
build
visit
admin_builds_path
visit
ci_
admin_builds_path
end
end
it
{
expect
(
page
).
to
have_content
"All builds"
}
it
{
expect
(
page
).
to
have_content
"All builds"
}
...
@@ -22,23 +22,23 @@ describe "Admin Builds" do
...
@@ -22,23 +22,23 @@ describe "Admin Builds" do
describe
"Tabs"
do
describe
"Tabs"
do
it
"shows all builds"
do
it
"shows all builds"
do
build
=
FactoryGirl
.
create
:build
,
commit:
commit
,
status:
"pending"
build
=
FactoryGirl
.
create
:
ci_
build
,
commit:
commit
,
status:
"pending"
build1
=
FactoryGirl
.
create
:build
,
commit:
commit
,
status:
"running"
build1
=
FactoryGirl
.
create
:
ci_
build
,
commit:
commit
,
status:
"running"
build2
=
FactoryGirl
.
create
:build
,
commit:
commit
,
status:
"success"
build2
=
FactoryGirl
.
create
:
ci_
build
,
commit:
commit
,
status:
"success"
build3
=
FactoryGirl
.
create
:build
,
commit:
commit
,
status:
"failed"
build3
=
FactoryGirl
.
create
:
ci_
build
,
commit:
commit
,
status:
"failed"
visit
admin_builds_path
visit
ci_
admin_builds_path
expect
(
page
.
all
(
".build-link"
).
size
).
to
eq
(
4
)
expect
(
page
.
all
(
".build-link"
).
size
).
to
eq
(
4
)
end
end
it
"shows pending builds"
do
it
"shows pending builds"
do
build
=
FactoryGirl
.
create
:build
,
commit:
commit
,
status:
"pending"
build
=
FactoryGirl
.
create
:
ci_
build
,
commit:
commit
,
status:
"pending"
build1
=
FactoryGirl
.
create
:build
,
commit:
commit
,
status:
"running"
build1
=
FactoryGirl
.
create
:
ci_
build
,
commit:
commit
,
status:
"running"
build2
=
FactoryGirl
.
create
:build
,
commit:
commit
,
status:
"success"
build2
=
FactoryGirl
.
create
:
ci_
build
,
commit:
commit
,
status:
"success"
build3
=
FactoryGirl
.
create
:build
,
commit:
commit
,
status:
"failed"
build3
=
FactoryGirl
.
create
:
ci_
build
,
commit:
commit
,
status:
"failed"
visit
admin_builds_path
visit
ci_
admin_builds_path
within
".nav.nav-tabs"
do
within
".nav.nav-tabs"
do
click_on
"Pending"
click_on
"Pending"
...
@@ -51,12 +51,12 @@ describe "Admin Builds" do
...
@@ -51,12 +51,12 @@ describe "Admin Builds" do
end
end
it
"shows running builds"
do
it
"shows running builds"
do
build
=
FactoryGirl
.
create
:build
,
commit:
commit
,
status:
"pending"
build
=
FactoryGirl
.
create
:
ci_
build
,
commit:
commit
,
status:
"pending"
build1
=
FactoryGirl
.
create
:build
,
commit:
commit
,
status:
"running"
build1
=
FactoryGirl
.
create
:
ci_
build
,
commit:
commit
,
status:
"running"
build2
=
FactoryGirl
.
create
:build
,
commit:
commit
,
status:
"success"
build2
=
FactoryGirl
.
create
:
ci_
build
,
commit:
commit
,
status:
"success"
build3
=
FactoryGirl
.
create
:build
,
commit:
commit
,
status:
"failed"
build3
=
FactoryGirl
.
create
:
ci_
build
,
commit:
commit
,
status:
"failed"
visit
admin_builds_path
visit
ci_
admin_builds_path
within
".nav.nav-tabs"
do
within
".nav.nav-tabs"
do
click_on
"Running"
click_on
"Running"
...
...
spec/features/ci/admin/events_spec.rb
View file @
b87ca750
...
@@ -4,14 +4,14 @@ describe "Admin Events" do
...
@@ -4,14 +4,14 @@ describe "Admin Events" do
let
(
:event
)
{
FactoryGirl
.
create
:admin_event
}
let
(
:event
)
{
FactoryGirl
.
create
:admin_event
}
before
do
before
do
skip_admin_auth
skip_
ci_
admin_auth
login_as
:user
login_as
:user
end
end
describe
"GET /admin/events"
do
describe
"GET /admin/events"
do
before
do
before
do
event
event
visit
admin_events_path
visit
ci_
admin_events_path
end
end
it
{
expect
(
page
).
to
have_content
"Events"
}
it
{
expect
(
page
).
to
have_content
"Events"
}
...
...
spec/features/ci/admin/projects_spec.rb
View file @
b87ca750
require
'spec_helper'
require
'spec_helper'
describe
"Admin Projects"
do
describe
"Admin Projects"
do
let
(
:project
)
{
FactoryGirl
.
create
:project
}
let
(
:project
)
{
FactoryGirl
.
create
:
ci_
project
}
before
do
before
do
skip_admin_auth
skip_
ci_
admin_auth
login_as
:user
login_as
:user
end
end
describe
"GET /admin/projects"
do
describe
"GET /admin/projects"
do
before
do
before
do
project
project
visit
admin_projects_path
visit
ci_
admin_projects_path
end
end
it
{
expect
(
page
).
to
have_content
"Projects"
}
it
{
expect
(
page
).
to
have_content
"Projects"
}
...
...
spec/features/ci/admin/runners_spec.rb
View file @
b87ca750
...
@@ -2,16 +2,16 @@ require 'spec_helper'
...
@@ -2,16 +2,16 @@ require 'spec_helper'
describe
"Admin Runners"
do
describe
"Admin Runners"
do
before
do
before
do
skip_admin_auth
skip_
ci_
admin_auth
login_as
:user
login_as
:user
end
end
describe
"Runners page"
do
describe
"Runners page"
do
before
do
before
do
runner
=
FactoryGirl
.
create
(
:runner
)
runner
=
FactoryGirl
.
create
(
:
ci_
runner
)
commit
=
FactoryGirl
.
create
(
:commit
)
commit
=
FactoryGirl
.
create
(
:c
i_c
ommit
)
FactoryGirl
.
create
(
:build
,
commit:
commit
,
runner_id:
runner
.
id
)
FactoryGirl
.
create
(
:
ci_
build
,
commit:
commit
,
runner_id:
runner
.
id
)
visit
admin_runners_path
visit
ci_
admin_runners_path
end
end
it
{
page
.
has_text?
"Manage Runners"
}
it
{
page
.
has_text?
"Manage Runners"
}
...
@@ -20,8 +20,8 @@ describe "Admin Runners" do
...
@@ -20,8 +20,8 @@ describe "Admin Runners" do
describe
'search'
do
describe
'search'
do
before
do
before
do
FactoryGirl
.
create
:runner
,
description:
'foo'
FactoryGirl
.
create
:
ci_
runner
,
description:
'foo'
FactoryGirl
.
create
:runner
,
description:
'bar'
FactoryGirl
.
create
:
ci_
runner
,
description:
'bar'
fill_in
'search'
,
with:
'foo'
fill_in
'search'
,
with:
'foo'
click_button
'Search'
click_button
'Search'
...
@@ -33,12 +33,12 @@ describe "Admin Runners" do
...
@@ -33,12 +33,12 @@ describe "Admin Runners" do
end
end
describe
"Runner show page"
do
describe
"Runner show page"
do
let
(
:runner
)
{
FactoryGirl
.
create
:runner
}
let
(
:runner
)
{
FactoryGirl
.
create
:
ci_
runner
}
before
do
before
do
FactoryGirl
.
create
(
:project
,
name:
"foo"
)
FactoryGirl
.
create
(
:
ci_
project
,
name:
"foo"
)
FactoryGirl
.
create
(
:project
,
name:
"bar"
)
FactoryGirl
.
create
(
:
ci_
project
,
name:
"bar"
)
visit
admin_runner_path
(
runner
)
visit
ci_
admin_runner_path
(
runner
)
end
end
describe
'runner info'
do
describe
'runner info'
do
...
...
spec/features/ci/events_spec.rb
View file @
b87ca750
require
'spec_helper'
require
'spec_helper'
describe
"Events"
do
describe
"Events"
do
let
(
:project
)
{
FactoryGirl
.
create
:project
}
let
(
:project
)
{
FactoryGirl
.
create
:
ci_
project
}
let
(
:event
)
{
FactoryGirl
.
create
:admin_event
,
project:
project
}
let
(
:event
)
{
FactoryGirl
.
create
:admin_event
,
project:
project
}
before
do
before
do
...
@@ -11,7 +11,7 @@ describe "Events" do
...
@@ -11,7 +11,7 @@ describe "Events" do
describe
"GET /project/:id/events"
do
describe
"GET /project/:id/events"
do
before
do
before
do
event
event
visit
project_events_path
(
project
)
visit
ci_
project_events_path
(
project
)
end
end
it
{
expect
(
page
).
to
have_content
"Events"
}
it
{
expect
(
page
).
to
have_content
"Events"
}
...
...
spec/features/ci/lint_spec.rb
View file @
b87ca750
...
@@ -7,7 +7,7 @@ describe "Lint" do
...
@@ -7,7 +7,7 @@ describe "Lint" do
it
"Yaml parsing"
,
js:
true
do
it
"Yaml parsing"
,
js:
true
do
content
=
File
.
read
(
Rails
.
root
.
join
(
'spec/support/gitlab_stubs/gitlab_ci.yml'
))
content
=
File
.
read
(
Rails
.
root
.
join
(
'spec/support/gitlab_stubs/gitlab_ci.yml'
))
visit
lint_path
visit
ci_
lint_path
fill_in
"content"
,
with:
content
fill_in
"content"
,
with:
content
click_on
"Validate"
click_on
"Validate"
within
"table"
do
within
"table"
do
...
@@ -19,7 +19,7 @@ describe "Lint" do
...
@@ -19,7 +19,7 @@ describe "Lint" do
end
end
it
"Yaml parsing with error"
,
js:
true
do
it
"Yaml parsing with error"
,
js:
true
do
visit
lint_path
visit
ci_
lint_path
fill_in
"content"
,
with:
""
fill_in
"content"
,
with:
""
click_on
"Validate"
click_on
"Validate"
expect
(
page
).
to
have_content
(
"Status: syntax is incorrect"
)
expect
(
page
).
to
have_content
(
"Status: syntax is incorrect"
)
...
...
spec/features/ci/runners_spec.rb
View file @
b87ca750
...
@@ -7,8 +7,8 @@ describe "Runners" do
...
@@ -7,8 +7,8 @@ describe "Runners" do
describe
"specific runners"
do
describe
"specific runners"
do
before
do
before
do
@project
=
FactoryGirl
.
create
:project
@project
=
FactoryGirl
.
create
:
ci_
project
@project2
=
FactoryGirl
.
create
:project
@project2
=
FactoryGirl
.
create
:
ci_
project
stub_js_gitlab_calls
stub_js_gitlab_calls
# all projects should be authorized for user
# all projects should be authorized for user
...
@@ -17,22 +17,22 @@ describe "Runners" do
...
@@ -17,22 +17,22 @@ describe "Runners" do
OpenStruct
.
new
({
id:
@project2
.
gitlab_id
})
OpenStruct
.
new
({
id:
@project2
.
gitlab_id
})
])
])
@shared_runner
=
FactoryGirl
.
create
:shared_runner
@shared_runner
=
FactoryGirl
.
create
:
ci_
shared_runner
@specific_runner
=
FactoryGirl
.
create
:specific_runner
@specific_runner
=
FactoryGirl
.
create
:
ci_
specific_runner
@specific_runner2
=
FactoryGirl
.
create
:specific_runner
@specific_runner2
=
FactoryGirl
.
create
:
ci_
specific_runner
@project
.
runners
<<
@specific_runner
@project
.
runners
<<
@specific_runner
@project2
.
runners
<<
@specific_runner2
@project2
.
runners
<<
@specific_runner2
end
end
it
"places runners in right places"
do
it
"places runners in right places"
do
visit
project_runners_path
(
@project
)
visit
ci_
project_runners_path
(
@project
)
expect
(
page
.
find
(
".available-specific-runners"
)).
to
have_content
(
@specific_runner2
.
display_name
)
expect
(
page
.
find
(
".available-specific-runners"
)).
to
have_content
(
@specific_runner2
.
display_name
)
expect
(
page
.
find
(
".activated-specific-runners"
)).
to
have_content
(
@specific_runner
.
display_name
)
expect
(
page
.
find
(
".activated-specific-runners"
)).
to
have_content
(
@specific_runner
.
display_name
)
expect
(
page
.
find
(
".available-shared-runners"
)).
to
have_content
(
@shared_runner
.
display_name
)
expect
(
page
.
find
(
".available-shared-runners"
)).
to
have_content
(
@shared_runner
.
display_name
)
end
end
it
"enables specific runner for project"
do
it
"enables specific runner for project"
do
visit
project_runners_path
(
@project
)
visit
ci_
project_runners_path
(
@project
)
within
".available-specific-runners"
do
within
".available-specific-runners"
do
click_on
"Enable for this project"
click_on
"Enable for this project"
...
@@ -44,7 +44,7 @@ describe "Runners" do
...
@@ -44,7 +44,7 @@ describe "Runners" do
it
"disables specific runner for project"
do
it
"disables specific runner for project"
do
@project2
.
runners
<<
@specific_runner
@project2
.
runners
<<
@specific_runner
visit
project_runners_path
(
@project
)
visit
ci_
project_runners_path
(
@project
)
within
".activated-specific-runners"
do
within
".activated-specific-runners"
do
click_on
"Disable for this project"
click_on
"Disable for this project"
...
@@ -54,7 +54,7 @@ describe "Runners" do
...
@@ -54,7 +54,7 @@ describe "Runners" do
end
end
it
"removes specific runner for project if this is last project for that runners"
do
it
"removes specific runner for project if this is last project for that runners"
do
visit
project_runners_path
(
@project
)
visit
ci_
project_runners_path
(
@project
)
within
".activated-specific-runners"
do
within
".activated-specific-runners"
do
click_on
"Remove runner"
click_on
"Remove runner"
...
@@ -66,12 +66,12 @@ describe "Runners" do
...
@@ -66,12 +66,12 @@ describe "Runners" do
describe
"shared runners"
do
describe
"shared runners"
do
before
do
before
do
@project
=
FactoryGirl
.
create
:project
@project
=
FactoryGirl
.
create
:
ci_
project
stub_js_gitlab_calls
stub_js_gitlab_calls
end
end
it
"enables shared runners"
do
it
"enables shared runners"
do
visit
project_runners_path
(
@project
)
visit
ci_
project_runners_path
(
@project
)
click_on
"Enable shared runners"
click_on
"Enable shared runners"
...
@@ -81,14 +81,14 @@ describe "Runners" do
...
@@ -81,14 +81,14 @@ describe "Runners" do
describe
"show page"
do
describe
"show page"
do
before
do
before
do
@project
=
FactoryGirl
.
create
:project
@project
=
FactoryGirl
.
create
:
ci_
project
stub_js_gitlab_calls
stub_js_gitlab_calls
@specific_runner
=
FactoryGirl
.
create
:specific_runner
@specific_runner
=
FactoryGirl
.
create
:
ci_
specific_runner
@project
.
runners
<<
@specific_runner
@project
.
runners
<<
@specific_runner
end
end
it
"shows runner information"
do
it
"shows runner information"
do
visit
project_runners_path
(
@project
)
visit
ci_
project_runners_path
(
@project
)
click_on
@specific_runner
.
short_sha
click_on
@specific_runner
.
short_sha
...
...
spec/features/ci/triggers_spec.rb
View file @
b87ca750
require
'spec_helper'
require
'spec_helper'
describe
'
Variable
s'
do
describe
'
Trigger
s'
do
before
do
before
do
login_as
:user
login_as
:user
@project
=
FactoryGirl
.
create
:project
@project
=
FactoryGirl
.
create
:
ci_
project
stub_js_gitlab_calls
stub_js_gitlab_calls
visit
project_triggers_path
(
@project
)
visit
ci_
project_triggers_path
(
@project
)
end
end
context
'create a trigger'
do
context
'create a trigger'
do
...
...
spec/features/ci/variables_spec.rb
View file @
b87ca750
...
@@ -7,12 +7,12 @@ describe "Variables" do
...
@@ -7,12 +7,12 @@ describe "Variables" do
describe
"specific runners"
do
describe
"specific runners"
do
before
do
before
do
@project
=
FactoryGirl
.
create
:project
@project
=
FactoryGirl
.
create
:
ci_
project
stub_js_gitlab_calls
stub_js_gitlab_calls
end
end
it
"creates variable"
,
js:
true
do
it
"creates variable"
,
js:
true
do
visit
project_variables_path
(
@project
)
visit
ci_
project_variables_path
(
@project
)
click_on
"Add a variable"
click_on
"Add a variable"
fill_in
"Key"
,
with:
"SECRET_KEY"
fill_in
"Key"
,
with:
"SECRET_KEY"
fill_in
"Value"
,
with:
"SECRET_VALUE"
fill_in
"Value"
,
with:
"SECRET_VALUE"
...
...
spec/lib/ci/charts_spec.rb
View file @
b87ca750
...
@@ -4,14 +4,14 @@ describe "Charts" do
...
@@ -4,14 +4,14 @@ describe "Charts" do
context
"build_times"
do
context
"build_times"
do
before
do
before
do
@project
=
FactoryGirl
.
create
(
:project
)
@project
=
FactoryGirl
.
create
(
:
ci_
project
)
@commit
=
FactoryGirl
.
create
(
:commit
,
project:
@project
)
@commit
=
FactoryGirl
.
create
(
:c
i_c
ommit
,
project:
@project
)
FactoryGirl
.
create
(
:build
,
commit:
@commit
)
FactoryGirl
.
create
(
:
ci_
build
,
commit:
@commit
)
end
end
it
'should return build times in minutes'
do
it
'should return build times in minutes'
do
chart
=
Charts
::
BuildTime
.
new
(
@project
)
chart
=
C
i
::
C
harts
::
BuildTime
.
new
(
@project
)
chart
.
build_times
.
should
==
[
2
]
expect
(
chart
.
build_times
).
to
eq
([
2
])
end
end
end
end
end
end
spec/lib/ci/gitlab_ci_yaml_processor_spec.rb
View file @
b87ca750
This diff is collapsed.
Click to expand it.
spec/models/ci/mail_service_spec.rb
View file @
b87ca750
...
@@ -169,7 +169,7 @@ describe Ci::MailService do
...
@@ -169,7 +169,7 @@ describe Ci::MailService do
end
end
it
do
it
do
Build
.
retry
(
build
)
Ci
::
Build
.
retry
(
build
)
should_email
(
commit
.
git_author_email
)
should_email
(
commit
.
git_author_email
)
should_email
(
"jeroen@example.com"
)
should_email
(
"jeroen@example.com"
)
mail
.
execute
(
build
)
if
mail
.
can_execute?
(
build
)
mail
.
execute
(
build
)
if
mail
.
can_execute?
(
build
)
...
...
spec/models/ci/project_services/slack_message_spec.rb
View file @
b87ca750
require
'spec_helper'
require
'spec_helper'
describe
Ci
::
SlackMessage
do
describe
Ci
::
SlackMessage
do
subject
{
SlackMessage
.
new
(
commit
)
}
subject
{
Ci
::
SlackMessage
.
new
(
commit
)
}
let
(
:project
)
{
FactoryGirl
.
create
:ci_project
}
let
(
:project
)
{
FactoryGirl
.
create
:ci_project
}
...
@@ -43,7 +43,7 @@ describe Ci::SlackMessage do
...
@@ -43,7 +43,7 @@ describe Ci::SlackMessage do
end
end
context
"Several builds"
do
context
"Several builds"
do
let
(
:commit
)
{
FactoryGirl
.
create
(
:commit_with_two_jobs
,
project:
project
)
}
let
(
:commit
)
{
FactoryGirl
.
create
(
:c
i_c
ommit_with_two_jobs
,
project:
project
)
}
context
'when all matrix builds succeeded'
do
context
'when all matrix builds succeeded'
do
let
(
:color
)
{
'good'
}
let
(
:color
)
{
'good'
}
...
...
spec/models/ci/project_services/slack_service_spec.rb
View file @
b87ca750
...
@@ -30,7 +30,7 @@ describe Ci::SlackService do
...
@@ -30,7 +30,7 @@ describe Ci::SlackService do
end
end
describe
"Execute"
do
describe
"Execute"
do
let
(
:slack
)
{
SlackService
.
new
}
let
(
:slack
)
{
Ci
::
SlackService
.
new
}
let
(
:project
)
{
FactoryGirl
.
create
:ci_project
}
let
(
:project
)
{
FactoryGirl
.
create
:ci_project
}
let
(
:commit
)
{
FactoryGirl
.
create
:ci_commit
,
project:
project
}
let
(
:commit
)
{
FactoryGirl
.
create
:ci_commit
,
project:
project
}
let
(
:build
)
{
FactoryGirl
.
create
:ci_build
,
commit:
commit
,
status:
'failed'
}
let
(
:build
)
{
FactoryGirl
.
create
:ci_build
,
commit:
commit
,
status:
'failed'
}
...
@@ -50,7 +50,7 @@ describe Ci::SlackService do
...
@@ -50,7 +50,7 @@ describe Ci::SlackService do
it
"should call Slack API"
do
it
"should call Slack API"
do
slack
.
execute
(
build
)
slack
.
execute
(
build
)
SlackNotifierWorker
.
drain
Ci
::
SlackNotifierWorker
.
drain
expect
(
WebMock
).
to
have_requested
(
:post
,
webhook_url
).
once
expect
(
WebMock
).
to
have_requested
(
:post
,
webhook_url
).
once
end
end
...
...
spec/models/ci/runner_spec.rb
View file @
b87ca750
...
@@ -22,7 +22,7 @@ require 'spec_helper'
...
@@ -22,7 +22,7 @@ require 'spec_helper'
describe
Ci
::
Runner
do
describe
Ci
::
Runner
do
describe
'#display_name'
do
describe
'#display_name'
do
it
'should return the description if it has a value'
do
it
'should return the description if it has a value'
do
runner
=
FactoryGirl
.
build
(
:runner
,
description:
'Linux/Ruby-1.9.3-p448'
)
runner
=
FactoryGirl
.
build
(
:
ci_
runner
,
description:
'Linux/Ruby-1.9.3-p448'
)
expect
(
runner
.
display_name
).
to
eq
'Linux/Ruby-1.9.3-p448'
expect
(
runner
.
display_name
).
to
eq
'Linux/Ruby-1.9.3-p448'
end
end
...
@@ -32,7 +32,7 @@ describe Ci::Runner do
...
@@ -32,7 +32,7 @@ describe Ci::Runner do
end
end
it
'should return the token if the description is an empty string'
do
it
'should return the token if the description is an empty string'
do
runner
=
FactoryGirl
.
build
(
:runner
,
description:
''
)
runner
=
FactoryGirl
.
build
(
:
ci_
runner
,
description:
''
)
expect
(
runner
.
display_name
).
to
eq
runner
.
token
expect
(
runner
.
display_name
).
to
eq
runner
.
token
end
end
end
end
...
...
spec/models/ci/service_spec.rb
View file @
b87ca750
...
@@ -25,7 +25,7 @@ describe Ci::Service do
...
@@ -25,7 +25,7 @@ describe Ci::Service do
describe
"Test Button"
do
describe
"Test Button"
do
before
do
before
do
@service
=
Service
.
new
@service
=
Ci
::
Service
.
new
end
end
describe
"Testable"
do
describe
"Testable"
do
...
...
spec/services/ci/create_project_service_spec.rb
View file @
b87ca750
require
'spec_helper'
require
'spec_helper'
describe
Ci
::
CreateProjectService
do
describe
Ci
::
CreateProjectService
do
let
(
:service
)
{
CreateProjectService
.
new
}
let
(
:service
)
{
C
i
::
C
reateProjectService
.
new
}
let
(
:current_user
)
{
double
.
as_null_object
}
let
(
:current_user
)
{
double
.
as_null_object
}
let
(
:project_dump
)
{
YAML
.
load
File
.
read
(
Rails
.
root
.
join
(
'spec/support/gitlab_stubs/raw_project.yml'
))
}
let
(
:project_dump
)
{
YAML
.
load
File
.
read
(
Rails
.
root
.
join
(
'spec/support/gitlab_stubs/raw_project.yml'
))
}
before
{
allow_any_instance_of
(
Network
).
to
receive_messages
(
enable_ci:
true
)
}
describe
:execute
do
describe
:execute
do
context
'valid params'
do
context
'valid params'
do
let
(
:project
)
{
service
.
execute
(
current_user
,
project_dump
,
'http://localhost/projects/:project_id'
)
}
let
(
:project
)
{
service
.
execute
(
current_user
,
project_dump
,
'http://localhost/projects/:project_id'
)
}
...
@@ -23,7 +21,7 @@ describe Ci::CreateProjectService do
...
@@ -23,7 +21,7 @@ describe Ci::CreateProjectService do
context
"forking"
do
context
"forking"
do
it
"uses project as a template for settings and jobs"
do
it
"uses project as a template for settings and jobs"
do
origin_project
=
FactoryGirl
.
create
(
:project
)
origin_project
=
FactoryGirl
.
create
(
:
ci_
project
)
origin_project
.
shared_runners_enabled
=
true
origin_project
.
shared_runners_enabled
=
true
origin_project
.
public
=
true
origin_project
.
public
=
true
origin_project
.
allow_git_fetch
=
true
origin_project
.
allow_git_fetch
=
true
...
...
spec/services/ci/create_trigger_request_service_spec.rb
View file @
b87ca750
require
'spec_helper'
require
'spec_helper'
describe
Ci
::
CreateTriggerRequestService
do
describe
Ci
::
CreateTriggerRequestService
do
let
(
:service
)
{
CreateTriggerRequestService
.
new
}
let
(
:service
)
{
C
i
::
C
reateTriggerRequestService
.
new
}
let
(
:project
)
{
FactoryGirl
.
create
:project
}
let
(
:project
)
{
FactoryGirl
.
create
:
ci_
project
}
let
(
:trigger
)
{
FactoryGirl
.
create
:trigger
,
project:
project
}
let
(
:trigger
)
{
FactoryGirl
.
create
:
ci_
trigger
,
project:
project
}
describe
:execute
do
describe
:execute
do
context
'valid params'
do
context
'valid params'
do
subject
{
service
.
execute
(
project
,
trigger
,
'master'
)
}
subject
{
service
.
execute
(
project
,
trigger
,
'master'
)
}
before
do
before
do
@commit
=
FactoryGirl
.
create
:commit
,
project:
project
@commit
=
FactoryGirl
.
create
:c
i_c
ommit
,
project:
project
end
end
it
{
expect
(
subject
).
to
be_kind_of
(
TriggerRequest
)
}
it
{
expect
(
subject
).
to
be_kind_of
(
Ci
::
TriggerRequest
)
}
it
{
expect
(
subject
.
commit
).
to
eq
(
@commit
)
}
it
{
expect
(
subject
.
commit
).
to
eq
(
@commit
)
}
end
end
...
@@ -27,7 +27,7 @@ describe Ci::CreateTriggerRequestService do
...
@@ -27,7 +27,7 @@ describe Ci::CreateTriggerRequestService do
subject
{
service
.
execute
(
project
,
trigger
,
'master'
)
}
subject
{
service
.
execute
(
project
,
trigger
,
'master'
)
}
before
do
before
do
FactoryGirl
.
create
:commit_without_jobs
,
project:
project
FactoryGirl
.
create
:c
i_c
ommit_without_jobs
,
project:
project
end
end
it
{
expect
(
subject
).
to
be_nil
}
it
{
expect
(
subject
).
to
be_nil
}
...
@@ -37,13 +37,13 @@ describe Ci::CreateTriggerRequestService do
...
@@ -37,13 +37,13 @@ describe Ci::CreateTriggerRequestService do
subject
{
service
.
execute
(
project
,
trigger
,
'master'
)
}
subject
{
service
.
execute
(
project
,
trigger
,
'master'
)
}
before
do
before
do
@commit1
=
FactoryGirl
.
create
:commit
,
committed_at:
2
.
hour
.
ago
,
project:
project
@commit1
=
FactoryGirl
.
create
:c
i_c
ommit
,
committed_at:
2
.
hour
.
ago
,
project:
project
@commit2
=
FactoryGirl
.
create
:commit
,
committed_at:
1
.
hour
.
ago
,
project:
project
@commit2
=
FactoryGirl
.
create
:c
i_c
ommit
,
committed_at:
1
.
hour
.
ago
,
project:
project
@commit3
=
FactoryGirl
.
create
:commit
,
committed_at:
3
.
hour
.
ago
,
project:
project
@commit3
=
FactoryGirl
.
create
:c
i_c
ommit
,
committed_at:
3
.
hour
.
ago
,
project:
project
end
end
context
'retries latest one'
do
context
'retries latest one'
do
it
{
expect
(
subject
).
to
be_kind_of
(
TriggerRequest
)
}
it
{
expect
(
subject
).
to
be_kind_of
(
Ci
::
TriggerRequest
)
}
it
{
expect
(
subject
).
to
be_persisted
}
it
{
expect
(
subject
).
to
be_persisted
}
it
{
expect
(
subject
.
commit
).
to
eq
(
@commit2
)
}
it
{
expect
(
subject
.
commit
).
to
eq
(
@commit2
)
}
end
end
...
...
spec/services/ci/event_service_spec.rb
View file @
b87ca750
require
'spec_helper'
require
'spec_helper'
describe
Ci
::
EventService
do
describe
Ci
::
EventService
do
let
(
:project
)
{
FactoryGirl
.
create
:project
,
name:
"GitLab / gitlab-shell"
}
let
(
:project
)
{
FactoryGirl
.
create
:
ci_
project
,
name:
"GitLab / gitlab-shell"
}
let
(
:user
)
{
double
(
username:
"root"
,
id:
1
)
}
let
(
:user
)
{
double
(
username:
"root"
,
id:
1
)
}
before
do
before
do
...
@@ -10,25 +10,25 @@ describe Ci::EventService do
...
@@ -10,25 +10,25 @@ describe Ci::EventService do
describe
:remove_project
do
describe
:remove_project
do
it
"creates event"
do
it
"creates event"
do
EventService
.
new
.
remove_project
(
user
,
project
)
Ci
::
EventService
.
new
.
remove_project
(
user
,
project
)
expect
(
Event
.
admin
.
last
.
description
).
to
eq
(
"Project
\"
GitLab / gitlab-shell
\"
has been removed by root"
)
expect
(
Ci
::
Event
.
admin
.
last
.
description
).
to
eq
(
"Project
\"
GitLab / gitlab-shell
\"
has been removed by root"
)
end
end
end
end
describe
:create_project
do
describe
:create_project
do
it
"creates event"
do
it
"creates event"
do
EventService
.
new
.
create_project
(
user
,
project
)
Ci
::
EventService
.
new
.
create_project
(
user
,
project
)
expect
(
Event
.
admin
.
last
.
description
).
to
eq
(
"Project
\"
GitLab / gitlab-shell
\"
has been created by root"
)
expect
(
Ci
::
Event
.
admin
.
last
.
description
).
to
eq
(
"Project
\"
GitLab / gitlab-shell
\"
has been created by root"
)
end
end
end
end
describe
:change_project_settings
do
describe
:change_project_settings
do
it
"creates event"
do
it
"creates event"
do
EventService
.
new
.
change_project_settings
(
user
,
project
)
Ci
::
EventService
.
new
.
change_project_settings
(
user
,
project
)
expect
(
Event
.
last
.
description
).
to
eq
(
"User
\"
root
\"
updated projects settings"
)
expect
(
Ci
::
Event
.
last
.
description
).
to
eq
(
"User
\"
root
\"
updated projects settings"
)
end
end
end
end
end
end
spec/services/ci/web_hook_service_spec.rb
View file @
b87ca750
require
'spec_helper'
require
'spec_helper'
describe
Ci
::
WebHookService
do
describe
Ci
::
WebHookService
do
let
(
:project
)
{
FactoryGirl
.
create
:project
}
let
(
:project
)
{
FactoryGirl
.
create
:
ci_
project
}
let
(
:commit
)
{
FactoryGirl
.
create
:commit
,
project:
project
}
let
(
:commit
)
{
FactoryGirl
.
create
:c
i_c
ommit
,
project:
project
}
let
(
:build
)
{
FactoryGirl
.
create
:build
,
commit:
commit
}
let
(
:build
)
{
FactoryGirl
.
create
:
ci_
build
,
commit:
commit
}
let
(
:hook
)
{
FactoryGirl
.
create
:web_hook
,
project:
project
}
let
(
:hook
)
{
FactoryGirl
.
create
:
ci_
web_hook
,
project:
project
}
describe
:execute
do
describe
:execute
do
it
"should execute successfully"
do
it
"should execute successfully"
do
stub_request
(
:post
,
hook
.
url
).
to_return
(
status:
200
)
stub_request
(
:post
,
hook
.
url
).
to_return
(
status:
200
)
expect
(
WebHookService
.
new
.
build_end
(
build
)).
to
be_truthy
expect
(
Ci
::
WebHookService
.
new
.
build_end
(
build
)).
to
be_truthy
end
end
end
end
...
@@ -31,6 +31,6 @@ describe Ci::WebHookService do
...
@@ -31,6 +31,6 @@ describe Ci::WebHookService do
end
end
def
build_data
(
build
)
def
build_data
(
build
)
WebHookService
.
new
.
send
:build_data
,
build
Ci
::
WebHookService
.
new
.
send
:build_data
,
build
end
end
end
end
spec/support/login_helpers.rb
View file @
b87ca750
...
@@ -44,4 +44,8 @@ module LoginHelpers
...
@@ -44,4 +44,8 @@ module LoginHelpers
def
logout_direct
def
logout_direct
page
.
driver
.
submit
:delete
,
'/users/sign_out'
,
{}
page
.
driver
.
submit
:delete
,
'/users/sign_out'
,
{}
end
end
def
skip_ci_admin_auth
allow_any_instance_of
(
Ci
::
Admin
::
ApplicationController
).
to
receive_messages
(
authenticate_admin!:
true
)
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