Commit a8dd4d36 authored by Dmitriy Zaporozhets's avatar Dmitriy Zaporozhets

Fix build features specs

parent 9a9417ee
...@@ -31,6 +31,8 @@ module Ci ...@@ -31,6 +31,8 @@ module Ci
include Ci::ProjectStatus include Ci::ProjectStatus
belongs_to :gl_project, class_name: 'Project', foreign_key: :gitlab_id
has_many :commits, ->() { order(:committed_at) }, dependent: :destroy, class_name: 'Ci::Commit' has_many :commits, ->() { order(:committed_at) }, dependent: :destroy, class_name: 'Ci::Commit'
has_many :builds, through: :commits, dependent: :destroy, class_name: 'Ci::Build' has_many :builds, through: :commits, dependent: :destroy, class_name: 'Ci::Build'
has_many :runner_projects, dependent: :destroy, class_name: 'Ci::RunnerProject' has_many :runner_projects, dependent: :destroy, class_name: 'Ci::RunnerProject'
......
...@@ -43,7 +43,7 @@ FactoryGirl.define do ...@@ -43,7 +43,7 @@ FactoryGirl.define do
"git@demo.gitlab.com:gitlab/gitlab-shell#{n}.git" "git@demo.gitlab.com:gitlab/gitlab-shell#{n}.git"
end end
sequence :gitlab_id gl_project factory: :project
factory :ci_project do factory :ci_project do
token 'iPWx6WM4lhHNedGfBpPJNP' token 'iPWx6WM4lhHNedGfBpPJNP'
......
require 'spec_helper' require 'spec_helper'
describe "Builds" do describe "Builds" do
context :private_project do
before do before do
@project = FactoryGirl.create :project @project = FactoryGirl.create :ci_project
@commit = FactoryGirl.create :commit, project: @project @commit = FactoryGirl.create :ci_commit, project: @project
@build = FactoryGirl.create :build, commit: @commit @build = FactoryGirl.create :ci_build, commit: @commit
login_as :user
@project.gl_project.team << [@user, :master]
end end
describe "GET /:project/builds/:id" do describe "GET /:project/builds/:id" do
before do before do
login_as :user visit ci_project_build_path(@project, @build)
visit project_build_path(@project, @build)
end end
it { expect(page).to have_content @commit.sha[0..7] } it { expect(page).to have_content @commit.sha[0..7] }
...@@ -20,9 +22,8 @@ describe "Builds" do ...@@ -20,9 +22,8 @@ describe "Builds" do
describe "GET /:project/builds/:id/cancel" do describe "GET /:project/builds/:id/cancel" do
before do before do
login_as :user
@build.run! @build.run!
visit cancel_project_build_path(@project, @build) visit cancel_ci_project_build_path(@project, @build)
end end
it { expect(page).to have_content 'canceled' } it { expect(page).to have_content 'canceled' }
...@@ -31,27 +32,29 @@ describe "Builds" do ...@@ -31,27 +32,29 @@ describe "Builds" do
describe "POST /:project/builds/:id/retry" do describe "POST /:project/builds/:id/retry" do
before do before do
login_as :user
@build.cancel! @build.cancel!
visit project_build_path(@project, @build) visit ci_project_build_path(@project, @build)
click_link 'Retry' click_link 'Retry'
end end
it { expect(page).to have_content 'pending' } it { expect(page).to have_content 'pending' }
it { expect(page).to have_content 'Cancel' } it { expect(page).to have_content 'Cancel' }
end end
end
context :public_project do
describe "Show page public accessible" do describe "Show page public accessible" do
before do before do
@project = FactoryGirl.create :public_project @project = FactoryGirl.create :ci_public_project
@commit = FactoryGirl.create :commit, project: @project @commit = FactoryGirl.create :ci_commit, project: @project
@runner = FactoryGirl.create :specific_runner @runner = FactoryGirl.create :ci_specific_runner
@build = FactoryGirl.create :build, commit: @commit, runner: @runner @build = FactoryGirl.create :ci_build, commit: @commit, runner: @runner
stub_gitlab_calls stub_gitlab_calls
visit project_build_path(@project, @build) visit ci_project_build_path(@project, @build)
end end
it { expect(page).to have_content @commit.sha[0..7] } it { expect(page).to have_content @commit.sha[0..7] }
end end
end
end 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