2016-02-10 06:20:01 -05:00
|
|
|
class Spinach::Features::ProjectBadgesBuild < Spinach::FeatureSteps
|
2016-02-08 07:53:30 -05:00
|
|
|
include SharedAuthentication
|
2016-02-08 06:23:56 -05:00
|
|
|
include SharedProject
|
|
|
|
include SharedBuilds
|
|
|
|
include RepoHelpers
|
|
|
|
|
|
|
|
step 'I display builds badge for a master branch' do
|
2016-02-09 07:10:16 -05:00
|
|
|
visit build_namespace_project_badges_path(@project.namespace, @project, ref: :master, format: :svg)
|
2016-02-08 06:23:56 -05:00
|
|
|
end
|
|
|
|
|
|
|
|
step 'I should see a build success badge' do
|
2016-02-08 06:42:35 -05:00
|
|
|
expect_badge('success')
|
2016-02-08 06:23:56 -05:00
|
|
|
end
|
|
|
|
|
|
|
|
step 'I should see a build failed badge' do
|
2016-02-08 06:42:35 -05:00
|
|
|
expect_badge('failed')
|
2016-02-08 06:23:56 -05:00
|
|
|
end
|
|
|
|
|
2016-02-08 06:42:35 -05:00
|
|
|
step 'I should see a build running badge' do
|
|
|
|
expect_badge('running')
|
2016-02-08 06:23:56 -05:00
|
|
|
end
|
|
|
|
|
2016-03-04 04:34:35 -05:00
|
|
|
step 'I should see a badge that has not been cached' do
|
2016-03-17 07:16:34 -04:00
|
|
|
expect(page.response_headers['Cache-Control']).to include 'no-cache'
|
2016-03-04 04:34:35 -05:00
|
|
|
end
|
|
|
|
|
2016-02-08 06:42:35 -05:00
|
|
|
def expect_badge(status)
|
2016-02-11 04:27:53 -05:00
|
|
|
svg = Nokogiri::XML.parse(page.body)
|
2016-02-08 06:42:35 -05:00
|
|
|
expect(page.response_headers).to include('Content-Type' => 'image/svg+xml')
|
|
|
|
expect(svg.at(%Q{text:contains("#{status}")})).to be_truthy
|
|
|
|
end
|
2016-02-08 06:23:56 -05:00
|
|
|
end
|