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
29f2600a
Commit
29f2600a
authored
Feb 08, 2016
by
Grzegorz Bizon
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Improve build badge tests, add another test case
parent
cf0eab50
Changes
3
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
19 additions
and
6 deletions
+19
-6
features/project/builds/badge.feature
features/project/builds/badge.feature
+6
-2
features/steps/project/builds/badge.rb
features/steps/project/builds/badge.rb
+9
-4
features/steps/shared/builds.rb
features/steps/shared/builds.rb
+4
-0
No files found.
features/project/builds/badge.feature
View file @
29f2600a
...
@@ -8,10 +8,14 @@ Feature: Project Builds Badge
...
@@ -8,10 +8,14 @@ Feature: Project Builds Badge
Given
recent build is successfull
Given
recent build is successfull
When
I display builds badge for a master branch
When
I display builds badge for a master branch
Then
I should see a build success badge
Then
I should see a build success badge
And
build badge is a svg image
Scenario
:
I
want to see a badge for project with filed builds
Scenario
:
I
want to see a badge for project with filed builds
Given
recent build failed
Given
recent build failed
When
I display builds badge for a master branch
When
I display builds badge for a master branch
Then
I should see a build failed badge
Then
I should see a build failed badge
And
build badge is a svg image
Scenario
:
I
want to see a badge for project with running builds
Given
recent build is successfull
And
project has an another build that is running
When
I display builds badge for a master branch
Then
I should see a build running badge
features/steps/project/builds/badge.rb
View file @
29f2600a
...
@@ -8,18 +8,23 @@ class Spinach::Features::ProjectBuildsBadge < Spinach::FeatureSteps
...
@@ -8,18 +8,23 @@ class Spinach::Features::ProjectBuildsBadge < Spinach::FeatureSteps
end
end
step
'I should see a build success badge'
do
step
'I should see a build success badge'
do
expect
(
svg
.
at
(
'text:contains("success")'
)).
to
be_truthy
expect
_badge
(
'success'
)
end
end
step
'I should see a build failed badge'
do
step
'I should see a build failed badge'
do
expect
(
svg
.
at
(
'text:contains("failed")'
)).
to
be_truthy
expect
_badge
(
'failed'
)
end
end
step
'
build badge is a svg ima
ge'
do
step
'
I should see a build running bad
ge'
do
expect
(
page
.
response_headers
).
to
include
(
'Content-Type'
=>
'image/svg+xml
'
)
expect
_badge
(
'running
'
)
end
end
def
svg
def
svg
Nokogiri
::
HTML
.
parse
(
page
.
body
)
Nokogiri
::
HTML
.
parse
(
page
.
body
)
end
end
def
expect_badge
(
status
)
expect
(
page
.
response_headers
).
to
include
(
'Content-Type'
=>
'image/svg+xml'
)
expect
(
svg
.
at
(
%Q{text:contains("
#{
status
}
")}
)).
to
be_truthy
end
end
end
features/steps/shared/builds.rb
View file @
29f2600a
...
@@ -18,6 +18,10 @@ module SharedBuilds
...
@@ -18,6 +18,10 @@ module SharedBuilds
@build
.
update_column
(
:status
,
'failed'
)
@build
.
update_column
(
:status
,
'failed'
)
end
end
step
'project has an another build that is running'
do
create
(
:ci_build
,
commit:
@ci_commit
,
name:
'second build'
,
status:
'running'
)
end
step
'I visit recent build details page'
do
step
'I visit recent build details page'
do
visit
namespace_project_build_path
(
@project
.
namespace
,
@project
,
@build
)
visit
namespace_project_build_path
(
@project
.
namespace
,
@project
,
@build
)
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