Skip to content
Snippets Groups Projects
Commit 9e619048 authored by Grzegorz Bizon's avatar Grzegorz Bizon
Browse files

Parse XML instead of HTML in tests for a SVG build badge

parent debaa813
No related branches found
No related tags found
No related merge requests found
Loading
@@ -6,17 +6,17 @@ Feature: Project Badges Build
Loading
@@ -6,17 +6,17 @@ Feature: Project Badges Build
And project has a recent build And project has a recent build
   
Scenario: I want to see a badge for successfully built project Scenario: I want to see a badge for successfully built project
Given recent build is successfull Given recent build is successful
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
   
Scenario: I want to see a badge for project with filed builds Scenario: I want to see a badge for project with failed 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
   
Scenario: I want to see a badge for project with running builds Scenario: I want to see a badge for project with running builds
Given recent build is successfull Given recent build is successful
And project has an another build that is running And project has another build that is running
When I display builds badge for a master branch When I display builds badge for a master branch
Then I should see a build running badge Then I should see a build running badge
Loading
@@ -21,7 +21,7 @@ class Spinach::Features::ProjectBadgesBuild < Spinach::FeatureSteps
Loading
@@ -21,7 +21,7 @@ class Spinach::Features::ProjectBadgesBuild < Spinach::FeatureSteps
end end
   
def expect_badge(status) def expect_badge(status)
svg = Nokogiri::HTML.parse(page.body) svg = Nokogiri::XML.parse(page.body)
expect(page.response_headers).to include('Content-Type' => 'image/svg+xml') expect(page.response_headers).to include('Content-Type' => 'image/svg+xml')
expect(svg.at(%Q{text:contains("#{status}")})).to be_truthy expect(svg.at(%Q{text:contains("#{status}")})).to be_truthy
end end
Loading
Loading
Loading
@@ -10,7 +10,7 @@ module SharedBuilds
Loading
@@ -10,7 +10,7 @@ module SharedBuilds
@build = create(:ci_build, commit: @ci_commit) @build = create(:ci_build, commit: @ci_commit)
end end
   
step 'recent build is successfull' do step 'recent build is successful' do
@build.update_column(:status, 'success') @build.update_column(:status, 'success')
end end
   
Loading
@@ -18,7 +18,7 @@ module SharedBuilds
Loading
@@ -18,7 +18,7 @@ module SharedBuilds
@build.update_column(:status, 'failed') @build.update_column(:status, 'failed')
end end
   
step 'project has an another build that is running' do step 'project has another build that is running' do
create(:ci_build, commit: @ci_commit, name: 'second build', status: 'running') create(:ci_build, commit: @ci_commit, name: 'second build', status: 'running')
end end
   
Loading
Loading
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment