debian-mirror-gitlab/features/steps/project/badges/build.rb

33 lines
937 B
Ruby
Raw Normal View History

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