Commit 29f2600a authored by Grzegorz Bizon's avatar Grzegorz Bizon

Improve build badge tests, add another test case

parent cf0eab50
......@@ -8,10 +8,14 @@ Feature: Project Builds Badge
Given recent build is successfull
When I display builds badge for a master branch
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
Given recent build failed
When I display builds badge for a master branch
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
......@@ -8,18 +8,23 @@ class Spinach::Features::ProjectBuildsBadge < Spinach::FeatureSteps
end
step 'I should see a build success badge' do
expect(svg.at('text:contains("success")')).to be_truthy
expect_badge('success')
end
step 'I should see a build failed badge' do
expect(svg.at('text:contains("failed")')).to be_truthy
expect_badge('failed')
end
step 'build badge is a svg image' do
expect(page.response_headers).to include('Content-Type' => 'image/svg+xml')
step 'I should see a build running badge' do
expect_badge('running')
end
def svg
Nokogiri::HTML.parse(page.body)
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
......@@ -18,6 +18,10 @@ module SharedBuilds
@build.update_column(:status, 'failed')
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
visit namespace_project_build_path(@project.namespace, @project, @build)
end
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment