Welcome to mirror list, hosted at ThFree Co, Russian Federation.

gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGrzegorz Bizon <grzesiek.bizon@gmail.com>2016-02-08 14:23:56 +0300
committerGrzegorz Bizon <grzesiek.bizon@gmail.com>2016-02-11 12:29:14 +0300
commitcf0eab504772c05b067ca60f78bc76779342c912 (patch)
tree71e2e853e426b95c5fba53151bae4fd8e0a639f3 /features/steps
parenteb7721e183337784de9fcaf219a64d443b6b3f0c (diff)
Add feature tests for builds status badge
Diffstat (limited to 'features/steps')
-rw-r--r--features/steps/project/builds/badge.rb25
-rw-r--r--features/steps/shared/builds.rb12
2 files changed, 35 insertions, 2 deletions
diff --git a/features/steps/project/builds/badge.rb b/features/steps/project/builds/badge.rb
new file mode 100644
index 00000000000..3cf1e2cab5e
--- /dev/null
+++ b/features/steps/project/builds/badge.rb
@@ -0,0 +1,25 @@
+class Spinach::Features::ProjectBuildsBadge < Spinach::FeatureSteps
+ include SharedProject
+ include SharedBuilds
+ include RepoHelpers
+
+ step 'I display builds badge for a master branch' do
+ visit badge_namespace_project_builds_path(@project.namespace, @project, ref: :master, format: :svg)
+ end
+
+ step 'I should see a build success badge' do
+ expect(svg.at('text:contains("success")')).to be_truthy
+ end
+
+ step 'I should see a build failed badge' do
+ expect(svg.at('text:contains("failed")')).to be_truthy
+ end
+
+ step 'build badge is a svg image' do
+ expect(page.response_headers).to include('Content-Type' => 'image/svg+xml')
+ end
+
+ def svg
+ Nokogiri::HTML.parse(page.body)
+ end
+end
diff --git a/features/steps/shared/builds.rb b/features/steps/shared/builds.rb
index 726e2e814ad..055ebe1c815 100644
--- a/features/steps/shared/builds.rb
+++ b/features/steps/shared/builds.rb
@@ -6,8 +6,16 @@ module SharedBuilds
end
step 'project has a recent build' do
- ci_commit = create :ci_commit, project: @project, sha: sample_commit.id
- @build = create :ci_build, commit: ci_commit
+ @ci_commit = create(:ci_commit, project: @project, sha: @project.commit.sha)
+ @build = create(:ci_build, commit: @ci_commit)
+ end
+
+ step 'recent build is successfull' do
+ @build.update_column(:status, 'success')
+ end
+
+ step 'recent build failed' do
+ @build.update_column(:status, 'failed')
end
step 'I visit recent build details page' do