debian-mirror-gitlab/spec/features/ci/admin/builds_spec.rb
2015-10-24 18:46:33 +05:30

70 lines
2.3 KiB
Ruby

require 'spec_helper'
describe "Admin Builds" do
let(:commit) { FactoryGirl.create :ci_commit }
let(:build) { FactoryGirl.create :ci_build, commit: commit }
before do
skip_ci_admin_auth
login_as :user
end
describe "GET /admin/builds" do
before do
build
visit ci_admin_builds_path
end
it { expect(page).to have_content "All builds" }
it { expect(page).to have_content build.short_sha }
end
describe "Tabs" do
it "shows all builds" do
FactoryGirl.create :ci_build, commit: commit, status: "pending"
FactoryGirl.create :ci_build, commit: commit, status: "running"
FactoryGirl.create :ci_build, commit: commit, status: "success"
FactoryGirl.create :ci_build, commit: commit, status: "failed"
visit ci_admin_builds_path
expect(page.all(".build-link").size).to eq(4)
end
it "shows pending builds" do
build = FactoryGirl.create :ci_build, commit: commit, status: "pending"
build1 = FactoryGirl.create :ci_build, commit: commit, status: "running"
build2 = FactoryGirl.create :ci_build, commit: commit, status: "success"
build3 = FactoryGirl.create :ci_build, commit: commit, status: "failed"
visit ci_admin_builds_path
within ".nav.nav-tabs" do
click_on "Pending"
end
expect(page.find(".build-link")).to have_content(build.id)
expect(page.find(".build-link")).not_to have_content(build1.id)
expect(page.find(".build-link")).not_to have_content(build2.id)
expect(page.find(".build-link")).not_to have_content(build3.id)
end
it "shows running builds" do
build = FactoryGirl.create :ci_build, commit: commit, status: "pending"
build1 = FactoryGirl.create :ci_build, commit: commit, status: "running"
build2 = FactoryGirl.create :ci_build, commit: commit, status: "success"
build3 = FactoryGirl.create :ci_build, commit: commit, status: "failed"
visit ci_admin_builds_path
within ".nav.nav-tabs" do
click_on "Running"
end
expect(page.find(".build-link")).to have_content(build1.id)
expect(page.find(".build-link")).not_to have_content(build.id)
expect(page.find(".build-link")).not_to have_content(build2.id)
expect(page.find(".build-link")).not_to have_content(build3.id)
end
end
end