BigW Consortium Gitlab

build.rb 937 Bytes
Newer Older
1
class Spinach::Features::ProjectBadgesBuild < Spinach::FeatureSteps
2
  include SharedAuthentication
3 4 5 6 7
  include SharedProject
  include SharedBuilds
  include RepoHelpers

  step 'I display builds badge for a master branch' do
8
    visit build_namespace_project_badges_path(@project.namespace, @project, ref: :master, format: :svg)
9 10 11
  end

  step 'I should see a build success badge' do
12
    expect_badge('success')
13 14 15
  end

  step 'I should see a build failed badge' do
16
    expect_badge('failed')
17 18
  end

19 20
  step 'I should see a build running badge' do
    expect_badge('running')
21 22
  end

23
  step 'I should see a badge that has not been cached' do
24
    expect(page.response_headers['Cache-Control']).to include 'no-cache'
25 26
  end

27
  def expect_badge(status)
28
    svg = Nokogiri::XML.parse(page.body)
29
    expect(page.response_headers['Content-Type']).to include('image/svg+xml')
30 31
    expect(svg.at(%Q{text:contains("#{status}")})).to be_truthy
  end
32
end