debian-mirror-gitlab/spec/features/admin/admin_builds_spec.rb

70 lines
2 KiB
Ruby
Raw Normal View History

2015-09-25 12:07:36 +05:30
require 'spec_helper'
describe "Admin Builds" do
2015-10-24 18:46:33 +05:30
let(:commit) { FactoryGirl.create :ci_commit }
2015-09-25 12:07:36 +05:30
let(:build) { FactoryGirl.create :ci_build, commit: commit }
before do
2015-12-23 02:04:40 +05:30
login_as :admin
2015-09-25 12:07:36 +05:30
end
describe "GET /admin/builds" do
before do
build
2015-12-23 02:04:40 +05:30
visit admin_builds_path
2015-09-25 12:07:36 +05:30
end
2015-12-23 02:04:40 +05:30
it { expect(page).to have_content "Running" }
2015-09-25 12:07:36 +05:30
it { expect(page).to have_content build.short_sha }
end
describe "Tabs" do
it "shows all builds" do
2015-10-24 18:46:33 +05:30
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"
2015-09-25 12:07:36 +05:30
2015-12-23 02:04:40 +05:30
visit admin_builds_path
within ".center-top-menu" do
click_on "All"
end
2015-09-25 12:07:36 +05:30
expect(page.all(".build-link").size).to eq(4)
end
2015-12-23 02:04:40 +05:30
it "shows finished builds" do
2015-09-25 12:07:36 +05:30
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"
2015-12-23 02:04:40 +05:30
visit admin_builds_path
2015-09-25 12:07:36 +05:30
2015-12-23 02:04:40 +05:30
within ".center-top-menu" do
click_on "Finished"
2015-09-25 12:07:36 +05:30
end
2015-12-23 02:04:40 +05:30
expect(page.find(".build-link")).not_to have_content(build.id)
2015-09-25 12:07:36 +05:30
expect(page.find(".build-link")).not_to have_content(build1.id)
2015-12-23 02:04:40 +05:30
expect(page.find(".build-link")).to have_content(build2.id)
2015-09-25 12:07:36 +05:30
end
it "shows running builds" do
build = FactoryGirl.create :ci_build, commit: commit, status: "pending"
build2 = FactoryGirl.create :ci_build, commit: commit, status: "success"
build3 = FactoryGirl.create :ci_build, commit: commit, status: "failed"
2015-12-23 02:04:40 +05:30
visit admin_builds_path
2015-09-25 12:07:36 +05:30
2015-12-23 02:04:40 +05:30
within ".center-top-menu" do
2015-09-25 12:07:36 +05:30
click_on "Running"
end
2015-12-23 02:04:40 +05:30
expect(page.find(".build-link")).to have_content(build.id)
2015-09-25 12:07:36 +05:30
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